Friday, March 14, 2025

selenium webdriver – The right way to deal with disable button?


In my script under code when Thread.sleep() just isn’t used, then it throws an exception "aspect click on intercepted: Factor just isn't clickable at level (226, 567).

When utilizing the Thread.sleep() it runs and clicks on the Subsequent button, however the issue is that in my software whole 9 occasions subsequent button must be clicked.

For that I printed message on the log so right here solely 6 occasions message will get printed (‘btn50-400clicked’) after which subsequent button is disabled and unable to proceed to subsequent code.

Even after ready for as much as half-hour it is not working.

How do I resolve it?

var subsequent=WDS.browser.findElement(pkg.By.xpath("//button[contains(@class,'btn btn-sm btn-light border ml-3')]"))

whereas(subsequent.isEnabled())
            {
                java.lang.Thread.sleep(9000);
                //var wait15=new org.openqa.selenium.assist.ui.WebDriverWait(WDS.browser, 20000)
//wait15.till(org.openqa.selenium.assist.ui.ExpectedConditions.invisibilityOfElementLocated(pkg.By.xpath("//button[contains(@class,'btn btn-sm btn-light border ml-3')]")))
                var wait9 =new org.openqa.selenium.assist.ui.WebDriverWait(WDS.browser, 9000)
                wait9.till(org.openqa.selenium.assist.ui.ExpectedConditions.elementToBeClickable(pkg.By.xpath("//button[contains(@class,'btn btn-sm btn-light border ml-3')]"))).click on()
                //subsequent.click on();
                WDS.log.data('btn50-400clicked')
                
            }
            WDS.log.data('btn2clicked')
            //java.lang.Thread.sleep(3000);
            if(!subsequent.isEnabled()){
                           WDS.log.data('Subsequent button disabled')}

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

PHP Code Snippets Powered By : XYZScripts.com