Question

Click on links on a webpage without using the keystrokes

  • 23 February 2023
  • 3 replies
  • 75 views

Badge +3

Hi All,

I built a bot that “can” click on links on a webpages using the keystroke function and [TAB] to the link. However, this method is unreliable as there are 50+ [TAB]s to get to the link and the bot rarely is able to click on the correct link on the static webpage. I’ve tried increasing the time between keystrokes, but that hasn’t helped.

With that said, is there way to click on a link on a webpage by accessing the link through another way, perhaps how it is labeled in the browser inspect function? Any starting points would be appreciated. Using the AA Click function with screen coordinates is not going to work in this instance.

Thank you,
Brobert


3 replies

Badge +3

I entered the following script in the Enter Script Here Field in the Browser: Run JavaScript Automation Anywhere function.

document.querySelector('#M_HS_HUB_WRK_EXPAND_ALL_PB').click();

which was taken from the web element for the Expand All button

<input type="button" name="M_HS_HUB_WRK_EXPAND_ALL_PB" id="M_HS_HUB_WRK_EXPAND_ALL_PB" tabindex="39" value="Expand All" class="PSPUSHBUTTON" style="width:107px; " onclick="submitAction_win0(document.win0,this.id,event);">

Yet, this did not seem to work. Any suggestions would be appreciated.

Thank you in advance,
Robert
 

Userlevel 7
Badge +13

Hi @Brobert ,

 

Why don’t you try with the Recorder package to mimic this clicking action? If you have already tried that, what was the challenge you had to switch to Keystrokes?

Badge +3

Hi @Padmakumar

 

Thank you for taking the time to answer. I apologize for my delay as I was without power for a week. So, the recorder packages does not appear to recognize links on this particular webpage--that may be because the webpage was created in-house for our university. I have tried the different types of recorders available in my edition and was not successful in recognizing the link with this function. It just recognizes a large square over the web page instead of the elements within it.

The keystrokes have been troublesome even though the fields on the webpage are static, there are always 60 of them. However, as the bot tabs through the fields, it lands on a different final field 50% of the time. I have adjusted the time between key strokes to account for lagging when the cursor lands on any particular field, yet even if I lengthen that time, the tabbing is still unreliable.

Thank you,
Brobert

Reply