下载了 InternetExplorerDriver,但我不知道如何在 php 测试中启动它。我正在使用https://github.com/chibimagic/WebDriver-PHP/
3 回答
从站点https://code.google.com/p/selenium/downloads/list下载 selenium-server-standalone-2.31.0.jar
从站点https://code.google.com/p/selenium/downloads/list下载 IEDriverServer_Win32_2.31.0.zip ,然后解压缩
将两个下载的文件添加到一个目录中,并将此目录添加到系统变量路径
将 C:\Program Files\Internet Explorer 添加到系统变量路径中
打开命令提示符类型
java -jar -Dwebdriver.ie.driver=IEDriverServer.exe selenium-server-standalone-2.31.0.jar
返回到您的 webdriver 设置并将“firefox”更改为“internet explorer”
然后就可以在ie中开始测试了,但是别忘了把ie的默认缩放比例从125%改成100%。
不要传递“firefox”,而是传递“internet explorer”:
$this->setBrowser('internet explorer');
用法
请参阅包含的 SampleTest.php。启动 Selenium 2 独立服务器 (http://code.google.com/p/selenium/downloads/list) 并运行测试:
phpunit SampleTest.php
确保 phpunit 在你的路径中!
测试
什么是没有测试的代码?运行测试:
phpunit WebDriverSelectorTest.php
phpunit WebDriverXPathTest.php
phpunit WebDriverColorTest.php