开发者

How to use Firefox on Win from Selenium-rc on Linux

I am using phpunit 3.4.15.

On Centos 5.3 linux I started Selenium server 1.0.3: java -jar selenium-server.jar

I would like to call a browser running on Windows to run the test.

This is the script I try to run:

<?php

require_once 'PHPUnit/Extensions/SeleniumTestCase.php';

class Example extends PHPUnit_Extensions_SeleniumTestCase
{
  function setUp()
  {
    $this->setHost("win_ip_address");
    $this->setPort(4444);
    $this->setBrowser("*firefox");
    $this->setBrowserUrl("http://www.google.com/");
  }

  function testMyTestCase()
  {
    $this->open("/");
    $this->type("q",开发者_运维知识库 "selenium rc");
    $this->click("btnG");
    $this->waitForPageToLoad("30000");
    $this->assertTrue($this->isTextPresent("Results * for selenium rc"));
  }
}
?>

The script is run on the same linux machine: phpunit unittest, and when it finishes it states, "PHPUnit_Framework_Exception: Could not connect to the Selenium RC server." Does SetHost need to be set to the selenium server? If so, how do I tell it to call firefox on windows from a different machine? Thanks.


Selenium RC needs to run on the machine that has the browser you wish to test with. Your tests can be run from any machine as long as it can see the machine that has the Selenium RC running on it.

You can simplify your Selenium Infrastructure by using Selenium Grid with the Hub on your machine that then routes the commands to the Windows SeRC

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜