webdriverio: Headless Chrome causing tests to fail?
I have written a number of tests that successfully pass when running through the Chrome Driver normally, however if running with Headless Chrome, all of the tests fail. As they cannot find the element and instead timeout. I have tried passing the window-size argument, but that didn’t resolve the issue.
capabilities: [{
browserName: 'chrome',
chromeOptions: {
args: ['--headless', '--disable-gpu', '--window-size=1920,1080'],
}
}],
The error thrown by Jasmine…
An element could not be located on the page using the given search parameters.
- WebdriverIO version: 4.14.1
- Mode: WDIO Testrunner
- If WDIO Testrunner, running sync/async: sync
- Node.js version: v8.11.2
- NPM version: 5.6.0
- Browser name and version: Chrome 66
- Platform name and version: Windows 7
- Additional wdio packages used (if applicable): wdio-jasmine-framework
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (7 by maintainers)
@CharuDattPimple without any logs it is impossible to say what is going wrong. From what I see you have invalid arguments.
I’d recommend to capture as much logs as possible, quite often at this point it is clear enough what went wrong. Also, running chrome in headless depends on the environment, are you running it in docker?
Here is my config:
Depending on the chromedriver version you are using, you should actually be specifying
goog:chromeOptionsinstead ofchromeOptions, but you should be able to drop the--before your args. Theses are for running the drive via the command line. Try something like:Although its working , browser is launching and I am able to set values in field but unable to perform operation (click ).And finally it throws timeout error . When I checked screenshot its shows UI in blurred state and the button I am going to perform an operation is disabled.(Which is not happening when I am running the cases in normal mode )