These are the html for a button which changes x-path dynamically but "Show Actions" remains the same. I am confused whether "Show Actions" is name, title or id of the button.
Is there anyway to click this button with "Show Actions" or any other ways?
CodePudding user response:
Show Actions
seems to be the text content of the element.
You can try clicking it with the following way:
driver.find_element(By.XPATH, "//span[contains(text(),'Show Actions')]").click()
Or
driver.find_element(By.XPATH, "//span[contains(.,'Show Actions')]").click()
You will possibly need to add an expected condition to wait for this element clickability, as following:
wait.until(EC.element_to_be_clickable((By.XPATH, "//span[contains(.,'Show Actions')]"))).click()