自动化测试1
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("") sleep(3) driver.quit()
相关推荐
wikiwater 2020-10-27
IdeaElements 2020-08-19
Sophiego 2020-08-16
Kakoola 2020-08-01
Kakoola 2020-07-29
ELEMENTS爱乐冬雨 2020-07-18
ELEMENTS爱乐小超 2020-07-04
ELEMENTS爱乐小超 2020-07-04
Kakoola 2020-06-28
Feastaw 2020-06-18
Wmeng0 2020-06-14
ELEMENTS爱乐冬雨 2020-06-14
云之高水之远 2020-06-14
哈喽elements 2020-06-14
Feastaw 2020-06-11
阿斌Elements 2020-06-11