美文网首页
splinter与chrome的故事

splinter与chrome的故事

作者: 敢想敢做_ | 来源:发表于2017-10-06 23:53 被阅读0次

Splinter是一个使用Python开发的开源Web应用测试工具。它可以帮你实现自动浏览站点和与其进行交互。

可是splinter默认支持浏览器firefox,对于我这种常年chrome用户真是不友好,这意味着我想用它就要自己下载浏览器驱动,可谓困难重重。

第一步:选择适合你浏览器版本的驱动
驱动下载地址:http://chromedriver.storage.googleapis.com/index.html
版本问题:我的v60用v2.30刚好, 不知道版本问题的时候,各种折腾各种报错差点放弃

来自别人的博客
第二步:下载解压完成后直接将chromedriver.exe复制到C:\Windows\System32
试一了下将chromedriver放在其他地方将其路径加入环境变量Path中并不可行,有的博客说可以这样,昨天各种都试了,可能是操作不对,一直是要么***** is needed in Path 要么权限不对(心累)。
最后,可以做想做的事了:
splinter库能用了
from splinter.browser import Browser
b=Browser(driver_name="chrome")
b.visit("http://wwww.baidu.com")

不仅如此

from selenium import webdriver
driver=webdriver.Chrome()
driver.get("http://www.baidu.com")
print(driver.title)
driver.quit()

百度一下,你就知道

昨天准备上手的selenium库也成功了

万里长征第一步!!!!

相关文章

网友评论

      本文标题:splinter与chrome的故事

      本文链接:https://www.haomeiwen.com/subject/otwryxtx.html