How to interact with the Chrome Developer Tools Console in the Background?

Hello,

I am trying to click a button on a website in the background (because it is an unattended bot in a remote environment). Note that setting SendWindowMessages on the Click activity to True does not work in the background for an unattended bot. Usually one would set Simulate Click to True and it would work in the background, however, this specific button I’m trying to click is not compatible with Simulate Click, i.e. it does not click.

I found that I am able to make the button get clicked in the Chrome dev tools console using the following JavaScript code:

document.getElementById('pickfiles').click()

I have tried the InjectJS activity but was unfortunately unable to trigger the button click using the same code

"function(){
document.getElementById('pickfiles').click();
}"

The InjectJS code works for other elements on the page, but not the ‘pickfiles’ element I’m trying to click. Note that this code does successfully click the button when I’m using it directly inside the Dev Tools console.

So I created a workflow that opens the chrome dev console using a series of click activities with SimulateClick set to True.

The next steps are to Type or Paste the code above into the console IN THE BACKGROUND then click enter on the keyboard on the background, but I have not been able to do so. SimulateType and Simulating SendHotkeys do not work in the dev tools console. Only SendWindowMessages works but that does not solve my problem for unattended automation.

Are there any easier or better ways/workarounds/hacks to BACKGROUND click or simulate click a button for an unattended bot?

Thank you in advance for your suggestions.

Leon

a risky interpretation

we saw best reliable results for inject js when the method signature was not changed and the arguments were not renamed to other names. Check docu for the details.

Also we ensured that the activity was properly targeting to the page part and was not sending to the nirvana

As an alternate approach give a try on:

1 Like

Thanks for your answer. May you please elaborate on how I can ensure targeting to the page part and not the nirvana?

And also, I will try the WebDriver suggestion. Hope it works! I’ll let you know.

Thanks again for your suggestions!

some scripts are interacting with some elements, regions a page. When the selector of the activity is not set, that item will be reached, then we do send to Nirvana. So here we just take care of on how the selector is formed.

I see I tried the Webdriver option - I get the same error as before. I’ve been stuck on this problem for months and I worry there’s no solution to this.

Do you know of any other workarounds to click a browser button in the background?

Any other suggestions? Still struggling with a solution to this.

Hi @Leon_Petrou,

I see what you are trying to do. A year ago there was another question to which I found a way to open chrome console by using a send key activity to the browser window so this should work on a unattended robot as well.


Also do check if that button actually allows for a click() method. You can do this manually in the console and check all the methods available for this element.

I am not sure if this will solve your question, but I do hope it gives you some ideas.