使用 phantomJs 执行 robotframework 测试

Execute robotframework test with phantomJs

我用 robotframework 开发了我的测试,现在我想把它们放在 CI 中。 在我的 CI plateforme 中,我没有导航器,所以我使用 phantomJs 我的问题是 phantoms 不能打开我的网站,但它给我白页。 我使用此代码打开我的网站

Open Browser    ${myURL}    phantomjs

我做了一些研究,发现 link https://github.com/pa11y/pa11y/issues/90 建议尝试使用 curl 打开网站。 curl returns

的执行
curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.

所以我用命令 phantomjs --ignore-ssl-errors=true --ssl-protocol=any --webdriver=8010 启动了我的 phantomJs,但我仍然遇到同样的问题,请大家帮忙。

我通过命令

启动 phantomJs 解决了我的问题
phantomjs --ignore-ssl-errors=true --ssl-protocol=any --webdriver=8010

并将我的测试更改为

${desired capabilities}=    Evaluate    {'phantomjs.page.settings.userAgent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36'}

Open Browser    ${URL}  phantomjs   main browser    http://localhost:8010   desired_capabilities=${desired capabilities}

我在 http://spage.fi/phantomjs

上找到了回复

希望对大家有所帮助。