2

I'm new to Python and Selenium and I want to click the button "Afficher plus" in this url.

i've tried this code :

plus = driver.find_element_by_css_selector("button[class='b-btn b- 
ghost']")
plus.click()

but it doesn't work and i get this error:

selenium.common.exceptions.WebDriverException: Message: unknown error: Element ... is not clickable at point (390, 581). Other element would receive the click: ...

2
  • It does mean exactly what is given in the error message: whichever element is selected by that query is not clickable Commented Apr 11, 2019 at 10:28
  • it means i have to make a time sleep to load the page! Commented Apr 11, 2019 at 10:35

2 Answers 2

1

Element you are trying to click is not clickable, or might be overlapped.

Try to click specified element, by executing java script click function.

driver.execute_script("arguments[0].click();", element)

On another hand, your page might not yet be fully loaded, so element might not be clickable yet, you can use wait for condition:

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

element = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable(By...)) //change selector

element.click();
Sign up to request clarification or add additional context in comments.

4 Comments

i've tried the second solution but it didn't work i get the same problem
Try to combine 1st and 2nd option, replace last line of the second option with line from the first option (click using JS)
i did and i get this error selenium.common.exceptions.WebDriverException: Message: unknown error: call function result missing 'value'
it's okay now it was a problem of the webdriver version
0

To click the button with text as Afficher plus de biens within this url you have to induce WebDriverWait for the element to be clickable and you can use either of the following solutions:

  • Using CSS_SELECTOR:

    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button.b-btn.b-ghost"))).click()
    
  • Using XPATH:

    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//button[@class='b-btn b-ghost' and contains(., 'Afficher plus')]"))).click()
    
  • Note : You have to add the following imports :

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.