I add in acceptance.suite.yml
chromeOptions:
args: ["--headless", "--disable-gpu","--test-type","--ignore-certificate-errors"],
但是没有运气?我现在能做什么
描述编辑:
当我以无头模式启动测试时,它们会卡住,在_output文件中(失败.png(,我得到空白页。所以我认为他们到达"不安全连接"页面并且无法通过它,我的问题是如何避免该页面
我怀疑你想要的论点是allow-insecure-localhost
.这一行对我在CodeCeption中配置我的acceptance.suite.yml
文件有用。
- WebDriver:
url: xxx.com
window_size: false # disabled in ChromeDriver
port: 9515
browser: chrome
capabilities:
goog:chromeOptions:
args: ["allow-insecure-localhost","headless","start-maximized"]
此页面列出了 chrome 支持 https://peter.sh/experiments/chromium-command-line-switches/#allow-insecure-localhost 的所有选项。谷歌自己从他们自己的页面链接到该(第三方(页面,描述ChromeDriver配置 https://sites.google.com/a/chromium.org/chromedriver/capabilities。
不确定这是否已经回答,但根据codeception文档 https://codeception.com/docs/modules/WebDriver
modules:
enabled:
- WebDriver:
config:
url: 'http://localhost/'
browser: chrome
capabilities:
acceptInsecureCerts: true
这对我有用,
ChromeOptions options = (ChromeOptions) caps.getCapability(ChromeOptions.CAPABILITY);
options.addArguments("--headless", "--disable-gpu", "--window-size=1366,768", "--no-sandbox");
caps.setAcceptInsecureCerts(true);
请尝试以下代码。
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--no-sandbox");
options.addArguments("--headless", "--window-size=1920,1200", "--ignore-certificate-errors");
options.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
options.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);
driver = new ChromeDriver(options);