2

I'm using the Java Selenium and Chrome webdriver on Windows 10. I like to have a GUI up for debugging purposes, but my code keeps bringing the browser into focus. Specifically, lines like

driver.switchTo().window(tabs.get(1));

will bring the automated Chrome browser into focus, taking me away from checking my e-mail etc. This is true regardless of whether I'm currently looking on Chrome or another browser.

How can I get Selenium to "silently" focus on a new tab (or window etc) so I can do something while my code runs? This is sort of like the issue reported here: How can I bring Chrome browser to focus when running a Selenium test using ChromeDriver on Mac?, except I want to create the unfocused behavior that that user is trying to change.

2
  • 2
    run it in headless mode
    – PDHide
    Commented Oct 7, 2020 at 10:31
  • Yes, I can use headless once I finish the code. But it's difficult while I'm writing it I need to see what's going on.
    – Cory Smith
    Commented Oct 7, 2020 at 11:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.