python 利用火狐浏览器爬取内容

python 利用火狐浏览器抓取
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
caps=webdriver.DesiredCapabilities().FIREFOX
caps['marionette']=False
binary=FirefoxBinary(r"C:\Program Files (x86)\Mozilla Firefox\firefox.exe")

driver=webdriver.Firefox(firefox_binary=binary,capabilities=caps)
driver.get("https://zhidao.baidu.com/question/6169893.html")
comment=driver.find_element_by_class_name("ask-title ")
#content=comment.find_element_by_tag_name('p')
print(comment.text) 



#需要火狐23.0

猜你喜欢

转载自blog.csdn.net/zhengjian1996/article/details/112942120