我正在尝试抓取此页面:
https://www.lanebryant.com/living-my-best-life-graphic-tee/prd-357900
我在Selenium的浏览器中打开。加载页面时,必须关闭一个弹出窗口。它成功关闭。但是,它不会单击尺寸指南链接而被卡住。 这是我的代码:
wait = WebDriverWait(d, 10)
close = wait.until(EC.element_to_be_clickable((By.XPATH, "//a[@id='closeButton']")))
close.click()
wait = WebDriverWait(d, 10)
chart= wait.until(EC.element_to_be_clickable((By.XPATH, "//a[@class='asc-groupe-size-guide']")))
chart.click()
答案 0 :(得分:1)
尝试使用此xpath
interface MyComponentProps<T> {
value: T
}
const MyComponent: FunctionComponent<MyComponentProps<string>> = ({ value }) => <div />;
或
wait = WebDriverWait(d, 10)
chart= wait.until(EC.element_to_be_clickable((By.XPATH, "//*[@class='size-chart-link']/a")))
chart.click()