我真的很陌生,所以对我来说很简单。我有Seleneium与Pear,PHPUnit和Sauce Labs类SauceOnDemandTestCase.php一起工作。我可以运行测试,并做了一个简单的就好了。但是现在我正在做更复杂的测试并且不断收到超时消息。我查看了StackO上的错误,其他人也在使用IE。现在我的测试使用Firefox,所以我不知道为什么会这样。其他职位是在这里:硒RC/PHPUnit测试总是超时?
PHPUnit_Framework_Exception: Could not connect to the Selenium RC server when I run with Hudson
我试图改变我的等待功能waitForElement或waitForVisible但无济于事,它仍然无法与一个错误。这是我的XML日志文件输出,如果这对你有用:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="ExampleTest" file="C:\websites\saucelabs\ExampleTest.php" tests="1" assertions="0" failures="0" errors="1" time="44.717224">
<testsuite name="ExampleTest: Testing Selenium 1 in PHP at Sauce (FF 7)" tests="1" assertions="0" failures="0" errors="1" time="44.717224">
<testcase name="test_example" class="ExampleTest" file="C:\websites\saucelabs\ExampleTest.php" line="23" assertions="0" time="44.717224">
<error type="PHPUnit_Framework_Exception">ExampleTest::test_example with browser firefox 7 Windows 2003
PHPUnit_Framework_Exception:
Response from Selenium RC server for open(/Home).
Timed out after 30000ms.
Current Browser URL: http://www.vehicleportal.co.uk/Home
Sauce Labs Job: https://saucelabs.com/jobs/8b202faaa055e213233637610fcd4448
</error>
</testcase>
</testsuite>
</testsuite>
</testsuites>
我的脚本类如下所示:
<?php
date_default_timezone_set('Europe/London');
require_once 'PHPUnit/Extensions/SeleniumTestCase/SauceOnDemandTestCase.php';
require_once 'Log.php';
class ExampleTest extends PHPUnit_Extensions_SeleniumTestCase_SauceOnDemandTestCase {
public static $browsers = array(
array(
'name' => 'Testing Selenium 1 in PHP at Sauce (FF 7)',
'browser' => 'firefox',
'os' => 'Windows 2003',
'browserVersion' => '7',
)
);
function setUp() {
$this->setBrowserUrl('http://www.vehicleportal.co.uk');
}
function test_example() {
//$this->open('/');
//$this->assertTitle('Cross browser testing with Selenium - Sauce Labs');
//$file = Log::factory('file', 'out.log', 'TEST');
//$file->log("info");
$this->open("/Home");
$this->click("hlLogin1");
$this->waitForVisible('h1');
$this->type("txtLoginEmailAddress", "[email protected]");
$this->type("txtLoginPassword", "password");
$this->click("btnLogin");
$this->waitForVisible('h1');
$this->verifyText("id=hlVehicleLookup", "Vehicle Lookup");
$this->click("css=img[alt=Home]");
$this->waitForVisible('h1');
$this->click("link=Logout");
$this->waitForVisible('h1');
}
}
给予一定的背景我要创建我的硒IDE或SauceLabs建设者脚本然后转换它,以便从Selenium IDE中获取步骤。
我有第二个小问题,我希望更好地理解。我不断收到:
“通知:未定义指数:家在C:\ PHP \ PEAR \ PHPUnit的\扩展\ SeleniumTestCase \ SauceOnDemandTestCase.php线149”
149从该文件专线: $ yml_path = realpath($ _ SERVER ['HOME'])。 '/.sauce/ondemand.yml';
我可以删除提及这一点,但为什么会出现?毕竟$ _SERVER ['home']不是$ _SERVER数组的PHP。
UPDATE
我们有一个理论超时被SL没有使用真正的浏览器造成的。我完全删除了所有验证步骤,但仍然发生超时。
请包括您的文章摘录给你的答案一些上下文。 – BoltClock