Test dynamically loaded content with Selenium Web Driver

前端 未结 3 1393
不思量自难忘°
不思量自难忘° 2021-01-12 13:41

I am working on a system that has a web based frontend that I am testing with Selenium. On one page the content is dynamically loaded when scrolling down (maybe you know tha

3条回答
  •  Happy的楠姐
    2021-01-12 14:20

    I would recommend using WebDriverWait with ExpectedConditons.

    //scroll down with Javascript first
    WebDriverWait wait = new WebDriverWait(driver, 30);
    WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("selector")));
    //interact with your element
    element.click()
    

    Take a look at the guidance provided by Selenium Official page: http://seleniumhq.org/docs/04_webdriver_advanced.html

提交回复
热议问题