Issue
So on the e-commerce webpage (https://www.jooraccess.com/r/products?token=feba69103f6c9789270a1412954cf250) the color name of the product is displayed when I hover over it, I was able to determine what the new line in HTML code that appears when I hover over, but I don't know how to grab the text ('NAVY').
<div class="ui top left popup transition visible Tooltip_Tooltip__M0LJL Tooltip_black__heZoQ" style="position: absolute; inset: auto auto -7494px 378px;">NAVY</div>
driver.get("https://www.jooraccess.com/r/products?token=feba69103f6c9789270a1412954cf250")
elements = WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.XPATH, "//div[@class='Swatch_swatch__2X1CY']")))
for el in elements:
ActionChains(driver).move_to_element(el).perform()
mouseover = WebDriverWait(driver, 30).until(EC.visibility_of_element_located((By.XPATH, "//div[@class='ui top left popup transition visible Tooltip_Tooltip__M0LJL Tooltip_black__heZoQ'")))
print(mouseover)
Solution
Here is the solution I came to before I saw the answers here:
elements = WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.XPATH, "//div[@class='Swatch_swatch__2X1CY']")))
for el in elements:
ActionChains(driver).move_to_element(el).perform()
page = BeautifulSoup(driver.page_source, features='html.parser')
print(page.find("div", class_="ui top left popup transition visible Tooltip_Tooltip__M0LJL Tooltip_black__heZoQ").text)
Answered By - hkm
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.