This entire post is also available here in php formatting:
http://textuploader.com/?p=6&id=QROrr
Hardware and Software:
I am running Selenium RC on a 32 bit Windows 7 machine.
I have installed:
- php-5.2.17-nts-Win32-VC6-x86.msi
- PHPUnit-3.5.14.tgz
- jdk-7-windows-i586.exe
- PEAR
Problem:
When trying to run my test case with 4 browsers (FF36,FF40,IE8,Chrome)
two of the browsers fail with different errors.
- In IE8 and IE9, the browser opens up but the remote control is never
initiated. The window pops up but is stuck at about:blank.
- In Chrome, the remote control is launched but no tests are
performed.
Can you please advise what I should do in this situation. Should I
perhaps try to do the exact same setup on a different machine or under
a
different OS? Is this behavior common? Any insights to how I should
solve this, or work around it, would be greatly appreciated! I am all
out of
ideas here.
1. Server is started with:
java -jar C:\SELENIUM\Server\selenium-server-standalone-2.4.0.jar -
trustALLSSLCertificates
Tests are started with
phpunit TEST.PHP
2. Tests are written in PHP and are very simple.
SETUP_SELENIUMTEST.PHP
<?php
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
abstract class Setup_SeleniumTest extends
PHPUnit_Extensions_SeleniumTestCase
{
public static $browsers = array(
array(
'name' => 'Firefox 3.6.17 on Windows 7',
'browser' => '*chrome C:\SELENIUM\Browsers
\Firefox36\firefox.exe',
),
array(
'name' => 'Firefox 4.0 on Windows 7',
'browser' => '*chrome C:\SELENIUM\Browsers
\Firefox40\firefox.exe',
),
array(
'name' => 'Google Chrome on Windows 7',
'browser' => '*googlechrome C:\Users\testadmin\AppData\Local
\Google\Chrome\Application\chrome.exe',
),
array(
'name' => 'IE9 on Windows 7',
'browser' => '*iexplore C:\Program Files\Internet Explorer
\iexplore.exe',
)
);
protected function setUp()
{
$this->setPort(4444);
$this->setTimeout(45);
$this->setHost("localhost");
$this->setBrowserUrl("
http://www.testsite.se");
}
protected function tearDown()
{
parent::tearDown();
}
}
?>
TEST.PHP
<?php
require_once 'Setup_SeleniumTest.php';
class sslTest2 extends Setup_SeleniumTest
{
public function testMyTestCase3()
{
$this->open("
www.google.se");
$this->waitForPageToLoad("30000");
}
}
?>
3. And this is what I get from the output
C:\SELENIUM>phpunit c:\SELENIUM\Tests\basic\bTest.php
PHPUnit 3.5.14 by Sebastian Bergmann.
..EE
Time: 01:41, Memory: 3.25Mb
There were 2 errors:
1) sslTest2::testMyTestCase3
PHPUnit_Framework_Exception: Response from Selenium RC server for
testComplete(). <-- Chrome Error
Cannot call method 'indexOf' of undefined.
C:\SELENIUM\Tests\basic\bTest.php:13
C:\SELENIUM\Tests\basic\bTest.php:13
2) sslTest2::testMyTestCase3
PHPUnit_Framework_Exception: Could not connect to the Selenium RC
server. <-- IE Error
FAILURES!
Tests: 4, Assertions: 0, Errors: 2.
And the Server looks like this:
C:\SELENIUM>java -jar C:\SELENIUM\Server\selenium-server-
standalone-2.4.0.jar -trustALLSSLCertificates
aug 23, 2011 11:06:35 FM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
11:06:35.760 INFO - Java: Oracle Corporation 21.0-b17
11:06:35.762 INFO - OS: Windows 7 6.1 x86
11:06:35.766 INFO - v2.4.0, with Core v2.4.0. Built from revision
13337
11:06:35.878 INFO - RemoteWebDriver instances should connect to:
http://127.0.0.1:4444/wd/hub
11:06:35.879 INFO - Version Jetty/5.1.x
11:06:35.880 INFO - Started HttpContext[/selenium-server/driver,/
selenium-server/driver]
11:06:35.881 INFO - Started HttpContext[/selenium-server,/selenium-
server]
11:06:35.881 INFO - Started HttpContext[/,/]
11:06:35.900 INFO - Started
org.openqa.jetty.jetty.servlet.ServletHandler@13cca0e
11:06:35.900 INFO - Started HttpContext[/wd,/wd]
11:06:35.903 INFO - Started SocketListener on
0.0.0.0:4444
11:06:35.904 INFO - Started org.openqa.jetty.jetty.Server@515263
11:07:03.441 INFO - Checking Resource aliases
11:07:03.443 INFO - Command request: getNewBrowserSession[*chrome C:
\SELENIUM\Browsers\Firefox36\firefox.exe,
http://www.testsite.se] on
session
null
11:07:03.445 INFO - creating new remote session
11:07:03.455 INFO - Allocated session 418d05ece30549ef8d845e3fd198ed13
for
http://www.testsite.se, launching...
11:07:03.514 INFO - Preparing Firefox profile...
11:07:05.413 INFO - Launching Firefox...
11:07:07.253 INFO - Got result: OK,418d05ece30549ef8d845e3fd198ed13 on
session 418d05ece30549ef8d845e3fd198ed13
11:07:07.266 INFO - Command request: setTimeout[45000, ] on session
418d05ece30549ef8d845e3fd198ed13
11:07:07.281 INFO - Got result: OK on session
418d05ece30549ef8d845e3fd198ed13
11:07:07.287 INFO - Command request: open[
www.google.se, ] on session
418d05ece30549ef8d845e3fd198ed13
11:07:08.021 INFO - Got result: OK on session
418d05ece30549ef8d845e3fd198ed13
11:07:08.028 INFO - Command request: waitForPageToLoad[30000, ] on
session 418d05ece30549ef8d845e3fd198ed13
11:07:08.043 INFO - Got result: OK on session
418d05ece30549ef8d845e3fd198ed13
11:07:08.048 INFO - Command request: testComplete[, ] on session
418d05ece30549ef8d845e3fd198ed13
11:07:08.049 INFO - Killing Firefox...
11:07:08.083 INFO - Got result: OK on session
418d05ece30549ef8d845e3fd198ed13
11:07:08.097 INFO - Command request: getNewBrowserSession[*chrome C:
\SELENIUM\Browsers\Firefox40\firefox.exe,
http://www.testsite.se] on
session
null
11:07:08.097 INFO - creating new remote session
11:07:08.099 INFO - Allocated session 720777e205904cfe95a40a2b8343d801
for
http://www.testsite.se, launching...
11:07:08.128 INFO - Preparing Firefox profile...
11:07:10.083 INFO - Launching Firefox...
11:07:12.175 INFO - Got result: OK,720777e205904cfe95a40a2b8343d801 on
session 720777e205904cfe95a40a2b8343d801
11:07:12.179 INFO - Command request: setTimeout[45000, ] on session
720777e205904cfe95a40a2b8343d801
11:07:12.201 INFO - Got result: OK on session
720777e205904cfe95a40a2b8343d801
11:07:12.205 INFO - Command request: open[
www.google.se, ] on session
720777e205904cfe95a40a2b8343d801
11:07:12.976 INFO - Got result: OK on session
720777e205904cfe95a40a2b8343d801
11:07:12.980 INFO - Command request: waitForPageToLoad[30000, ] on
session 720777e205904cfe95a40a2b8343d801
11:07:12.984 INFO - Got result: OK on session
720777e205904cfe95a40a2b8343d801
11:07:12.987 INFO - Command request: testComplete[, ] on session
720777e205904cfe95a40a2b8343d801
11:07:12.989 INFO - Killing Firefox...
11:07:13.038 INFO - Got result: OK on session
720777e205904cfe95a40a2b8343d801
11:07:13.051 INFO - Command request:
getNewBrowserSession[*googlechrome C:\Users\testadmin\AppData\Local
\Google\Chrome\Application\chrome.exe,
http://www.testsite.se] on session null
11:07:13.052 INFO - creating new remote session
11:07:13.056 INFO - Allocated session 7b952324b01c49a19e6b9bb62d10d152
for
http://www.testsite.se, launching...
11:07:13.057 INFO - Launching Google Chrome...
11:07:14.499 INFO - Got result: OK,7b952324b01c49a19e6b9bb62d10d152 on
session 7b952324b01c49a19e6b9bb62d10d152
11:07:14.510 INFO - Command request: setTimeout[45000, ] on session
7b952324b01c49a19e6b9bb62d10d152
11:07:14.515 INFO - Got result: OK on session
7b952324b01c49a19e6b9bb62d10d152
11:07:14.528 INFO - Command request: open[
www.google.se, ] on session
7b952324b01c49a19e6b9bb62d10d152
11:07:14.909 INFO - Got result: Cannot call method 'indexOf' of
undefined on session 7b952324b01c49a19e6b9bb62d10d152
11:07:14.912 INFO - Command request: testComplete[, ] on session
7b952324b01c49a19e6b9bb62d10d152
11:07:14.913 INFO - Killing Google Chrome...
11:07:14.950 INFO - Got result: OK on session
7b952324b01c49a19e6b9bb62d10d152
11:07:14.966 INFO - Command request: getNewBrowserSession[*iexplore C:
\Program Files\Internet Explorer\iexplore.exe,
http://www.testsite.se]
on
session null
11:07:14.966 INFO - creating new remote session
11:07:14.969 INFO - Allocated session 55c55165c5a6417d801f0940e1888a60
for
http://www.testsite.se, launching...
11:07:15.038 INFO - Launching Embedded Internet Explorer...
11:07:15.041 INFO - Launching Internet Explorer HTA...
-end-