API自动化测试练习

from selenium import webdriver
import time as t
"""验证账号"""
# # driver=webdriver.Chrome()
# # driver.maximize_window()
# # driver.get(‘https://mail.163.com/‘)
# # driver.switch_to.frame(0)
# # driver.find_element_by_id(‘dologin‘).click()
# # t.sleep(2)
# # derText=driver.find_element_by_class_name(‘ferrorhead‘).text
# # assert derText==‘请输入帐号‘
# # t.sleep(3)
# # driver.quit()
#
# """验证10天内免登录"""
# # driver=webdriver.Chrome()
# # driver.maximize_window()
# # driver.get(‘https://mail.163.com/‘)
# # driver.switch_to.frame(0)
# # TEXT=driver.find_element_by_id(‘un-login‘)
# # assert TEXT.is_selected()==False
# # t.sleep(3)
# # driver.quit()

"""验证密码为空"""
# driver=webdriver.Chrome()
# driver.maximize_window()
# driver.get(‘https://mail.163.com/‘)
# driver.switch_to.frame(0)
# driver.find_element_by_name(‘email‘).send_keys(‘2327829391‘)
# t.sleep(2)
# driver.find_element_by_id(‘dologin‘).click()
# t.sleep(2)
# devText=driver.find_element_by_class_name(‘ferrorhead‘)
# t.sleep(4)
# assert devText.text==‘请输入密码‘
# t.sleep(2)
# driver.quit()

"""验证超链接(切换)"""
# driver=webdriver.Chrome()
# driver.maximize_window()
# driver.get(‘https://mail.163.com/‘)
# nowHandler=driver.current_window_handle
# #点击注册网易邮箱
# driver.find_element_by_link_text(‘注册网易邮箱‘).click()
# t.sleep(3)
# allHandler=driver.window_handles
# for handler in allHandler:
# 	if handler!=nowHandler:
# 		driver.switch_to.window(handler)
# 		url=driver.current_url
# 		assert url.endswith(‘source=163mail‘)==True
# 		driver.close()
# driver.switch_to.window(nowHandler)
# t.sleep(3)
# driver.quit()



"""忘记密码"""
# driver=webdriver.Chrome()
# driver.maximize_window()
# driver.get(‘https://mail.163.com/‘)
# nowHandler=driver.current_window_handle
# driver.switch_to.frame(0)
# #点击忘记密码
# driver.find_element_by_link_text(‘忘记密码?‘).click()
# t.sleep(3)
# alld=driver.window_handles
# for hand in alld:
# 	if hand!=nowHandler:
# 		driver.switch_to.window(hand)
# 		ur=driver.current_url
# 		assert ur.endswith(‘verifyAccount‘)==True
# 		driver.close()
# driver.switch_to.window(nowHandler)
# t.sleep(3)
# driver.quit()

"""二维码登陆"""
# driver=webdriver.Chrome()
# driver.maximize_window()
# driver.get(‘https://mail.163.com/‘)
# driver.find_element_by_id(‘lbApp‘).click()
# t.sleep(3)
# test0=driver.find_element_by_xpath(‘//*[@id="appLoginTab"]/h2‘)
# assert test0.text==‘手机扫码 安全登录‘
# t.sleep(3)
# driver.find_element_by_xpath(‘//*[@id="qrcodeLoginAppLink"]‘).click()
# t.sleep(2)
# driver.switch_to.window()
# t.sleep(3)
# driver.quit()

  

API自动化测试练习

上一篇:关于获取windows系统参数方法


下一篇:天正建筑CAD右侧的修改栏不见了怎么办?怎么调出来?