예제 #1
0
    def exception_handle(self):
        self.black_words = [
            self.byAttribute(text="好的"),
            self.byAttribute(text="下次再说")
        ]

        for w in self.black_words:
            elements = Appium.getDriver().find_elements(By.XPATH, w)
            if len(elements) > 0:
                elements[0].click()
                return Appium.getDriver().find_element(By.XPATH, w)
예제 #2
0
    def exception_handle2(self):
        self.black_words = [
            self.byAttribute(text="好的"),
            self.byAttribute(text="下次再说")
        ]

        #todo: 优化弹框处理逻辑,发现toast,自动发现兼容性问题等。。。
        page_source = Appium.getDriver().page_source
        print(page_source)
        #parser = etree.XMLParser(encoding='utf-8')
        xml = etree.XML(str(page_source).encode("utf-8"))
        for w in self.black_words:
            print(w)
            if (len(xml.xpath(w)) > 0):
                Appium.getDriver().find_element(By.XPATH, w).click()
 def setUp(self):
     #todo: 数据的初始化
     Appium.initDriver()
     self.xueqiu = Xueqiu()
     self.stock = self.xueqiu.toPortfolio()
 def setUp(self):
     Appium.initDriver()
     print(Appium.driver)
예제 #5
0
 def __init__(self):
     Appium.initDriver()
예제 #6
0
 def __init__(self):
     Appium.init_driver()
     self.driver = Appium.get_driver()
     self.driver.implicitly_wait(10)  # 隐式等待10秒
     self.logger = log()
예제 #7
0
 def findAll(self, locate) -> []:
     return Appium.getDriver().find_elements(*locate)
예제 #8
0
 def findBy(self, by=By.ID, value=None):
     try:
         return Appium.getDriver().find_element(by, value)
     except:
         self.exception_handle2()
         return Appium.getDriver().find_element(by, value)