0

ページにログインしてテストを実行する古いバージョンの自動化スクリプトを使用しています。

より複雑なテストを行うために、従来のセレン コンストラクターを WebDriverBackedSelenium コンストラクターに変更したいと考えています。

元のコンストラクター呼び出しは次のとおりです。

selenium = new DefaultSelenium("localhost", 4444, "*firefox", "https://asdffdsa.com/");

WebDriverBackedSelenium コンストラクターに同じパラメーターを設定するにはどうすればよいですか? API は、コンストラクターを次のように設定する必要があることを示しています。

seWebDriver = new WebDriverBackedSelenium(driver, "https://asdffdsa.com");

セレンサーバーが実行されている場所、ポート、ブラウザーについての兆候はないようです。

現在、次のコードを使用しています。

driver = new FirefoxDriver();
    seWebDriver = new WebDriverBackedSelenium(driver, "https://www.asdfdfdfsfs.com");

    seWebDriver.open("/");

次のエラーが発生していることに今気づきました。

原因: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox コンソール出力: * ログ addons.manager: アプリケーションがアップグレードされました LOG addons.xpi: 起動 ログ addons.xpi: 利用できないインストール場所 app-system-share をスキップしています addons.xpi のログ: 名前が有効なアドオン ID ではないファイル エントリを無視します: /var/folders/pf/hvzyf38x59vfbgf8zpvw5v800000gn/T/anonymous2501560210712840923webdriver-profile/extensions/webdriver-staging addons.xpi のログ: checkForChanges LOG addons.xpi-utils: データベースを開いています LOG addons.xpi-utils: データベース スキーマの作成 LOG addons.xpi: app-profile にインストールされた新しいアドオン fxdriver@googlecode.com Blocklist::_loadBlocklistFromFile: ブロックリストは無効です LOG addons.xpi: 新しいアドオン {972ce4c6-7e08-4474-a285-3208198ce6fd} が app-global にインストールされました LOG addons.xpi: インストールされたアドオンへの変更でデータベースを更新しています LOG addons.xpi-utils: アドオンの状態を更新しています LOG addons.xpi-utils: アドオン リストの書き込み addons.manager のログ: シャットダウン addons.xpi のログ: シャットダウン addons.xpi-utils のログ: シャットダウン LOG addons.xpi-utils: データベースが閉じられました LOG addons.xpi: 起動 ログ addons.xpi: 利用できないインストール場所 app-system-share をスキップしています addons.xpi のログ: 名前が有効なアドオン ID ではないファイル エントリを無視します: /var/folders/pf/hvzyf38x59vfbgf8zpvw5v800000gn/T/anonymous2501560210712840923webdriver-profile/extensions/webdriver-staging addons.xpi のログ: checkForChanges * addons.xpi のログ: 変更が見つかりませんでした

4

2 に答える 2

1

これは、Webdriver でサポートされたセレンを使用する例です。

Webdriverbacked Selenium を使用している間は、ポート番号を指定する必要はありません。

以下のプログラムでは、オブジェクトSeleniumは Selenium RC (古いオートメーション スクリプト コンストラクター) のプロパティを利用するためのものです。

driver Webdriver(Selenium2.0)の機能を利用するためのオブジェクトです。

public class BackedWebdriver {

    public static WebDriver driver;
    public static String baseUrl;
    public static Selenium selenium;

    public static void main(String[] args) {
        driver = new FirefoxDriver();    //Here we are mentioning that we will use Firefox browser
        baseUrl = "http://www.google.co.in/";
        driver.get(baseUrl);
        selenium = new WebDriverBackedSelenium(driver, baseUrl);
        selenium.windowMaximize();
        driver.findElement(By.id("gbqfq")).clear();
        driver.findElement(By.id("gbqfq")).sendKeys("selenium");
        selenium.click("g");
        driver.findElement(By.id("gbqfb")).click();


    }
于 2013-03-06T17:37:43.093 に答える
0
DesiredCapabilities ffLinux = DesiredCapabilities.firefox();
ffLinux.setBrowserName("firefox");
ffLinux.setPlatform(Platform.LINUX);
String hubLocation = http://yourmachine.com:4444/wd/hub;
WebDriver driver = new RemoteWebDriver(hubLocation, ffLinux);
driver.get(yourWebApplicationURLThatsBeingTested);

上記の WebDriverBackedSelenium の例では、最初に渡したパラメーターは "driver" でした。上記の WebDriver のセットアップ方法を見てください。ハブの場所が指定されています。

于 2013-03-06T19:03:26.963 に答える