RPA-Python icon indicating copy to clipboard operation
RPA-Python copied to clipboard

Is there a way to automate a Chrome window that's already open? - yes some ideas

Open rafskov opened this issue 5 years ago • 1 comments

I am trying to automate something but I always get 2FA. Is there a way to select a specific tab of Chrome?

rafskov avatar Apr 13 '21 01:04 rafskov

Hi @rafskov, to control Chrome from the backdoor, it requires launching a new Chrome session. Here are some ideas -

  1. use computer vision method and keyboard shortcuts etc to automate Chrome visually, eg r.click('submit_button.png')
  2. depending on your workflow, maybe it could be viable to use the Chrome that this package launches, maybe put some pause like r.ask() to wait forever and you do your other work. When ready to run then tell robot to start.
  3. consider batching the work to be automated and perhaps run robot less frequently but do more each time

For accessing a specific tab, if it is a Chrome session that the tool opens, you can use r.popup() to access new tabs that are opened during the automation process. If it is an existing Chrome session, you can use computer vision or keyboard shortcuts to go to the tab you want to automate on.

The tool creates a separate Chrome profile instead of using your existing Chrome user profile. This is because a backdoor is required (websocket connection) to control Chrome from backend. Without a separate user profile, each time the tool runs, it will kill user's Chrome session (very bad action, will close all open tabs) before relaunching. That is super bad design, so a separate user profile is necessary.

kensoh avatar Apr 17 '21 17:04 kensoh