Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Using xpath to cllick with selenium on python

I’m trying to click "Claim reward" by selenium python and it doesn’t work:

Details

Here is my code:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

WebDriverWait(driver,20).until(EC.visibility_of_element_located(By.XPATH, ('//button[@class="chakra-button css-g0vki9"]'))).click()

Can someone help me? thank you

>Solution :

You should try like below

WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.XPATH, "//button[contains(text(),'Claim Reward')]"))).click()

OR

WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, '//button[@class="chakra-button css-g0vki9"]'))).click()

OR By CSS SELECTOR

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, 'button.chakra-button.css-g0vki9'))).click()

IMPORT

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading