1

I am trying to scrape this website with selenium on python I keep getting this error every time I try to click on a dropdown button that is inside a div tag can some help me please the error is 'Element is not clickable at point (1341, 240)' below is the website

'https://tennisinsight.com/player/56330/andrea-gamiz/'

if you scroll to the bottom of the page, I am trying to click on the duration dropdown options in the match stats sections. below is my code so far


    driver = webdriver.Chrome()  
    driver.maximize_window()
    wait = WebDriverWait(driver, 5)
    small_wait = WebDriverWait(driver, 5)

    driver.execute_script('window.open("https://tennisinsight.com/player/56330/andrea-gamiz/","_self")')
    driver.execute_script("document.body.style.zoom='75%'")
    from selenium.webdriver.common.keys import Keys
    html = driver.find_element_by_tag_name('html')
    html.send_keys(Keys.END)
    time.sleep(3)   
    element = wait.until(EC.element_to_be_clickable((By.XPATH, ' //*[@id="matchStatsDuration"]')))
    element.click()

smith
  • 200
  • 3
  • 12

1 Answers1

1

Here is the simple approach that I would follow to select the items from this list.

# select Month from the list.
element = WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH, "//select[@id='matchStatsDuration']/option[.='Month']")))
element.location_once_scrolled_into_view
element.click()

By this way I don't have to worry about the overlaying top menu, which is obstructing the click on the list element.

supputuri
  • 13,644
  • 2
  • 21
  • 39
  • hey it works but i am also trying to click on the go button but i get the same error can u help me, please – smith Jul 08 '19 at 05:34
  • Just add this code `driver.execute_script("arguments[0].click()",driver.find_element_by_xpath("//button[.='Go']"))` – supputuri Jul 08 '19 at 05:40
  • hey sorry just one more thing – smith Jul 08 '19 at 05:43
  • It will trigger the javascript. Basically in the above comment we are clicking on the button with javascript. So, we don't have to worry if the element is overlayed with some other element. – supputuri Jul 08 '19 at 05:46