执行UI测试时,我收到一个错误,即selenium不支持chromedriver的自动窗口大小调整,这导致测试失败.
有没有办法使用chrome-options设置headless-chrome
?
我试过以下,
ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized");
Run Code Online (Sandbox Code Playgroud)
此外,更换"--start-maximized"
有"--start-fullscreen"
和"--kiosk"
.
但以上都没有对我有用,对我有用的唯一选择是"--window-size=width,height"
.
我不想硬编码宽度和高度的值,有什么办法可以设置全屏吗?
java google-chrome selenium-webdriver google-chrome-headless
我正在尝试无头运行我的测试,并将我的两个测试套件分片以并行运行它们。在我的本地计算机上,它们并行运行,但在这种无头设置中,它们一个接一个地运行。我正在使用 Docker 映像作为 Web 驱动程序和量角器。
我正在使用 webnicer-protractor Docker 映像:https://hub.docker.com/r/webnicer/protractor-headless/ 并使用 elgalu/selenium 作为 Web 驱动程序。
我运行的conf.js文件如下所示:
exports.config = {
//Headless
//seleniumAddress: 'http://localhost:4444/wd/hub',
seleniumAddress: 'http://localhost:24444/wd/hub',
capabilities: {
browserName: 'chrome',
shardTestFiles: true,
maxInstances: 2
},
specs: ['Suites/AccountSettingsSuite.js', 'Suites/CloneDashboardSuite.js']
}
Run Code Online (Sandbox Code Playgroud)