欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程语言 > python >内容正文

python

python+selenium中webdriver相关资源

发布时间:2025/3/21 python 8 豆豆
生活随笔 收集整理的这篇文章主要介绍了 python+selenium中webdriver相关资源 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

Chrome

chrome的webdriver :  http://chromedriver.storage.googleapis.com/index.html

chrome的webdriver需要对应chrome版本下载, 不同版本之间可能会出现不兼容情况.

 

Firefox

Firefox的webdriver : https://github.com/mozilla/geckodriver/releases/

Firefox的webdriver下载最新的即可.

 

IE

IE的webdriver : http://selenium-release.storage.googleapis.com/index.html

IE的webdriver建议下载32位驱动,64位windows系统也可使用32位驱动.  不推荐64位驱动的原因在于, 已知bug中, 在对网页元素输入字符串时速度极慢,如用下列代码时, 第13行键入字符串时, fengh.ssc需要耗时10秒.

1 def login(name='fengh.ssc', password='bob0.0.8'): 2 '''登录fss系统''' 3 global gl_driver 4 gl_driver = webdriver.Firefox() 5 gl_driver.maximize_window() 6 gl_driver.get("http://fss.sinopec.com") 7 if "财务共享自助服务" in gl_driver.title: 8 system = gl_driver.find_element_by_id('systemId') 9 system.click() 10 system.send_keys(Keys.PAGE_UP, Keys.ENTER) 11 user = gl_driver.find_element_by_name("loginnamesrc") 12 user.clear() 13 user.send_keys(name, Keys.TAB, password, Keys.ENTER) 14 # password = gl_driver.find_element_by_name('passwordsrc')#passwordsrc命名重复,无法定位 15 else: 16 print("请检查网络是否正常")

 

 

 

 

 

转载于:https://www.cnblogs.com/feng-hao/p/10823496.html

《新程序员》:云原生和全面数字化实践50位技术专家共同创作,文字、视频、音频交互阅读

总结

以上是生活随笔为你收集整理的python+selenium中webdriver相关资源的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。