Skip to main content
 首页 » 编程设计

python之Chromedriver 在从某个网站抓取数据时表现得很奇怪

2024年11月24日42rubylouvre

我已经用 python 编写了一个与 selenium 相关的脚本来解析网站中排名前 100 的名称。当我运行我的脚本时,我会收到一个弹出框作为通知/警告。

What might be the issue here as I've been using the same approach quite some time without any issues in different sites?

website url

from selenium import webdriver 
 
def collect_names(driver,link): 
    driver.get(link) 
    for item in driver.find_elements_by_css_selector(".topcolumn h2"): 
        print(item.text) 
 
if __name__ == '__main__': 
    url = "https://propertyspark.com/top-100-real-estate-teams-on-social-media-in-2018/" 
    driver = webdriver.Chrome() 
    collect_names(driver,url) 
    driver.quit() 

弹出框:

以下是问题签名:

  Problem signature: 
  Problem Event Name:   APPCRASH 
  Application Name: chromedriver.exe 
  Application Version:  0.0.0.0 
  Application Timestamp:    5a9904fa 
  Fault Module Name:    chromedriver.exe 
  Fault Module Version: 0.0.0.0 
  Fault Module Timestamp:   5a9904fa 
  Exception Code:   c0000005 
  Exception Offset: 0003c586 
  OS Version:   6.1.7601.2.1.0.256.1 
  Locale ID:    1033 
  Additional Information 1: 0a9e 
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 
  Additional Information 3: 0a9e 
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789 
 
Read our privacy statement online: 
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409 

请您参考如下方法:

看来你最近升级了你的浏览器,所以你也需要升级你的driver.exe来兼容。

chromedriver    chrome 
   2.46            71-73 
   2.45            70-72 
   2.44            69-71 
   2.43            69-71 
   2.42            68-70 
   2.41            67-69 
   2.40            66-68 
   2.39            66-68 
   2.38            65-67 
   2.37            64-66 
   2.36            63-65 
   2.35            62-64 
   2.34            61-63 
   2.33            60-62     
   2.28            57 
   2.25            54 
   2.24            53 
   2.22            51 
   2.19            44 
   2.15            42 

Download chrome Driver exe