When I execute tests using MicrosoftWebDriver for Edge all works fine, but when I minimise the window all tests become failed. Does Edge or MicrosoftWebDriver have any options to avoid that behavior?
-
Why do you want to _minimize the window_? – undetected Selenium Apr 18 '18 at 10:03
-
It looks like Edge needs some kind of visualisation. If my PC goes to sleep mode tests fail too. Even if nobody open a VM with selenium-grid server test can't start. – Ivan Kotovich Apr 18 '18 at 13:40
1 Answers
As you have been trying to minimise the Browser Window while your Test Execution is In Progress it will be against all the Best Practices. At this point it is worth to mention that as Selenium mocks the User Actions hence Selenium needs Browser focus. If the focus is lost Selenium won't be able to execute the lines of code. Consider the following steps while your Test Execution :
- Browser Maximize : While you execute your tests always keep the Web Browser maximized so majority of the elements are within the Viewport
As per best practices, you should try to execute your Test Scripts / Automation Framework in an isolated Test Environment away from Manual Intervention with all the required Software and Hardware configurations and setup.
You can find a detailed discussion in How to run chrome driver in background using selenium with Ruby for Mac OSx?
You also have an option to use Google Chrome or Mozilla Firefox in Headless version.
For Firefox you can find a detailed discussion in How to make firefox headless programatically in Selenium with python?
For Chrome you can find a detailed discussion in selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH error with Headless Chrome
For Ghost Browser you can find a detailed discussion in Which drivers support “no-browser”/“headless” testing?

- 183,867
- 41
- 278
- 352
-
I have Asure VM for test execution but in my case tests run only if that VM is opened by Remote Desctop Connection. If I try to execute tests without RDP it doesn't work. – Ivan Kotovich Apr 19 '18 at 11:31
-