标签:code 自动化测试 input sele end style css find use
from selenium import webdriver from time import sleep driver=webdriver.Firefox()/Chrome() url=‘E:\\测试\\课件\\Web自动化\\Web自动化课件\\02img\\注册A.html‘ driver.get(url) user=driver.find_element_by_id("userA") user.send_keys("admin") pwd=driver.find_element_by_id("passwordA") pwd.send_keys("123456") driver.find_element_by_class_name("tel").send_keys("13231865645") #find_element_by_tag_name:返回的符合条件的第一个元素 driver.find_element_by_tag_name("input").send_keys("admin") driver.find_element_by_link_text("访问 新浪 网站").click() driver.find_element_by_partial_link_text("访问").click() driver.find_element_by_xpath("//*[@id=‘userA‘]").send_keys("admin") driver.find_element_by_xpath("//*[@id=‘passwordA‘]").send_keys("123456") driver.find_element_by_css_selector("#telA").send_keys("1860000000") driver.find_element_by_css_selector("#emailA").send_keys("123@qq.com") sleep(3) driver.quit()
标签:code 自动化测试 input sele end style css find use
原文地址:https://www.cnblogs.com/fdxhgn/p/13501264.html