【发布时间】:2016-06-22 04:35:19
【问题描述】:
我目前正在使用以下工具进行验收测试:
- 密码接收
- Selenium 网络驱动程序
- PhantomJS (作为无头浏览器幽灵)
我的问题是访问自签名 (https) 页面时我的测试失败
我尝试过的:
phantomjs --webdriver=5555 --ignore-ssl-errors=true --ssl-protocol=any- 在我的acceptance.suit.yml 中添加
phantomjs.cli.args: ["--ignore-ssl-errors=true"]功能
到目前为止,这些选项并没有给我带来任何运气。
这是我的acceptance.suit.yml 文件
class_name: AcceptanceTester
modules:
enabled:
- WebDriver
config:
WebDriver:
url: https://myproject.com
browser: firefox
capabilities:
unexpectedAlertBehaviour: 'accept'
env:
phantom:
modules:
enabled:
- WebDriver
config:
WebDriver:
url: https://myproject.com
http_proxy: 192.1.1.1
http_proxy_port: 3000
browser: phantomjs
capabilities:
phantomjs.cli.args: ["--ignore-ssl-errors=true"]
更新
这个错误出现[ModuleException] WebDriver: Current url is blank, no page was opened
我不知道为什么会发生这个错误,因为我已经指出了一个页面。这是我的测试样本
public function tryToTestThis(AcceptanceTester $I)
{
$I->wantTo('Test this function');
$I->amOnPage('/mypage/');
$I->see('This text');
}
Codeception 中的答案会更好。谢谢
【问题讨论】:
-
您能否详细说明发生了什么?任何错误,测试如何失败?谢谢。
-
@alecxe 嗨,我更新了我的帖子。它说
[ModuleException] WebDriver: Current url is blank, no page was opened -
我能够复制您的错误并使用 --ignore-ssl-errors=true 运行 phantomjs 使我的测试通过。唯一的区别是我没有使用 http_proxy 和 http_proxy_port,你检查过你的代理吗?
-
@MajicBob 是的,我已经确定我的代理是正确的。我不确定的是,如果它设置
http_proxy代码接收的正确方法没有显示任何设置http_proxy和http_proxy_port的示例 -
@Þaw 是的,那里的文档不是很好,我之前没有将它与代理一起使用。我能想到的唯一其他事情是确保您看到请求进入您的代理并尝试将 2 个设置移动到模块:部分而不是 env。
标签: selenium ssl phantomjs codeception