这个网站:https://www.cnblogs.com/101718qiong/p/8250104.html总结的很好
上传几篇几天的学习
前进和后退
from selenium import webdriver import time driver = webdriver.Chrome() first_url = "http://www.ibdata.cn" driver.get(first_url) time.sleep(3) second_url = "http://www.ibdata.cn/#!/search" driver.get(second_url) time.sleep(3) driver.back() time.sleep(3) driver.forward() time.sleep(3) driver.quit() 163邮箱登陆
from selenium import webdriver import time driver = webdriver.Chrome() driver.get("http://mail.163.com/index_alternate.htm") driver.find_element_by_name("username").send_keys("182....1209") driver.find_element_by_name("password").send_keys(".......") driver.find_element_by_id("loginBtn").click() time.sleep(5) driver.quit() 回车键的使用
from selenium import webdriver driver = webdriver.Chrome() driver.get("http://www.youdao.com") driver.find_element_by_name("q").send_keys("hello") driver.find_element_by_name("q").submit() driver.quit() 鼠标的使用
from selenium import webdriver from selenium.webdriver import ActionChains driver = webdriver.Chrome() driver.get("http://news.baidu.com") right_click = driver.find_element_by_class_name("help") ActionChains(driver).context_click(right_click).perform() driver.quit() 最后,撸起袖子加油干!