我正在使用空手道框架进行UI自动化。空手道框架是否支持无头浏览器测试。
答案 0 :(得分:1)
我们还可以使用chromedriver或geckodriver来实现chrome和Firefox的无头工作。但是请记住,这些需要与浏览器版本保持一致。不建议使用CI / CD。但是,如果我们需要在本地进行测试,则可以使用。这是我在karate-config.js(可全局使用)中的配置:
Chromedriver:
karate.configure('driver', {type: 'chromedriver', executable: '#(driverpath)' , webDriverSession: { desiredCapabilities: { browserName: 'chrome' , "goog:chromeOptions": { headless: true } } } } );
Firefox(壁虎驱动程序)
karate.configure('driver', {type: 'geckodriver', executable: '#(driverpath)', showDriverLog: true, webDriverSession: { "capabilities": { "alwaysMatch": { "moz:firefoxOptions": { args: ["-headless"] } } } } } );
答案 1 :(得分:0)
是的,如果您使用驱动程序类型chrome
或Docker容器:https://github.com/intuit/karate/tree/master/karate-core#dockertarget
* configure driver = { type: 'chrome', headless: true }