Exemplo n.º 1
0
 def switch_frame(self):
     '''切换frame'''
     # i_frame = find_element(self.driver, 'tag name', 'iframe')
     # Log.debug('切换frame')
     login_type, value = self.parse.getOptionValue('163mail_login', 'login_page.frame').split(":")
     i_frame = find_element(self.driver, login_type, value)
     self.driver.switch_to.frame(i_frame)
Exemplo n.º 2
0
 def click_login(self):
     '''点击登录按钮'''
     # find_element(self.driver, 'id', 'dologin').click()
     login_type, value = self.parse.getOptionValue('163mail_login', 'login_page.loginbutton').split(":")
     find_element(self.driver, login_type, value).click()
Exemplo n.º 3
0
 def input_passpord(self, password):
     '''输入密码'''
     # find_element(self.driver, 'name', 'password').send_keys(password)
     login_type, value = self.parse.getOptionValue('163mail_login', 'login_page.password').split(":")
     find_element(self.driver, login_type, value).send_keys(password)
Exemplo n.º 4
0
 def input_username(self, username):
     '''输入用户名'''
     # find_element(self.driver, 'name', 'email').send_keys(username)
     login_type, value = self.parse.getOptionValue('163mail_login', 'login_page.username').split(":")
     find_element(self.driver, login_type, value).send_keys(username)
Exemplo n.º 5
0
 def switch_accountlogin(self):
     '''切换登录方式'''
     # find_element(self.driver, 'id', 'switchAccountLogin').click()
     # Log.debug('切换登录方式')
     login_type, value = self.parse.getOptionValue('163mail_login','login_page.switchbutton').split(":")
     find_element(self.driver, login_type, value).click()
Exemplo n.º 6
0
from util.find_element import find_element

from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://mail.163.com/')
driver.maximize_window()

# driver.find_element_by_id("switchAccountLogin").click()
# # driver.switch_to.frame("x-URS-iframe1585316015217.1082")
# iframe = driver.find_element_by_tag_name('iframe')
# driver.switch_to.frame(iframe)
# driver.find_element_by_name('email').send_keys('zhangming002')
# driver.find_element_by_name('password').send_keys('zmkmzmkm')
# driver.find_element_by_id("dologin").click()

find_element(driver, 'id', 'switchAccountLogin').click()
iframe = find_element(driver,'tag name', 'iframe')
driver.switch_to.frame(iframe)

find_element(driver, 'name', 'email').send_keys('zhangming002')
find_element(driver, 'name', 'password').send_keys('zmkmzmkm')
find_element(driver, 'id', 'dologin').click()


#page object PO
# 一个页面,看做事一个类,我们通过对象提供的API,找到元素,

# 自动化脚本分成三层
# 1. 对象层  用于存放页面元素定位和 控件操作
# 2. 逻辑层  封装一些常用的功能模块,登录功能
# 3. 业务层  真正的测试用例操作部分