Selenium中的Ajax弹出窗口

Selenium中的Ajax弹出窗口,ajax,testing,selenium,selenium-ide,Ajax,Testing,Selenium,Selenium Ide,是否有任何方法可以使用Ajax捕获/记录Light Box(Ajax) 硒化物 ?不确定Selenium IDE捕获/记录灯箱(Ajax)是否符合您期望的格式。 看 Selenium IDE能够捕获导致LightBox出现的点击的事实。但很难记录从服务器获取所有AJAX所需的时间。 作为QA selenium自动化(在java上编写)的一员,我更喜欢另一种方法。 您可以在以下条件下使用webDriverWait: WebDriverWait wait = new WebDriverWait(

是否有任何方法可以使用Ajax捕获/记录Light Box(Ajax)

硒化物


不确定Selenium IDE捕获/记录灯箱(Ajax)是否符合您期望的格式。 看

Selenium IDE能够捕获导致LightBox出现的点击的事实。但很难记录从服务器获取所有AJAX所需的时间。 作为QA selenium自动化(在java上编写)的一员,我更喜欢另一种方法。 您可以在以下条件下使用webDriverWait:

  WebDriverWait wait = new WebDriverWait(yourWebDriver, 5);
    wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//xpath_to_element")));
如上所述

或者您可以调用
fluentWait
机制:

public WebElement fluentWait(final By locator){
        Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)
                .withTimeout(30, TimeUnit.SECONDS)
                .pollingEvery(5, TimeUnit.SECONDS)
                .ignoring(NoSuchElementException.class);

        WebElement foo = wait.until(
new Function<WebDriver, WebElement>() {
            public WebElement apply(WebDriver driver) {
                        return driver.findElement(locator);
                }
                }
);
                           return  foo;              }     ;

希望这能帮助您

准确解释您想要“捕获”的内容。快速浏览一下JS,就会发现它在弹出窗口中使用了静态ID和类,所以是的,这是完全可能的。
String xPathElement ="...blablab.....";
WebElement found  = fluentWait(By.xpath(xPathElement));
found.click();
//found.getText().trim():