I’m currently trying to build out an automation that requires selecting on a button from a pop up screen but I’ve been unsuccessful. There are two buttons and the one I’m wanting to select is the “Save” portion. Here is currently how the code looks like for the button:
<button type="submit" class="btn btn-secondary"><span>Cancel</span></button>
<button type="submit" class="btn btn-strong"><span>Save</span></button>
I have successfully coded a portion of my automation to click on buttons but for some reason it isn’t working on this pop up screen button.
So far, I’ve tried the following code without success as it simply crashes my program:
driver.find_element(By.XPATH,"//button[@class='btn btn-strong')]").click()
WebDriverWait(driver,10000).until(
EC.presence_of_element_located((By.XPATH,"//*[contains(@class,'btn btn-strong')]"))
).click()
John is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.