1

I want to disable the button before clicking on it, here is what I have:

<button type="submit" name="shippingAddress_save" value="Continue to Billing >" disabled="disabled">
1

3 Answers 3

5

you can do this in selenium USING JavascriptExecutor as below:

WebElement yourButton= driver.findElement(By.name("shippingAddress_save"));

JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].removeAttribute('disabled','disabled')",yourButton);

WebDriverWait wait = new WebDriverWait(driver, 20);
wait.until(ExpectedConditions.elementToBeClickable(yourButton));

yourButton.click();
Sign up to request clarification or add additional context in comments.

2 Comments

thank you but it is still saying "Element is not clickable at point (355, 1279)"
@kushal.8 From some reason the button is still disabled
0

You have to change the properties in the html side after doing click with selenium, but you can't do it with selenium itself, selenium only does what you tell it to do, but if you want change in your UI or your behavior you must have to write code for it.

Comments

0

you can check the below code :

WebElement element=driver.Find(By.xpath("your locator xpath")); JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("arguments[0].removeAttribute('disabled','disabled')",element);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.