I've been trying to fix an ElementClickInterceptedException but my methods are not working. This is the Link I am using. When I click on the bars on the left side, before the game time, it opens something like a pop-up but it's on the same Window as shown in the picture...
I am able to get the information needed on the page. Problem is after i close it by clicking on the x, it won't loop into the next one, it gives me the ElementClickInterceptedException: Message: Element is not clickable at point because another element obscures it. Mostly it does this on the second loop, but sometimes it passes the second and goes to the third but it's never passed the third loop. I tried using the wait and until but that didn't do any help, it only goes to Timeout. Here is the code I'm using for that.
#This fetch all the games I want to scrape for into a list of selenium objects
v1 = _.find_elements_by_class_name('trOddsSection')
driver.implicitly_wait(10)
for __ in v1:
driver.implicitly_wait(10)
#__.find_element_by_class_name("col-0").click()
wait.until(EC.element_to_be_clickable((By.XPATH, ".//td[@class='col-0']")))
yyy = __.find_element_by_xpath(".//td[@class='col-0']")
# This click gets the pop-up thing out
yyy.click()
v3 = wait.until(EC.presence_of_element_located((By.CLASS_NAME, "divStatisticsWidget")))
sleep(3)
try:
driver.implicitly_wait(10)
# This is where I scrape what I want from the pop-up
a = v3.find_element_by_xpath(".//div[@id='right-container']/div[@id='content_headToHead']/div[@class='sectionFound']/div[@class='teamWinsDraws']")
hm = a.find_element_by_xpath(".//div[@class='teamHomeWins']/span[@class='teamName']/span[@class='resultsPerc']").text
dr = a.find_element_by_xpath(".//div[@class='teamDraws']/span[@class='teamName']/span[@class='resultsPerc']").text
aw = a.find_element_by_xpath(".//div[@class='teamAwayWins']/span[@class='teamName']/span[@class='resultsPerc']").text
print("Here:\t\t{}\t{}\t{}".format(hm, dr, aw))
driver.implicitly_wait(10)
a_ = v3.find_element_by_xpath(".//div[@id='right-container']/div[@id='content_headToHead']/div[@class='sectionFound']/div[@class='headToHeadHistory']")
a__ = a_.find_elements_by_xpath(".//table/tbody/tr/td[@class='score']")
print("H2H {}".format(a__[0].text))
except(NoSuchElementException):
print("teamWinDraws class not found")
# This is where I close the pop-up window so I can move to next
try:
driver.implicitly_wait(10)
sleep(4)
wait.until(EC.element_to_be_clickable((By.XPATH, ".//*[@class='close-icon']")))
g_g = driver.find_element_by_xpath(".//*[@class = 'close-icon']")
driver.execute_script("arguments[0].click();", g_g)
except(NoSuchElementException):
print('close-icon not found')
except(TimeoutException):
print('Timed out')
Anyone sees something I'm doing wrong or how to maneuver around this please let me know.