【发布时间】:2020-04-25 20:46:09
【问题描述】:
我正在使用 Beautfilsoup 从 Google Play 商店中提取应用相关信息。我正在提取应用程序名称、总体评分、没有人评价该应用程序以及评论者发布的评论。但是,当我运行程序时,它会引发 webdriver 异常例如:当程序尝试从该应用程序('https://play.google.com/store/apps/details?id=com.tudasoft.android.BeMakeup&hl=en&showAllReviews=true')中检索信息时,它会引发错误。这是我的代码:
import bs4 as bs
from selenium import webdriver
driver = webdriver.Chrome(path)
driver.get(url)
soup = bs.BeautifulSoup(driver.page_source, 'html.parser')
我在第三行出现错误,错误的开始是:
---------------------------------------------------------------------------
WebDriverException Traceback (most recent call last)
<ipython-input-270-4e8a1ef443f2> in <module>()
----> 1 soup = bs.BeautifulSoup(driver.page_source, 'html.parser')
错误的结尾是:
(Session info: chrome=79.0.3945.88)
(Driver info: chromedriver=2.41.578706 (5f725d1b4f0a4acbf5259df887244095596231db),platform=Mac OS X 10.15.2 x86_64)
我尝试使用异常处理但没有解决问题谁能指导我如何克服这种情况?
【问题讨论】:
-
如果您发现您的 Chrome 驱动程序
chromedriver=2.41.578706和 chrome 版本chrome=79.0.3945.88不兼容。请先更新您的 chrome 驱动程序并重试。 -
我认为问题在于评论中的表情符号。起初我遇到了错误,但是当我进入开发工具并删除那些表情符号时,它运行良好。不确定如何以编程方式解决该问题。我读了这个here
标签: python python-3.x selenium selenium-webdriver beautifulsoup