Reputation: 1809
I'm trying to use Selenium to click on "show more" under "about this show" on this URL:
Here's my code:
#Get Event Info - expand 'read more'
try:
time.sleep(3)
readMoreEvent = driver.find_element_by_xpath("//div[@class='xXGKBimvIBU_aEdJh3EF']").click();
print("More Event Info Clicked")
except (ElementNotVisibleException, NoSuchElementException, TimeoutException):
pass
I'm getting an error:
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted:
.</div> is not clickable at point (477, 9). Other element would receive the click:
Here's a photo of the div I'm trying to click:
So, it seems like something is blocking the page-click. How can I solve this issue?
Upvotes: 2
Views: 11231
Reputation: 818
I saw that there's a dialogue box that pops up which asks user to login. That could be interrupting the click.
A better approach is to:
This should work:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import ElementClickInterceptedException
from selenium.webdriver.chrome.options import Options
from time import sleep
options = Options()
options.add_argument("--disable-notifications")
driver = webdriver.Chrome(executable_path='D://chromedriver/100/chromedriver.exe', options=options)
wait = WebDriverWait(driver, 20)
url = "https://www.bandsintown.com/e/1024477910-hot-8-brass-band-at-the-howlin%27-wolf?came_from=253&utm_medium=web&utm_source=city_page&utm_campaign=event"
driver.get(url)
try:
showmore_link = wait.until(EC.element_to_be_clickable((By.XPATH, '//div[@class="xXGKBimvIBU_aEdJh3EF"]')))
showmore_link.click()
except ElementClickInterceptedException:
print("Trying to click on the button again")
driver.execute_script("arguments[0].click()", showmore_link)
Upvotes: 7