我有一个打开模式对话框的链接

Selenium 2 如何处理这个问题?

谢谢

艾丹

有帮助吗?

解决方案

使用硒2,我能够选择在一个jquery模态对话框使用正常“findElement”的方法。

元素

e.g。在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();

    }

其他提示

此功能来处理模式对话框尚未运入的webdriver直到最后版本2.0b3(的链接)。 翘首等待的下一个版本将成为公众很快(测试环境:C#, Webdriver 2.0b3 and Nunit)。

我认为这方面存在一些已知问题 http://code.google.com/p/selenium/issues/detail?id=284 但给出了一个可能的解决方案 在这个链接

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