Selenium window retrieve same values if Window is not in focus

Anyone's getting this issue when you're controlling a window with Selenium.

I am using Selenium to scrape some public value. I notice quite often that if the window is not on top (in focus ?), the value is still retrieved but obsolete and stays the same. When I deliberately click on the Selenium window to bring it to focus again, the value is then updated.

I tried

driver.execute_script("window.focus();")

but the problem is not solved.



Read more here: https://stackoverflow.com/questions/64104718/selenium-window-retrieve-same-values-if-window-is-not-in-focus

Content Attribution

This content was originally published by Kenny at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: