I am using karate framework for UI Automation. Does Karate framework supports headless browser testing.
Asked
Active
Viewed 2,308 times
2 Answers
2
Yes if you use the driver type chrome
or the Docker container: https://github.com/intuit/karate/tree/master/karate-core#dockertarget
* configure driver = { type: 'chrome', headless: true }

Peter Thomas
- 54,465
- 21
- 84
- 248
2
We can also use chromedriver or geckodriver to get headless working for chrome and firefox. But bear in mind, these need to be consistent with the browser version. Not advisable for CI/CD. But works if we need to test locally. Here was my config in karate-config.js(to use globally):
Chromedriver:
karate.configure('driver', {type: 'chromedriver', executable: '#(driverpath)' , webDriverSession: { desiredCapabilities: { browserName: 'chrome' , "goog:chromeOptions": { headless: true } } } } );
Firefox(geckodriver)
karate.configure('driver', {type: 'geckodriver', executable: '#(driverpath)', showDriverLog: true, webDriverSession: { "capabilities": { "alwaysMatch": { "moz:firefoxOptions": { args: ["-headless"] } } } } } );

Mihir
- 491
- 5
- 21
-
what should we can do in case we are trying to run a test case on Jenkins – Pulkit Agrawal Apr 19 '22 at 09:58