I am currently trying to scrape a dynamic website which uses javascript to provide information after hovering over images. I am trying to obtain the data inside of the text containers brought up by hovering over these images, but am having difficulty doing so because when I define all of the elements, then attempt to create a loop which hovers over all of them, I only receive the text data from the first element I defined, over and over as many elements as there are (10 on this page.) Here is some code which should help you reproduce my problem. Do I need to induce waits into this loop in order to generate the proper results? Thanks.
from selenium import webdriver
driver = webdriver.Chrome(r'C:\Users\Hank\Desktop\chromedriver_win32\chromedriver.exe')
driver.get('https://steamcommunity.com/market/listings/440/Unusual%20Old%20Guadalajara')
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.expected_conditions import presence_of_element_located
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions as EC
action = ActionChains(driver)
imgs = driver.find_elements(By.CSS_SELECTOR, '[class^=market_listing_item_img][id^=listing_]')
for item in imgs:
action.move_to_element(img).perform()
descriptors = driver.find_element(By.CLASS_NAME, 'item_desc_descriptors')
print(descriptors.text)
The code then proceeds to return exactly what I want for the FIRST element only. Thank you for your time, please let me know if there is an answer to my question somewhere else on the site, I've looked and can't seem to find one.