Esempio n. 1
0
def getDesiredcaps():
    # 获取desired_caps的配置信息
    pc = ParseConfigFile(desiredcapsFilePath)
    items = pc.getItemsSection("Desired_caps")
    desired_caps = {
        'platformName': items['platformname'],
        'platformVersion': items['platformversion'],
        'deviceName': items['devicename'],
        'appPackage': items['apppackage'],
        'appActivity': items['appactivity'],
        'noReset': True,
        'unicodeKeyboard': True,
        'resetKeyboard': True
    }
    return desired_caps
Esempio n. 2
0
class AppRank(object):
    def __init__(self, driver):
        self.driver = driver
        self.cf = ParseConfigFile(pageElementLocatorPath)
        self.loginOption = self.cf.getItemsSection("APPRank")

    def goHomePageObj(self):
        try:
            locateType, locatorExpression = self.loginOption["APPRank.goHomePage".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e

    def assertAppList(self, assertString):
        try:
            assertStringList = assertString.split(",")
            locateType, locatorExpression = self.loginOption["APPRank.assertKeywordList".lower()].split(">")
            elements = getElements(self.driver, locateType, locatorExpression)
            for element in elements[:3]:
                assert element.text in assertStringList
        except AssertionError as e:
            raise AssertionError(e)
        except Exception as e:
            raise e
Esempio n. 3
0
class SearchPage(object):
    def __init__(self, driver):
        self.driver = driver
        self.cf = ParseConfigFile(pageElementLocatorPath)
        self.searchOption = self.cf.getItemsSection("Search")

    def searchBoxObj(self):
        try:
            locateType, locatorExpression = self.searchOption[
                "Search.searchBox".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e

    def searchInputBoxObj(self):
        try:
            locateType, locatorExpression = self.searchOption[
                "Search.searchInputBox".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e

    def searchBtnObj(self):
        try:
            locateType, locatorExpression = self.searchOption[
                "Search.searchBtn".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e

    def assert_string_in_pagesource(self, assertString):
        # 断言界面源码是否存在某关键字或关键字符串
        try:
            assert assertString in self.driver.page_source, u"%s not found in page source!" % assertString
        except AssertionError as e:
            raise AssertionError(e)
        except Exception as e:
            raise e

    def backObj(self):
        try:
            locateType, locatorExpression = self.searchOption[
                "Search.back".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e

    def goHomePageObj(self):
        try:
            locateType, locatorExpression = self.searchOption[
                "Search.goHomePage".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e
Esempio n. 4
0
class HomePage(object):
    def __init__(self, driver):
        self.driver = driver
        self.cf = ParseConfigFile()
        self.homePageOption = self.cf.getItemsSection("126mail_homepage")

    def homePageObj(self):
        try:
            locateType, locatorExpression = self.homePageOption[
                "homePage.addressBook".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e
Esempio n. 5
0
class LoginPage(object):
    def __init__(self, driver):
        self.driver = driver
        self.cf = ParseConfigFile()
        self.loginOption = self.cf.getItemsSection("126mail_login")

    def framObj(self):
        try:
            locateType, locatorExpression = self.loginOption["loginPage.frame".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e

    def switchToDefaultContent(self):
        self.driver.switch_to.default_content()

    def usernameObj(self):
        try:
            locateType, locatorExpression = self.loginOption["loginPage.userName".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e

    def passwordObj(self):
        try:
            locateType, locatorExpression = self.loginOption["loginPage.passWord".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e

    def loginBtnObj(self):
        try:
            locateType, locatorExpression = self.loginOption["loginPage.loginButton".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e
Esempio n. 6
0
 def __init__(self, driver):
     self.driver = driver
     self.cf = ParseConfigFile(pageElementLocatorPath)
     self.searchOption = self.cf.getItemsSection("Search")
Esempio n. 7
0
 def __init__(self, driver):
     self.driver = driver
     self.cf = ParseConfigFile()
     self.homePageOption = self.cf.getItemsSection("126mail_homepage")
 def __init__(self, driver):
     self.driver = driver
     self.cf = ParseConfigFile()
     self.addContactOption = self.cf.getItemsSection(
         "126mail_addContactsPage")
class AddContactPage(object):
    def __init__(self, driver):
        self.driver = driver
        self.cf = ParseConfigFile()
        self.addContactOption = self.cf.getItemsSection(
            "126mail_addContactsPage")

    def addContactBtn(self):
        try:
            locateType, locatorExpression = self.addContactOption[
                "addContactsPage.createContactBtn".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e

    def contactPersonName(self):
        try:
            locateType, locatorExpression = self.addContactOption[
                "addContactsPage.contactPersonName".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e

    def contactPersonMail(self):
        try:
            locateType, locatorExpression = self.addContactOption[
                "addContactsPage.contactPersonMail".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e

    def starContact(self):
        try:
            locateType, locatorExpression = self.addContactOption[
                "addContactsPage.starContact".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e

    def contactPersonPhone(self):
        try:
            locateType, locatorExpression = self.addContactOption[
                "addContactsPage.contactPersonPhone".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e

    def contactPersonComment(self):
        try:
            locateType, locatorExpression = self.addContactOption[
                "addContactsPage.contactPersonComment".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e

    def saveContactPeron(self):
        try:
            locateType, locatorExpression = self.addContactOption[
                "addContactsPage.saveContactPeron".lower()].split(">")
            elementObj = getElement(self.driver, locateType, locatorExpression)
            return elementObj
        except Exception as e:
            raise e
Esempio n. 10
0
 def __init__(self, driver):
     self.driver = driver
     self.cf = ParseConfigFile(pageElementLocatorPath)
     self.loginOption = self.cf.getItemsSection("APPRank")
Esempio n. 11
0
 def __init__(self, driver):
     self.driver = driver
     self.cf = ParseConfigFile()
     self.loginOption = self.cf.getItemsSection("126mail_login")