'Dynamic(with mouseover/coordinates) web scraping python unable to extract information

I'm trying to scrape the data that only appears on mouseover(selenium). It's a concert map and this is my entire code. I keep getting TypeError: 'ActionChains' object is not iterable

The idea would be to hover over the whole map & always scrape the code when the html changes. I'm pretty sure I need two for loops for that, but I don't know yet, how to combine them. Also, I know I'll have to use bs4, could someone share ideas how I could go about this?

driver = webdriver.Chrome()
driver.maximize_window()
driver.get('https://www.ticketcorner.ch/event/simple-minds-hallenstadion-12035377/')

#accept shadow-root cookie banner

time.sleep(5)
driver.execute_script('return document.querySelector("#cmpwrapper").shadowRoot.querySelector("#cmpbntyestxt")').click()
time.sleep(5)

# Click on the saalplan so we get to the concert map

WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#tickets > div.seat-switch-wrapper.js-tab-switch-group > a:nth-child(3) > div > div.seat-switch-radio.styled-checkbox.theme-switch-bg.theme-text-color.theme-link-color-hover.theme-switch-border > label'))).click()
time.sleep(5)

#Scroll to the concert map, which will be the element to hover over

element_map = driver.find_element(By.CLASS_NAME, 'js-tickettype-cta')
actions = ActionChains(driver)
actions.move_to_element(element_map).perform()

# Close the drop-down which is partially hiding the concert map

driver.find_element(by=By.XPATH, value='//*[@id="seatmap-tab"]/div[2]/div/div/section/div[2]/div[1]/div[1]/div/div/div[1]/div').click()


# Mouse Hover over the concert map and find the empty seats to extract the data.

actions = ActionChains(driver)
data = actions.move_to_element_with_offset(driver.find_element(by=By.XPATH, value='//*[@id="seatmap-tab"]/div[2]/div/div/section/div[2]/div[1]/div[2]/div/div[2]/div[1]/div[2]/div[2]/canvas'),0,0)
for i in data:
    actions.move_by_offset(50, 50).perform()
    time.sleep(2)
    # print content of each box
    hover_data = driver.find_element(By.XPATH, '//*[@id="tooltipster-533522"]/div[1]').get_attribute('tooltipster-content')
    print(hover_data)```

# The code I would use to hover over the element
    #actions.move_by_offset(100, 50).perform()
    # time.sleep(5)
    # actions.move_by_offset(150, 50).perform()
    # time.sleep(5)
    # actions.move_by_offset(200, 50).perform()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source