0

I am using Selenium on Python for scraping.

Based on javascript error: Failed to execute 'elementsFromPoint' on 'Document': The provided double value is non-finite I've tried to access the second element of the fifth menu item. Selection by id is fine, but menu item seems not to be accessible. html

<li class="k-item k-state-default" role="menuitem">
   <span class="k-link">
      <span class="undefined "i="">Budynki</span></span></li>`

Code trials:

dataset_drop_down_element = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,"//*[@title = 'Informacja o obiektach mapowych']")))`

Errors:

 dataset_drop_down_element = Select(dataset_drop_down_element)
 Select only works on <select> elements, not on <span>

 dataset_drop_down_element.send_keys('Budynek')
 Message: element not interactable

 driver.find_element_by_xpath('//*[@title="Informacja o obiektach mapowych"]/span[2]').click()
 Message: element not interactable
terseason
  • 60
  • 8

1 Answers1

0

To click on the element with text as Budynki you need to induce WebDriverWait for the element_to_be_clickable() and you can use the following Locator Strategies:

  • Using XPATH:

    driver.get("https://goleniowski.webewid.pl/e-uslugi/portal-mapowy")
    WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH, "//span[@title='Informacja o obiektach mapowych']/span"))).click()
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//ul[@data-role='popup']//li/span/span[text()='Budynki']"))).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
    
DebanjanB
  • 118,661
  • 30
  • 168
  • 217