I have two questions.
find_element_by_class('css_s6sd4y.eanm7710') -> go down to one more row then select the element
for first question, you can use the below code :
to get the Medium Coverage :
wait = WebDriverWait(driver, 10)
ele = wait.until(EC.visibility_of_element_located((By.XPATH, "//img[@alt='Medium Coverage']/.."))).text
print(ele)
or
wait = WebDriverWait(driver, 10)
ele = wait.until(EC.visibility_of_element_located((By.XPATH, "//img[@alt='Medium Coverage']/.."))).get_attribute('innerHTML')
print(ele)
to get the Liquid Formula :
wait = WebDriverWait(driver, 10)
ele = wait.until(EC.visibility_of_element_located((By.XPATH, "//img[@alt='Liquid Formula']/.."))).text
print(ele)
or
wait = WebDriverWait(driver, 10)
ele = wait.until(EC.visibility_of_element_located((By.XPATH, "//img[@alt='Liquid Formula']/.."))).get_attribute('innerHTML')
print(ele)
for your second question :-
Yes you can use data-at = 'sku_size_label'
in xpath or css :
Xpath below :
//span[contains(@data-at, 'sku_size_label')]
CSS below :
span[data-at = 'sku_size_label']
and for this question :
what is 'data-at' locator called?
- They are not called locators, they are basically attributes of the respective tag.
Imports :
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.