我对使用Cucumber进行验收测试感兴趣。有没有办法在Chrome的无头模式下运行它们?
答案 0 :(得分:0)
import webdriver from 'selenium-webdriver'
import test from 'selenium-webdriver/testing'
test.describe('Test', () => {
test.it('with headless chrome.', () => {
const chromeCapabilities = webdriver.Capabilities.chrome();
**chromeCapabilities.set('chromeOptions', {
'args': ['--headless', '--disable-gpu']
});**
driver = new webdriver.Builder()
.usingServer('http://localhost:4444/wd/hub')
**.withCapabilities(chromeCapabilities)**
.build();
driver.get('http://www.google.com/');
driver.quit();
})
})
尝试这些args ['--headless','--disable-gpu']