无法使用python、selenium和beautiful soup抓取评论页面

无法使用python、selenium和beautiful soup抓取评论页面,python,selenium,web-scraping,beautifulsoup,Python,Selenium,Web Scraping,Beautifulsoup,我正在努力刮一个Flipkart的评论页面 https://www.flipkart.com/reviews/b9ec5c5c-3814-40ef-8f73-84f253ee09ce 我正在使用python,美丽的汤和硒。 下面是代码 options = webdriver.ChromeOptions() options.add_argument('--ignore-certificate-errors') driver = webdriver.Chrome(executable_path='

我正在努力刮一个Flipkart的评论页面

https://www.flipkart.com/reviews/b9ec5c5c-3814-40ef-8f73-84f253ee09ce
我正在使用python,美丽的汤和硒。 下面是代码

options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
driver = webdriver.Chrome(executable_path='D:\ESS\Intern-Shubham\chromedriver.exe',options=options)
driver.get('https://www.flipkart.com/reviews/b9ec5c5c-3814-40ef-8f73-84f253ee09ce')
time.sleep(20)
WebDriverWait(driver,
delay).until(EC.presence_of_element_located(driver.find_elements_by_class_name('_3t4Eas')))
print('Page is ready!')
无论我添加了多少延迟,实际的评论都没有加载到页面中,下面是一段时间后加载的评论片段。

任何提示和建议都会有帮助。

导入方式

from selenium.webdriver.common.by import By

WebDriverWait(driver,
              20).until(EC.presence_of_element_located((By.CLASS_NAME,'_3t4Eas')))
print('Page is ready!')
您的定位器错误,现在可以删除时间。sleep()


您应该传递带有定位器策略和定位器的元组,而不是元素。它会导致运行时错误。NameError:名称“By”未定义导入依据从selenium.webdriver.common.By导入依据