In my script below code when Thread.sleep() is not used, then it throws an exception “element click intercepted: Element <button _ngcontent-yyo-c131=”” class=”btn btn-sm btn-light border ml-3″>…</button> is not clickable at point (226, 567).
When using the Thread.sleep() it runs and clicks on the Next button, but the problem is that in my application total 9 times next button should be clicked.
For that I printed message on the log so here only 6 times message gets printed (‘btn50-400clicked’) and then next button is disabled and unable to proceed to next code.
Even after waiting for up to 30 minutes it’s not working.
How do I resolve it?
var next=WDS.browser.findElement(pkg.By.xpath(“//button[contains(@class,’btn btn-sm btn-light border ml-3′)]”))
while(next.isEnabled())
{
java.lang.Thread.sleep(9000);
//var wait15=new org.openqa.selenium.support.ui.WebDriverWait(WDS.browser, 20000)
//wait15.until(org.openqa.selenium.support.ui.ExpectedConditions.invisibilityOfElementLocated(pkg.By.xpath(“//button[contains(@class,’btn btn-sm btn-light border ml-3′)]”)))
var wait9 =new org.openqa.selenium.support.ui.WebDriverWait(WDS.browser, 9000)
wait9.until(org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable(pkg.By.xpath(“//button[contains(@class,’btn btn-sm btn-light border ml-3′)]”))).click()
//next.click();
WDS.log.info(‘btn50-400clicked’)
}
WDS.log.info(‘btn2clicked’)
//java.lang.Thread.sleep(3000);
if(!next.isEnabled()){
WDS.log.info(‘Next button disabled’)}