Selenium 2 でモーダル ダイアログを処理するにはどうすればよいですか

StackOverflow https://stackoverflow.com/questions/4246767

  •  27-09-2019
  •  | 
  •  

質問

モーダルダイアログを開くリンクがあります

Selenium 2 はこれをどのように処理できるのでしょうか。

ありがとう

エイダン

役に立ちましたか?

解決

セレン2で、私はjqueryのモーダルダイアログ通常の「findElement」メソッドを使用します。

の要素を選択することができますよ

例えば。 C#

で次のコード
[Test]
    public void DialogBox()
    {
        var driver = new FirefoxDriver();
        driver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, 20));
        driver.Navigate().GoToUrl("http://example.nemikor.com/basic-usage-of-the-jquery-ui-dialog/");
        // open modal dialog
        driver.FindElement(By.Id("opener")).Click();
        // click a button on the modal dialog.
        driver.FindElementByClassName("ui-icon ui-icon-closethick").Click();

    }

他のヒント

この機能は、(最後のリリースの2.0b3までwebdriverをにまだ出荷されていませんモーダルダイアログを処理するための<のhref =「http://code.google.com/p/selenium/issues/detail?id=284」のrel = "nofollowを">リンクの)。 熱心に公共すぐになるために次のバージョンを待って(テスト環境:C#, Webdriver 2.0b3 and Nunit)。ます。

これに関しては既知の問題がいくつかあると思います http://code.google.com/p/selenium/issues/detail?id=284 しかし、与えられた可能な解決策 このリンクで

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top