2

I am working with the following website: www.offerte.smartpaws.ch

I am trying to use the French site: www.offerte.smartpaws.ch/fr

I have a piece of code that works with the German part but for some reason I get an error when trying to do the same thing on the French side, even if the elements are identical.

I have the following code to select the year:

for year in range(21,12,-1):

    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="id_form-0-dob"]'))).click()
    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="id_form-0-dob_root"]/div/div/div/div/div[1]/select[1]'))).click()
    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,'//select[@class="picker__select--year" and @aria-controls="id_form-0-dob_table"]//option[text()='+str(2000 + year) +']'))).click()
    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="id_form-0-dob_root"]/div/div/div/div/div[2]/button'))).click()

This code is supposed to go through a range of years, click on the calendar option, then click on the dropdown for years and take the selected year, finally, we close the calendar.

This method is working fine in the German side, but fails at the French side, with the following error:

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <input type="text" name="form-0-dob" id="id_form-0-dob" readonly="" class="picker__input" aria-haspopup="true" aria-expanded="false" aria-readonly="false" aria-owns="id_form-0-dob_root"> is not clickable at point (921, 572). Other element would receive the click: <label for="id_form-0-dob">...</label>

Thank you for any advice or sugestions.

2
  • Error is with <input> element but I don't see interacting with <input> in your code trials. Commented Apr 7, 2022 at 7:47
  • I hsave used both * and input both gave me the same result Commented Apr 7, 2022 at 7:56

1 Answer 1

1

Try clicking the parent div element of the input. Seems to work for me for both language sites:

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="id_form-0-dob"]/..'))).click()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.