我试图获得 硒RC 工作有Firefox3月Linux与PHP/Apache但我遇到的问题。这是我做了什么:

  • 我已经安装的火狐硒-IDE扩展。
  • 上网服务器(这在我的情况下实际上是同一台机器运行的火狐),我已经开始的硒服务器:java-罐子selenium-server.jar -互动
  • 我有一个PHP script如下:

PHP:

require_once 'Testing/Selenium.php';

$browser = new Testing_Selenium("*custom /usr/lib/firefox-3.0.3/firefox", "https://www.example.com");
$browser->start();

当我运行PHP script,它并启动一个新的火狐标签,但是 我得到这个消息错误:

The requested URL /selenium-server/core/RemoteRunner.html was not found on this server.

我已经有更多的成功与Firefox2(通过使用 "*firefox" 而不是的 "*custom" 但不希望使用这对我的当前项目。

有帮助吗?

解决方案

我不知道的礼仪的回答你自己的问题...但具有尝试在试验和错误的方式,这是我如何已经成功地得到硒工作与PHP/Firefox3在Ubuntu。

  1. 我下载RC和复制php客户directory/usr/share/php as'硒'
  2. 我最硒服务目录中的下载,和开始与硒 java -jar selenium-server.jar
  3. 我创造了一个新的火狐简介(由运行火狐-ProfileManager).我所谓的新概'硒'
  4. 在这一档案,我编辑的火狐网络的喜好来代理的所有协议通过localhost port4444.
  5. 我创造了我php script跑了它与这个命令:

    php -d include_path=".:/usr/share/php:/usr/share/php/Selenium/PEAR" test.php

我已经列出了我的(基本、不进行非OO)第一个测试下脚本,供参考。

require_once 'Testing/Selenium.php';

$oSelenium = new Testing_Selenium(
    "*custom /usr/lib/firefox-3.0.3/firefox -P Selenium",
    "https://www.example.com");
$oSelenium->start();

$oSelenium->open("/");

if (!$oSelenium->isElementPresent("id=login_button")) {
        $oSelenium->click("logout");
        $oSelenium->waitForPageToLoad(10000);
        if (!$oSelenium->isElementPresent("id=login_button")) {
                echo "Failed to log out\n\n";
                exit;
        }
}

$oSelenium->type("login", "my_username");
$oSelenium->type("password", "my_password");
$oSelenium->click("login_button");
$oSelenium->waitForPageToLoad(10000);

$oSelenium->click("top_nav_campaigns");

$oSelenium->stop();

其他提示

我的使用进行,硒RC php api我的测试用例.我的测试用例看起来像



1235$Deepan@Newton~/selenium/ide_scripts$
cat mytest.php
 'FF on linux',
      'browser' => '*firefox',
      'host'    => '10.211.55.8',
      'port'    => 4444,
      'timeout' => 30000,
    ),
    array(
      'name'    => 'FF on windows',
      'browser' => '*firefox',
      'host'    => '10.211.55.5',
      'port'    => 4444,
      'timeout' => 30000,
    ),
     */
    array(
      'name'    => 'Google Chrome on windows',
      'browser' => '*googlechrome',
      'host'    => '10.211.55.5',
      'port'    => 4444,
      'timeout' => 30000,
    ),
    /*
    array(
      'name'    => 'IE on windows',
      'browser' => '*iexplore',
      'host'    => '10.211.55.5',
      'port'    => 4444,
      'timeout' => 30000,
    ),
    array(
      'name'    => 'Safari on MacOS X',
      'browser' => '*safari',
      'host'    => 'localhost',
      'port'    => 4444,
      'timeout' => 30000,
    ),
    array(
      'name'    => 'Firefox on MacOS X',
      'browser' => '*chrome',
      'host'    => 'localhost',
      'port'    => 4444,
      'timeout' => 30000,
    ),
     */
    array(
      'name'    => 'Google Chrome on MacOS X',
      'browser' => '*googlechrome',
      'host'    => 'localhost',
      'port'    => 4444,
      'timeout' => 30000,
    )
  );

  protected function setUp()
  {
    //$this->setBrowser("*chrome");
    $this->setBrowserUrl("http://www.facebook.com/");
  }

  public function testMyTestCase()
  {
    $this->open("/index.php?lh=94730c649368393b6954cb9fc0802e0a&eu=iKjrC7Q2aC-8tcU7PVLilg");
    $this->type("email", "myemail@domain.com");
    $this->type("pass", "mypassword");
    $this->click("persistent");
    $this->click("//input[@type='submit']");
    $this->waitForPageToLoad("30000");
    sleep(10);
    $this->open("http://apps.facebook.com/myapp/");
    sleep(4);
    $this->click("link=Play");
    $this->waitForPageToLoad("30000");
    sleep(4);
    $this->click("navAccountLink");
    sleep(4);
    $this->click("link=Logout");
    $this->waitForPageToLoad("30000");
    sleep(4);
  }
}
?>
1332$Deepan@Newton~/selenium/ide_scripts$
phpunit mytest.php

这将连接到浏览器上运行的内部虚拟机

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top