webdriver api

2021-07-09 10:08

阅读:559

标签:from   上传   btn   163邮箱   import   round   sub   tps   context   

这个网站: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()

最后,撸起袖子加油干!

webdriver api

标签:from   上传   btn   163邮箱   import   round   sub   tps   context   

原文地址:https://www.cnblogs.com/1510152012huang/p/9706697.html


评论


亲,登录后才可以留言!