-1

I'm writing a script in Selenium (Python) and I am having an issue with a disabled clicked Button. The button becomes active only when the form is completed.

<button type="submit" class="pm_button primary large humanVerification-completeSetup-create" ng-disabled="model.emailCodeVerification === '' &amp;&amp; model.captcha_token === false &amp;&amp; model.smsCodeVerification === ''" translate="" translate-context="Action" disabled="disabled">Complete setup</button>

This is the button HTML part. Now the button looks like this:

Button Image http://prntscr.com/pl4u96

As you can see, it's not clickable. The button activates only when the captcha or any other type of verification is completed. Now my only request is to detect the Button when it becomes active.

<button type="submit" class="pm_button primary large humanVerification-completeSetup-create" ng-disabled="model.emailCodeVerification === '' &amp;&amp; model.captcha_token === false &amp;&amp; model.smsCodeVerification === ''" translate="" translate-context="Action">Complete setup</button>

This is the code after the Captcha or another type of verification is completed. The part disabled="disabled" in the first code line is completely removed when the verification is completed. I genuinely have 0 ideas of how to detect it and I failed on finding a good solution.

0

1 Answer 1

1

Induce WebDriverWait And wait for element_to_be_clickable()

WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.XPATH,"//button[@class='pm_button primary large humanVerification-completeSetup-create'][text()='Complete setup']"))).click()

You need to import followings.

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
Sign up to request clarification or add additional context in comments.

2 Comments

When you see a question like this that has very likely been asked before, please find a good dup and mark it as a dup unless there's something clearly different or unique about it. Otherwise we end up with hundreds of questions asking the same basic questions.
@JeffC :Sure I'll make a note.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.