码迷,mamicode.com
首页 > 编程语言 > 详细

[python] python+selenium+webdriver

时间:2020-06-04 14:02:48      阅读:547      评论:0      收藏:0      [点我收藏+]

标签:end   ble   enum   rom   web   sele   pytho   ber   send   

1. install python, set environment variables.

2. pip install selenium

3. 下载与自己浏览器版本匹配的chrome webdriver, 放到python.exe同目录(python安装目录)。

http://npm.taobao.org/mirrors/chromedriver/

http://chromedriver.storage.googleapis.com/index.html

4. call webdriver.

>>> import selenium
>>> from selenium import webdriver
>>> browser=webdriver.Chrome()

DevTools listening on ws://127.0.0.1:55004/devtools/browser/c87418a6-14a3-4054-86d0-700674958922
[6520:20152:0604/123552.662:ERROR:device_event_log_impl.cc(208)] [12:35:52.662] Bluetooth: bluetooth_adapter_winrt.cc:1191 Getting Radio failed. Chrome will be unable to change the power state by itself.
[6520:20152:0604/123552.721:ERROR:device_event_log_impl.cc(208)] [12:35:52.720] Bluetooth: bluetooth_adapter_winrt.cc:1269 OnPoweredRadioAdded(), Number of Powered Radios: 1
[6520:20152:0604/123552.722:ERROR:device_event_log_impl.cc(208)] [12:35:52.722] Bluetooth: bluetooth_adapter_winrt.cc:1284 OnPoweredRadiosEnumerated(), Number of Powered Radios: 1
>>> browser.get("http://www.baidu.com")
>>> browser.find_element_by_id(‘kw‘).send_keys(‘hello world‘)
>>> browser.find_element_by_id(‘su‘).click()
>>> browser.close()

[python] python+selenium+webdriver

标签:end   ble   enum   rom   web   sele   pytho   ber   send   

原文地址:https://www.cnblogs.com/buptqq/p/13042859.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!