1

Say a user opens a tab on their own, and wants to make changes to the data in that tab using an extension which inputs data for them on that page.

From my understanding, Selenium can only have access to browser sessions if they are open with webdriver, which I don't believe works if a user opens a tab manually. Therefore, is there a way for Selenium to interact with such a tab, or should I use something else?

TheIce
  • 11
  • 1

1 Answers1

0

If the tab you opened manually was already part of a browser window that was opened with Selenium/WebDriver, then you only need to switch to the tab to have Selenium perform actions on it. Eg:

driver.switch_to.window(driver.window_handles[-1])

However, if the original browser window was not opened with Selenium/WebDriver, then you can't give it control of the browser later. That would be a major security violation if that was possible.

Michael Mintz
  • 9,007
  • 6
  • 31
  • 48