0

I've a test where it handles login system popup using Robot of Java. But because of some issues, other applications or browser instance come to front and Robot could not perform actions on system popup of Windows.

Hence before interacting with system popup using Robot, I want to bring that browser to front on machine. I tried following but it did not help -

((JavascriptExecutor)driver).executeScript("window.focus();");

Could you please suggest how I can bring it to the front?

Alpha
  • 13,320
  • 27
  • 96
  • 163
  • Possible solution here: https://stackoverflow.com/questions/309023/how-to-bring-a-window-to-the-front – Jortega Dec 25 '19 at 13:35
  • Have you tried with maximize window and switch to window options? If that does not work then you can use the PID of the browser instance and switch the focus. – supputuri Dec 26 '19 at 03:09
  • @supputuri, maximizing window and switching to window did not help. I looked in Java api of Selenium and googled but could not found how to get PID of browser. However for python there is a solution here - https://stackoverflow.com/questions/10752512/get-pid-of-browser-launched-by-selenium. Please let me know if you know same for Java. – Alpha Dec 26 '19 at 05:13

0 Answers0