Þaw*_*Þaw 7 ssl selenium phantomjs codeception
我目前正在使用以下工具进行验收测试:
我的问题是访问自签名(https)页面时我的测试失败
我尝试过的:
phantomjs --webdriver=5555 --ignore-ssl-errors=true --ssl-protocol=any
phantomjs.cli.args: ["--ignore-ssl-errors=true"]在我的acceptance.suit.yml中添加这个功能到目前为止,这些选项并没有给我任何运气.
这是我的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"]
Run Code Online (Sandbox Code Playgroud)
UPDATE
出现此错误 [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');
}
Run Code Online (Sandbox Code Playgroud)
Codeception中的答案更可取.谢谢
我们找出了这个问题的原因。这是因为我同时在Selenium跑步phantomJS。(我从一些教程中得到了这个想法。)
我在做
java -jar selenium.jar
Run Code Online (Sandbox Code Playgroud)
然后我这样做,因为它会导致在端口 4444 运行 phantomjs 时出错(显然 selenium 正在使用它),我改为使用端口 5555。
phantomjs --webdriver=5555 --ignore-ssl-errors=true --ssl-protocol=any
Run Code Online (Sandbox Code Playgroud)
注意:如果不涉及 https / ssl 自签名页面,一切正常。
我们认为codeception优先考虑端口 4444 并忽略我的 phantomjs 中指示的任何选项,即--ignore-ssl-errors=true --ssl-protocol=any这就是无法访问 https/自签名页面的原因。
所以基本上,修复方法只是单独运行 phantomjs,而不使用 selenium。
phantomjs --webdriver=4444 --ignore-ssl-errors=true --ssl-protocol=any
Run Code Online (Sandbox Code Playgroud)
谢谢
| 归档时间: |
|
| 查看次数: |
688 次 |
| 最近记录: |