自动化测试1

Feastaw 2020-08-17

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()

相关推荐

ELEMENTS爱乐冬雨 / 0评论 2020-05-29