I have a button which is wrapped inside a li element which appears 5 seconds after the other elements have loaded. I have to click on this element but I am unable to access this element using selenium.
I have used implicit wait, explicit wait and fluent wait. Selenium is still unable to identify the element as it terminates with a TimeoutException and NoSuchElementException.
The element in HTML:
<li class="wow zoomIn" data-wow-delay="1.0s" data-reactid=".0.0.0.1.5" style="visibility: visible; animation-delay: 1s; animation-name: zoomIn;">
<button class="pip-icon-new" data-role="none" title="PIP" data-reactid=".0.0.0.1.5.0"/>
<span class="mt10 col-xs-12" data-reactid=".0.0.0.1.5.1">PIP</span>
</li>
Fluent Wait:
Wait wait = new FluentWait(driver)
.withTimeout(30, TimeUnit.SECONDS)
.pollingEvery(5, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("button[data-reactid='.0.0.0.1.5.0']")));
Explicit Wait:
WebElement myDynamicElement = (new WebDriverWait(driver, 10))
.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id='Home-page']/div[1]/ul/li[5]/button")));
myDynamicElement.click();
Implicit Wait:
WebDriverWait wait=new WebDriverWait(driver, 20);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("span[class='mt10 col-xs-12']")));
Am I missing something?
presenceOfElementLocatedand let me know - NarendraR