selenium--行为链

from selenium import webdriver
import time
from selenium.webdriver.common.action_chains import ActionChains

## 知乎
diver = webdriver.Chrome()
diver.get('https://www.zhihu.com/signin?next=%2Fcreator')


actions = ActionChains(diver)
denglu_tag = diver.find_elements_by_class_name("SignFlow-tab")[1]
actions.move_to_element(denglu_tag)
actions.click(denglu_tag)
actions.perform()
time.sleep(1)

username_tag = diver.find_element_by_name('username')
password_tag = diver.find_element_by_name('password')
button_tag = diver.find_element_by_class_name('SignFlow-submitButton')

actions.move_to_element(username_tag)
actions.send_keys_to_element(username_tag,"13550788747")
actions.move_to_element(password_tag)
actions.send_keys_to_element(password_tag,'XQS518hh')
actions.move_to_element(button_tag)
actions.click(button_tag)
actions.perform()
上一篇:std::move和右值引用


下一篇:ros学习(4)