I would like to know if anyone there has ever had a problem using the chromedriver in "headless" mode. In my case, when running selenium tests in this mode, the execution of the same is stopped indefinitely, not completing the test and starts execution of the next test case nor does it give the relevant exception. I would like to know if anyone can have any idea of what may be occurring. I am guessing this issue is due to static initialization of the webdriver
public static WebDriver createInstance(WebDriver driver, String browserName){..}
My logs show me this sequence the test cases are not completely executed and next test case is called
- INFO learning.helpers.DriverInitialisor - createInstance - 111 - Running Chrome browser in headless mode
- INFO learning.helpers.DriverInitialisor - createInstance - 126 - Launching Chrome browser in local mode
- INFO learning.tests.ExpandFAQ - expandAndCollapseFAQ - 30 - launching the ION Learning Hub Application
- INFO learning.tests.ExpandFAQ - expandAndCollapseFAQ - 35 - Open a searched product
- INFO learning.helpers.DriverInitialisor - createInstance - 111 - Running Chrome browser in headless mode
- INFO learning.helpers.DriverInitialisor - createInstance - 126 - Launching Chrome browser in local mode
- INFO learning.tests.CollapseFAQ - collapseFAQ - 30 - launching the ION Learning Hub Application
- INFO learning.tests.CollapseFAQ - collapseFAQ - 35 - Open a searched product
This continues for few test cases and then complete execution starts again for other test cases. I am running of around 50 test cases. There is no multithreading implemented.
I have noticed that in my case and worked perfectly.You need add window size as an arguments in headless Mode.I don't know which language you are working on.
If you are using python
add this .
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('window-size=1920x1080')
if you are using java
add this.
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("headless");
chromeOptions.addArguments("window-size=1920,1080");
Please try this and let me know if this work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With