Esempio n. 1
0
 def __init__(self, driver):
     self.register_handle = RegisterHandle(driver)
     self.driver = driver
     self.ini = ReadIni()
     self.txt = WriteTxt()
     self.register = RegisterBusiness(self.driver)
     self.register_page = RegisterPage(driver)
     self.fill_data_handle = FillDataHandle(driver)
     self.driver.implicitly_wait(20)
Esempio n. 2
0
 def get_local_config(self, local_config):
     """
     读取配置文件
     :param local_config: 配置文件的key
     :return: 返回值的list
     """
     read_ini = ReadIni()
     ini = read_ini.get_value_tuple(local_config)
     return ini
Esempio n. 3
0
 def get_element(self, file_path, section, key):
     read_ini = ReadIni(file_path)
     local = read_ini.get_value(section, key)
     by = local.split('>')[0]
     local_by = local.split('>')[1]
     if by == 'id':
         return self.driver.find_element_by_id(local_by)
     elif by == 'className':
         return self.driver.find_element_by_class_name(local_by)
     else:
         return self.driver.find_element_by_xpath(local_by)
Esempio n. 4
0
	def __init__(self,driver):
		self.login_handle = LoginHandle(driver)
		self.driver = driver
		self.ini = ReadIni()
		self.txt = WriteTxt()
		self.login_page = LoginPage(driver)
		self.username = self.ini.get_value('username','login_value')
		self.password = self.ini.get_value('password','login_value')
		self.error_username = self.ini.get_value('error_username', 'login_value')
		self.error_pwd = self.ini.get_value('error_pwd', 'login_value')
		self.mt4 = self.ini.get_value('mt4id','login_value')
		self.error_mt4 = self.ini.get_value('error_mt4id','login_value')
		self.driver.implicitly_wait(15)
Esempio n. 5
0
 def get_element(self, key):
     read_ini = ReadIni()
     data = read_ini.get_value(key)
     by = data.split('>')[0]
     value = data.split('>')[1]
     try:
         if by == 'id':
             return self.driver.find_element_by_id(value)
         elif by == 'name':
             return self.driver.find_element_by_name(value)
         elif by == 'className':
             return self.driver.find_element_by_class_name(value)
         else:
             return self.driver.find_element_by_xpath(value)
     except:
         self.driver.save_screenshot(
             'F:\Pycharm\muke\POpractice\image\%s.png' % value)
         return None
Esempio n. 6
0
 def __init__(self, driver):
     self.register_handle = RegisterHandle(driver)
     self.driver = driver
     self.ini = ReadIni()
     self.txt = WriteTxt()
     self.register_page = RegisterPage(driver)
     self.login_handle = LoginHandle(driver)
     self.phone = self.ini.get_value('phone', 'register_input_value')
     self.verification_code = self.ini.get_value('Verification_Code',
                                                 'register_input_value')
     self.mail = self.ini.get_value('mail', 'register_input_value')
     self.call = self.ini.get_value('call', 'register_input_value')
     self.pwd = self.ini.get_value('pwd', 'register_input_value')
     self.confirm_pwd = self.ini.get_value('confirm_pwd',
                                           'register_input_value')
     self.introducer = self.ini.get_value('introducer',
                                          'register_input_value')
     self.driver.implicitly_wait(20)
 def android_driver(self, i):
     ini = ReadIni(
         node="server_port",
         file_name=
         r"D:\测试\自动化测试\App自动化测试\appium--慕课网登录模块\config\userconfig.ini")
     deviceName = ini.get_value("devices" + str(i))
     port = ini.get_value("appium_port" + str(i))
     capabilities = {
         "platformName": "Android",
         # "automationName": "UiAutomator2",
         "deviceName": deviceName,
         "app": "D:\\测试\\APPnium\\mukewang.apk",
         "noReset": "true"
     }
     driver = webdriver.Remote("127.0.0.1:" + port + "/wd/hub",
                               capabilities)
     time.sleep(5)
     return driver
Esempio n. 8
0
 def __init__(self, pass_list, fail_list,error_list):
     self.pass_list = pass_list
     self.fail_list = fail_list
     self.error_list = error_list
     self.reportname = self.new_report()
     self.read_ini = ReadIni()
Esempio n. 9
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2019/9/9 22:37
# @Author  : Mandy
import conftest
from utils.read_ini import ReadIni

read = ReadIni(conftest.env_dir)


class CommonUrl:
    def __init__(self):
        self.user_register_url = self.join_url('/user/register')
        self.user_register_url = self.join_url('/user/register')
        self.user_info_url = self.join_url('/user/info')
        self.user_edit_info_url = self.join_url('/user/editInfo')
        self.user_edit_gender_url = self.join_url('/user/editFavGender')
        self.user_basic_info_url = self.join_url('/user/basic')

    def join_url(self, test_url):
        base_url = read.get_value('base_url', 'api')
        url = base_url + test_url
        return url


common = CommonUrl()
print(common.user_register_url)
Esempio n. 10
0
#coding:utf-8
from selenium import webdriver
from utils.read_ini import ReadIni
from base.find_element import FindElement

read_ini = ReadIni("User")
user = read_ini.get_value("user")
pwd = read_ini.get_value("pwd")

class LoginFunction(object):
    def __init__(self,url):
        self.driver = self.get_driver(url)

    def get_driver(self,url):
        driver = webdriver.Chrome()
        driver.get(url)
        driver.maximize_window()
        return driver

    #输入用户信息
    def send_user_info(self,element,data):
        element.send_keys(data)

    #定位用户信息
    def get_user_element(self,key):
        find_element = FindElement(self.driver)
        user_element = find_element.get_element(key)
        return user_element

    def main(self):
        eles = self.get_user_element('user_name')
Esempio n. 11
0
 def __init__(self):
     self.excel = OperationExcel()
     self.data_config = global_var()
     self.read = ReadIni(conftest.env_dir)
     self.op_json = OperationJson()
Esempio n. 12
0
 def __init__(self):
     self.dos = DosCmd()
     self.ini = ReadIni(
         file_name=
         r"D:\测试\自动化测试\App自动化测试\appium--慕课网登录模块\config\userconfig.ini")
Esempio n. 13
0
 def get_local_config(self, local_config, node=None, file_name=None):
     read_ini = ReadIni(node=node, file_name=file_name)
     info = read_ini.get_value_tuple(local_config)
     return info