单击按钮时出现HTTP超时错误

时间:2018-05-31 12:30:58

标签: javascript selenium webdriver

我尝试点击具有属性的按钮:

href = javascript:window.print()

因此,当我尝试点击它时,会有一个包含打印预览数据的页面(据我所知' javascript:window.print()'导致打印窗口)

据我了解'点击()' IWebElement(OpenQA.Selenium)等待页面加载或其他东西,然后自动化测试关闭

  

http请求超时了webdriver异常

enter image description here

我尝试使用点击OpenQA.Selenium.Interactions // IwebElement Click()//和javascript click()有相同的结果,http请求超时错误

element attribute: <button class='className' href = 'javascript:window.print()' /button>

我尝试了:

element = driver.findElement(By.Class('className'));

(1)第一个案例:

element.Click(); // as IWebDriver standart method

(2)第二种情况:

 Actions action = new Actions(driver);
    action.MoveToElement(element).Click().Perform();

和第三种情况: (3)

Browser.ExecuteJavaScript("(document.getElementByClassName('className'))[0].click();")

0 个答案:

没有答案