I'm trying to select "Manhattan", "WINDSOR SQUARE", and "Wall St." from the "city", "Neighborhood", and "Collections" dropdown search boxes respectively on this website: https://upxland.me/properties/. The same code (except the text I'm selecting) works for the "City" dropdown but not "Neighborhood", and "Collections". Where am I doing wrong and what is the correct way to select dropdown search boxes like this?
I'm also not able to locate the "download" button by copying the XPATH of it.
The error messages are all ElementClickInterceptedException shown below:
"raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element ... is not clickable at point (476, 234). Other element would receive the click: ... (Session info: chrome=103.0.5060.134)"
My code is shown below. Could anyone help?
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import Select
import time
PATH = "/usr/local/bin/chromedriver"
driver = webdriver.Chrome(PATH)
driver.get("https://upxland.me/properties/")
'''City'''
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//label[contains(text(),'City')]"))).click()
city = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[contains(text(),'Manhattan')]")))
city.click()
'''Neighborhood'''
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//label[contains(text(),'Neighborhood')]"))).click()
neighborhood = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[contains(text(),'WINDSOR SQUARE')]")))
neighborhood.click()
'''Collection'''
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//label[contains(text(),'Collections')]"))).click()
neighborhood = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//div[contains(text(),'Wall St.')]")))
neighborhood.click()
'''download'''
download_button_path = '//*[@id="HackerLovesUPXLand"]/div[1]/main/div/div/div/div[5]/div/div[1]/div/div[4]/button/span/i'
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, download_button_path))).click()
//label[contains(text(),'Neighborhood')]? Do you see it get clicked? Is there similarly an element matching"//div[contains(text(),'WINDSOR SQUARE')]"in the drop-down list? How did you determine that the code works for the City? When you investigate in the same way for the other drop-downs, what seems to go wrong?