sorry for the question but i'm learning to code, i'm a newbie.
i need to create a button that click the button only if some requirements are meets.
Problem is that this code change everytime that i click in this: Button activated:
mt-10 button small js-filter-momo
Button deactivated:
mt-10 button small js-filter-momo button--light-outline
I need to click the button on this page only if the button is deactivated, so:
mt-10 button small js-filter-momo button--light-outline
if the button is already activated i need to move on, what can i do?
CodePudding user response:
Assuming what you have provided is a class, you may try with the try/except
block.
try:
driver.find_element(By.XPATH, "//*[@class='mt-10 button small js-filter-momo button--light-outline']").click()
except:
pass