gpt4 book ai didi

selenium - 针对自签名 SSL 站点运行 Codeception 验收测试

转载 作者:太空宇宙 更新时间:2023-11-03 14:49:44 27 4
gpt4 key购买 nike

我有一个带有 letsencrypt ssl 证书的网站。当我针对它运行代码接收验收测试时,测试会停止,直到我按下 ctrl+z。当我对非 ssl 站点运行相同的测试时,没有问题。

这是我在 acceptance.suite.yml 中的设置。 phantomjs.cli.args 参数来自此站点:http://szdredd.blogspot.de/2013/10/codeception-phantomjs-setup-for.html

class_name: AcceptanceTester
modules:
enabled: [WebDriver]
config:
WebDriver:
url: https://www.domain.de/
browser: phantomjs

我的 selenium 日志如下所示:

17:07:15.681 INFO - Executing: [new session: Capabilities [{browserName=phantomjs}]])
17:07:15.682 INFO - Creating a new session for Capabilities [{browserName=phantomjs}]
17:07:15.682 INFO - executable: /usr/bin/phantomjs
17:07:15.683 INFO - port: 27757
17:07:15.683 INFO - arguments: [--webdriver=27757, --webdriver-logfile=/phantomjsdriver.log]
17:07:15.683 INFO - environment: {}
PhantomJS is launching GhostDriver...
[INFO - 2016-02-20T17:07:15.754Z] GhostDriver - Main - running on port 27757
[INFO - 2016-02-20T17:07:15.765Z] Session [64316920-d7f4-11e5-a0c5-8954be0ea076] - CONSTRUCTOR - Desired Capabilities: {"browserName":"phantomjs"}
[INFO - 2016-02-20T17:07:15.765Z] Session [64316920-d7f4-11e5-a0c5-8954be0ea076] - CONSTRUCTOR - Negotiated Capabilities: {"browserName":"phantomjs","version":"1.9.0","driverName":"ghostdriver","driverVersion":"1.0.3","platform":"linux-unknown-64bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}}
[INFO - 2016-02-20T17:07:15.765Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 64316920-d7f4-11e5-a0c5-8954be0ea076
17:07:15.771 INFO - Done: [new session: Capabilities [{browserName=phantomjs}]]
17:07:15.774 INFO - Executing: [implicitly wait: 0])
17:07:15.777 INFO - Done: [implicitly wait: 0]
17:07:15.790 INFO - Executing: [get: https://www.waldhelden.de/])
[INFO - 2016-02-20T17:07:33.916Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
[INFO - 2016-02-20T17:08:55.442Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW

[INFO - 2016-02-20T17:09:02.008Z] SessionManagerReqHand - _cleanupWindowlessSessions - 异步 session 清理阶段现在开始 17:09:13.204 信息 - session 7c5ef02c-9361-49c8-894d-234989179189 由于客户端超时而被删除 [INFO - 2016-02-20T17:09:13.211Z] ShutdownReqHand - _handle - 即将关闭

我在这边找到了一个建议,但是当我添加那个配置时我出错了:

capabilities:
phantomjs.cli.args: ['--ignore-ssl-errors=true']

Caused by: org.openqa.selenium.WebDriverException: The best matching driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver can't create a new driver instance for Capabilities [{phantomjs.cli.args=[--ignore-ssl-errors=true], browserName=phantom}]

谁知道如何设置 codeception 来忽略 ssl 错误?任何帮助表示赞赏!

谢谢乌多

最佳答案

为了测试我的网站,我使用 Phantoman 自动运行和关闭 phantomJS。在 codeception.yml 我有:

config:
Codeception\Extension\Phantoman:
path: 'vendor/bin/phantomjs'
port: 4444
debug: true
ignoreSslErrors: true
sslProtocol: any
Codeception\Extension\Recorder:
delete_successful: true

关于selenium - 针对自签名 SSL 站点运行 Codeception 验收测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35526449/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com