Javascript Find And Click Advanced Assistance

Hello all,

I’ve been stuck on this for a while now…

What I’m trying to do is to set up a javascript trigger on Chrome that clicks the following buttons:

input class="btn zen-btn" id="thePage:theForm:thePageBlock:reportSubscriptionButtons:bottom:saveSubscriptionAndRunNowBtn" name="thePage:theForm:thePageBlock:reportSubscriptionButtons:bottom:saveSubscriptionAndRunNowBtn" onclick="A4J.AJAX.Submit('thePage:theForm',event,{'similarityGroupingId':'thePage:theForm:thePageBlock:reportSubscriptionButtons:bottom:saveSubscriptionAndRunNowBtn','parameters':{'thePage:theForm:thePageBlock:reportSubscriptionButtons:bottom:saveSubscriptionAndRunNowBtn':'thePage:theForm:thePageBlock:reportSubscriptionButtons:bottom:saveSubscriptionAndRunNowBtn'} } );return false;" value="Save & Run Now" type="button">

input value="Edit Subscription" class="btn" name="subscribe" onclick="document.report.action='/analyticnotification/analyticNotification.apexp?reportId=00O1J0000067H0i&notificationId=0Au1J000000bmQX'; document.report.submit(); " title="Edit Subscription" type="submit">

So far, all I have is:

javascript: $( document ).ready(function() { $('#SubscriptionAndRunNowBtn').trigger('click'); });

But I just cannot get it to work…

Simply click the bookmark javascript and it would click one button, click the other bookmark and it would click the second button.

I would apprecaite any help with this if possible.

Thank you

I will, for the moment, assume you have jQuery loaded.


$('#SubscriptionAndRunNowBtn')

wont find the button, because that’s not the ID of the button. Try

$("#thePage\\:theForm\\:thePageBlock\\:reportSubscriptionButtons\\:bottom\\:saveSubscriptionAndRunNowBtn")

instead. (Also if this is a page you have created, ask yourself why that ID.)

1 Like

Thank you m_hutley,

I have loaded jquery, although I am quite new to using it.

I tired the following:

jquery:

$( document ).ready(function() { $("#thePage\\:theForm\\:thePageBlock\\:reportSubscriptionButtons\\:bottom\\:saveSubscriptionAndRunNowBtn").trigger('click'); });

jquery:

$("#thePage\\:theForm\\:thePageBlock\\:reportSubscriptionButtons\\:bottom\\:saveSubscriptionAndRunNowBtn").click();

With no success…

I just cannot get it to click that button…

I did not create this page myself, this is an extension of a webpage but I need to speed up the refresh rate.

Thanks for your help.

So I made this HTML:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input class="btn zen-btn" id="thePage:theForm:thePageBlock:reportSubscriptionButtons:bottom:saveSubscriptionAndRunNowBtn" name="thePage:theForm:thePageBlock:reportSubscriptionButtons:bottom:saveSubscriptionAndRunNowBtn" onclick="alert('wark'); A4J.AJAX.Submit('thePage:theForm',event,{'similarityGroupingId':'thePage:theForm:thePageBlock:reportSubscriptionButtons:bottom:saveSubscriptionAndRunNowBtn','parameters':{'thePage:theForm:thePageBlock:reportSubscriptionButtons:bottom:saveSubscriptionAndRunNowBtn':'thePage:theForm:thePageBlock:reportSubscriptionButtons:bottom:saveSubscriptionAndRunNowBtn'} } );return false;" value="Save &amp; Run Now" type="button">

(Line 1 cause gotta have jQuery loaded)
Went to the console, and did this:


It certainly seems to trigger for me. Threw the alert box and everything.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.