我想从丝芙兰网站上搜集评论。审查是动态更新的。你知道吗
经过检查,我发现审查是在这里的HTML代码。你知道吗
<div class="css-eq4i08 " data-comp="Ellipsis Box">Honestly I never write
reviews but this is a must if you have frizzy after even after straightening
it! It smells fantastic and it works wonders definitely will be restocking once
I’m done this one !!</div>
我想写一个python selenium代码来阅读评论。你知道吗
我写的代码在这里。。。你知道吗
from selenium import webdriver
chrome_path = (r"C:/Users/Connectm/Downloads/chromedriver.exe")
driver = webdriver.Chrome(chrome_path)
driver.implicitly_wait(20)
driver.get("https://www.sephora.com/product/crybaby-coconut-oil-shine-serum-P439093?skuId=2122083&icid2=just%20arrived:p439093")
reviews = driver.find_element_by_xpath('//*[@id="ratings-reviews"]/div[4]/div[2]/div[2]/div[1]/div[3][@data-comp()='Elipsis Box'])
print(reviews.text)
如果我写find_element_by_class
,它会给我一个空白。你知道吗
最好的选择是什么?你知道吗
我正在尝试使用带有属性的xpath。代码不起作用。 有人请帮我什么是最好的解决方案?你知道吗
要从Sephora网站上抓取评论,您必须诱导WebDriverWait元素可见,您可以使用以下解决方案:
代码块:
控制台输出:
相关问题 更多 >
编程相关推荐