I am not able to locate a div that seems to be always present containing tooltip text after performing a hover action.
I'm new to web scraping and try to get some odds data from a betting website using selenium. I would like to extract the tooltip data which appears for each of the cells.
I tried the following code and I time out. If I just look for the tooltiptext element with find_element then I get an element not found error.
The issue I have is that I can see this element in chrome's inspector but seem to be unable to locate it within the page.
#set up webdriver
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
# initialize the Chrome driver
wd = webdriver.Chrome('chromedriver',options=chrome_options)
#get the website data
wd.get("https://www.oddsportal.com/soccer/argentina/primera-nacional/quilmes-san-
martin-t-n791ygOf/")
wd.maximize_window()
#Hover over element and get tooltip text
element = wd.find_element(by = By.XPATH, value='//*[@id="odds-data-
table"]/div[1]/table/tbody/tr[1]/td[2]')
hover = ActionChains(wd).move_to_element(element)
hover.perform()
tooltipText = WebDriverWait(wd, 10).until(EC.presence_of_element_located((By.XPATH,
'//*[@id="tooltiptext"]'))).text
see image below of the tooltip div:
