使用selenium学习

要使用selenium

pip install selenium

查看当前谷歌浏览器版本

找到对应版本下载webdriver:http://chromedriver.storage.googleapis.com/index.html

上代码

import time
from selenium import webdriver
driver=webdriver.Chrome()

driver.get('http://demo.ranzhi.org')
time.sleep(3)

we_account=driver.find_element_by_css_selector('#account')
we_account.clear()
we_account.send_keys('demo')

we_password=driver.find_element_by_css_selector('#password')
we_password.clear()
we_password.send_keys('demo')

driver.find_element_by_css_selector('#submit').click()
time.sleep(3)

 

不知道为什么我这个python3不能执行,python2才行

之后还可以看一看还有什么别的操作

感谢

 

 

https://www.ibm.com/developerworks/cn/web/1306_chenlei_webdriver/index.html

https://selenium-python.readthedocs.io/installation.html#introduction

https://blog.csdn.net/zhouxuan623/article/details/47439531

posted @ 2020-03-05 20:53  z2011  阅读(107)  评论(0编辑  收藏  举报