shalini shalini - 17 days ago 6
Python Question

Issues clicking an element using selenium

Im using this code to explore tripadvisor (Portuguese comments)

from selenium import webdriver
from bs4 import BeautifulSoup
driver.set_window_size(1920, 1080)

Then Im trying to click the google-translate link


But getting this error :-

WebDriverException: Message: Element is not clickable at point (854.5, 10.100006103515625). Other element would receive the click: <div class="inner easyClear"></div>

So the
div class="inner easyClear"
is getting the click. I tried exploring it

from bs4 import BeautifulSoup
for i in page.findAll("div","easyClear"):
print i
print "================="

But was unable to get any intuition from this as in what changes to incorporate now to make the "Google Translate" clickable. Please help


Ive also tried these

driver.execute_script("window.scrollTo(0, 1200);")

Resizing the browser to full screen etc..


What worked for me was to use an Explicit Wait and the element_to_be_clickable Expected Condition and get to the inner span element:

from selenium import webdriver
from selenium.webdriver import ActionChains
from import By
from import WebDriverWait
from import expected_conditions as EC

driver = webdriver.Chrome()

wait = WebDriverWait(driver, 10)

google_translate = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, ".googleTranslation .link")))

actions = ActionChains(driver)

You may also be getting into a "survey" or "promotion" popup - make sure to account for those.