문제

I have a link that opens a modal dialog

How can Selenium 2 handle this.

Thanks

Aidan

도움이 되었습니까?

해결책

With selenium 2 , I'm able to select elements in a jquery modal dialog using the normal "findElement" method.

e.g. the following code in 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();

    }

다른 팁

This feature to handle modal dialog is not shipped yet into webdriver until the last release 2.0b3 (link). Eagerly waiting for the next version to become public soon.(Test Environment: C#, Webdriver 2.0b3 and Nunit).

I think there are some known issues on this http://code.google.com/p/selenium/issues/detail?id=284 but a possible solution given at this link

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top