Exemplo n.º 1
1
def dbl_click_item(id=id, save_screenshot=False, save_screenshot_file=None, max_retry=3):
    _wait_for_id(id=id, save_screenshot=save_screenshot,
                 save_screenshot_file=save_screenshot_file)
    element = driver.find_element_by_id(id)

  

    if platform == 'android':
        actions = TouchActions(driver)
        actions.double_tap(element)

    retry_count = 1
    while retry_count <= max_retry:
        try:
            if platform == 'ios':
                # Fix TBD
                log ('Hacky iOS double tap to a fixed location')
                driver.execute_script('mobile: doubleTap', {'x':200, 'y':200})
            else:
                actions.perform()
        except Exception as e:
            log('action error, try #{}...'.format(retry_count))
            log ('Error reported was: '+str(e))
            retry_count = retry_count + 1
            sleep(2)
        else:
            retry_count = max_retry + 1
            pass
Exemplo n.º 2
0
    def test_contexts_list(self):
        el = self.driver.find_element_by_class_name('android.widget.ListView')
        els = el.find_elements_by_class_name('android.widget.TextView')

        ta = TouchActions(self.driver).flick_element(el, 0, -300, 0)
        ta.perform()
        sleep(5)
Exemplo n.º 3
0
 def test_contexts_list(self):
     el = self.driver.find_element_by_class_name('android.widget.ListView')
     els = el.find_elements_by_class_name('android.widget.TextView')
     pdb.set_trace()
     ta = TouchActions(self.driver).flick_element(el, 0, -300, 0)
     ta.perform()
     sleep(5)
Exemplo n.º 4
0
Arquivo: o2oA.py Projeto: chaonin/aaba
 def _pw_click(self, x, y):
     # Perform click in password input mode
     touch_actions = TouchActions(self.driver)
     touch_actions.tap_and_hold(x, y)
     touch_actions.release(x, y)
     touch_actions.perform()
     return 1
Exemplo n.º 5
0
    def download(self, number):
        # Проверяем кол-во картинок
        assert number < 1000, "Так делать не стоит!"
        # Создаем объект для работы с окружением картинок
        touch_act = TouchActions(self.driver)

        # Берем первую картинку и нажимаем на нее
        elem = self.driver.find_element_by_class_name("rg_i")
        touch_act.tap(elem)
        touch_act.perform()

        # Выполняем процедуру сохранения
        for _ in range(number):
            pyautogui.press('apps')
            pyautogui.press('esc')
            time.sleep(1)
            pyautogui.press('apps')
            for _ in range(7):
                pyautogui.press('down')

            pyautogui.press('enter')
            time.sleep(2)
            pyautogui.press('enter')
            time.sleep(5)
            pyautogui.press('right')
Exemplo n.º 6
0
 def swipe_left(self, duration=1):
     WebDriverWait(self, 10).until(
         ExpectedConditions.presence_of_element_located(
             (By.ID, self.get_element_id("drag_area"))))
     pager = self.find_element_by_id('drag_area')
     flick = TouchActions(self).flick_element(pager, -1000, 0, 70)
     flick.perform()
Exemplo n.º 7
0
def dbl_click_item(id=id,
                   save_screenshot=False,
                   save_screenshot_file=None,
                   max_retry=3):
    _wait_for_id(id=id,
                 save_screenshot=save_screenshot,
                 save_screenshot_file=save_screenshot_file)
    element = driver.find_element_by_id(id)

    if platform == 'android':
        actions = TouchActions(driver)
        actions.double_tap(element)

    retry_count = 1
    while retry_count <= max_retry:
        try:
            if platform == 'ios':
                # Fix TBD
                log('Hacky iOS double tap to a fixed location')
                driver.execute_script('mobile: doubleTap', {
                    'x': 200,
                    'y': 200
                })
            else:
                actions.perform()
        except Exception as e:
            log('action error, try #{}...'.format(retry_count))
            log('Error reported was: ' + str(e))
            retry_count = retry_count + 1
            sleep(2)
        else:
            retry_count = max_retry + 1
            pass
    def click(self, target, analysis=None):
        """ Implements as single tap for WinAppDriver
        
        Due to the inconsistency with Polaris touch behavior, a touch tap is actually implemented as 
        touch and hold, wait then release.
        
        If Polaris touch response if fixed, this should revert back to a simple tap call to WinAppDriver
        """

        if analysis:
            analysis('start')

        touch = TouchActions(self)
        touch.tap(target)
        touch.perform()

        if analysis:
            for i in range(1, 10):
                if not analysis('stop'):
                    touch.perform()
                else:
                    logger.warn(
                        "Trouble interacting with {0}.  Required {1} additional clicks to activate"
                        .format(target.get_attribute('AutomationId'), i))
                    return

            raise AssertionError('Unable to validate click after 10 tries')
 def scrolling_actions(self):
     """
     An implementation on the scroll action using WinAppDriver, however currently winappdriver doesn't seem to support mouse scrolling.
     Not used because of the afor mentioned reasons.
     :return:
     """
     tactions = TouchActions(self.SABL.ret_driver())
     tactions.scroll(10, 10)
     tactions.perform()
Exemplo n.º 10
0
 def test_slider(self):
     # go to controls
     self._open_menu_position(1)
     # get the slider
     slider = self.driver.find_element_by_tag_name("slider")
     self.assertEqual(slider.get_attribute("value"), "50%")
     drag = TouchActions(self.driver)
     drag.flick_element(slider, -0.5, 0, 0)
     drag.perform()
     self.assertEqual(slider.get_attribute("value"), "0%")
Exemplo n.º 11
0
 def test_slider(self):
     # go to controls
     self._open_menu_position(1)
     # get the slider
     slider = self.driver.find_element_by_tag_name("slider")
     self.assertEqual(slider.get_attribute("value"), "50%")
     drag = TouchActions(self.driver)
     drag.flick_element(slider, -0.5, 0, 0)
     drag.perform()
     self.assertEqual(slider.get_attribute("value"), "0%")
Exemplo n.º 12
0
def _scroll(context, direction, percentage=50):
    """
    :type context: HackedContext
    """
    if isinstance(context.driver, iOSWebDriver):
        context.driver.swipe(direction, percentage)
    else:
        touch_action = TouchActions(context.driver).tap_and_hold(directions[direction][0][0], directions[direction][0][1])
        touch_action.move(directions[direction][1][0], directions[direction][1][1])
        touch_action.release(directions[direction][1][0], directions[direction][1][1])
        touch_action.perform()
Exemplo n.º 13
0
 def test_scroll(self):
     # scroll menu
     # get initial third row location
     row = self.driver.find_elements_by_tag_name("tableCell")[2]
     location1 = row.location
     # perform swipe gesture
     swipe = TouchActions(self.driver).flick(0, -20)
     swipe.perform()
     # get new row coordinates
     location2 = row.location
     self.assertEqual(location1['x'], location2['x'])
     self.assertNotEqual(location1['y'], location2['y'])
Exemplo n.º 14
0
 def test_scroll(self):
     # scroll menu
     # get initial third row location
     row = self.driver.find_elements_by_tag_name("tableCell")[2]
     location1 = row.location
     # perform swipe gesture
     swipe = TouchActions(self.driver).flick(0, -20)
     swipe.perform()
     # get new row coordinates
     location2 = row.location
     self.assertEqual(location1['x'], location2['x'])
     self.assertNotEqual(location1['y'], location2['y'])
Exemplo n.º 15
0
 def test(self):
     sleep(0.5)
     self.logger.log("************************************")
     sleep(0.5)
     self.logger.log('Contact test initialized', 'yellow')
     self.logger.log("************************************", 'green')
     self.appium_worker.entrance_android()
     self.logger.log("Clicking left sub-menu")
     self.driver.find_element_by_id("drawer_indicator").click()
     sleep(1)
     drawer = self.appium_worker.submenu()
     if drawer == 2:
         self.logger.log("Scrolling up the screen")
         element2 = self.driver.find_element_by_class_name(
             "android.widget.ListView")
         touch_actions = TouchActions(self.driver)
         touch_actions.flick_element(element2, 0, 1000, 100).perform()
         touch_actions.perform()
         sleep(1)
     self.logger.log("Scrolling down")
     element2 = self.driver.find_element_by_class_name(
         "android.widget.RelativeLayout")
     touch_actions = TouchActions(self.driver)
     touch_actions.flick_element(element2, 0, -1000, 100).perform()
     touch_actions.perform()
     sleep(1)
     self.logger.log("Clicking Contact")
     self.driver.find_elements_by_class_name(
         "android.widget.LinearLayout")[16].click()
     self.appium_worker.bekle_android("tvSupport")
     m1 = self.driver.find_element_by_id("tvAddress").text
     m2 = self.driver.find_element_by_id("tvFax").text
     m3 = self.driver.find_element_by_id("tvPhoneNumber").text
     m4 = self.driver.find_element_by_id("tvEmail").text
     self.logger.log("Address: " + m1, 'blue')
     self.logger.log("Fax: " + m2, 'blue')
     self.logger.log("Phone: " + m3, 'blue')
     self.logger.log("Mail: " + m4, 'blue')
     self.logger.log("Clicking Support button")
     self.driver.find_element_by_id("tvSupport").click()
     sleep(2)
     self.logger.log("Going back")
     self.driver.back()
     self.logger.log("Clicking New Message")
     self.driver.find_element_by_id("tvNewMessage").click()
     self.logger.log("Going back")
     self.driver.back()
     sleep(2)
     self.driver.back()
     self.logger.log("TEST FINISHED", "green", 1, 2,
                     self.appium_worker.logger.getFileName())
Exemplo n.º 16
0
    def Tap_App(cls):
        log.step_normal("Element [%s]: Do Tap_App()" % cls.__name__)

        # cls.__wait()
        WebDriverWait(env.driver, 10).until(lambda the_driver:
                                            the_driver.find_element(cls.by, cls.value).is_displayed())
        element = env.driver.find_elements(cls.by, cls.value)

        actions = TouchActions(env.driver)
        actions.tap(element)
        actions.perform()

        time.sleep(3)
        cls.__clearup()
Exemplo n.º 17
0
    def Tap_App(cls):
        log.step_normal("Element [%s]: Do Tap_App()" % cls.__name__)

        # cls.__wait()
        WebDriverWait(env.driver,
                      10).until(lambda the_driver: the_driver.find_element(
                          cls.by, cls.value).is_displayed())
        element = env.driver.find_elements(cls.by, cls.value)

        actions = TouchActions(env.driver)
        actions.tap(element)
        actions.perform()

        time.sleep(3)
        cls.__clearup()
Exemplo n.º 18
0
    def LongClickList_App(cls):
        log.step_normal("Element [%s]: Do LongClickList_App()" % cls.__name__)

        # cls.__wait()
        WebDriverWait(env.driver, 10).until(lambda the_driver:
                                            the_driver.find_element(cls.by, cls.value).is_displayed())
        elements = env.driver.find_elements(cls.by, cls.value)
        rd = random.randint(0, len(elements)-1)

        actions = TouchActions(env.driver)
        actions.long_press(elements[rd])
        actions.perform()

        time.sleep(3)
        cls.__clearup()
Exemplo n.º 19
0
    def LongClickList_App(cls):
        log.step_normal("Element [%s]: Do LongClickList_App()" % cls.__name__)

        # cls.__wait()
        WebDriverWait(env.driver,
                      10).until(lambda the_driver: the_driver.find_element(
                          cls.by, cls.value).is_displayed())
        elements = env.driver.find_elements(cls.by, cls.value)
        rd = random.randint(0, len(elements) - 1)

        actions = TouchActions(env.driver)
        actions.long_press(elements[rd])
        actions.perform()

        time.sleep(3)
        cls.__clearup()
    def double_tap(self):
        """。
            Summary:
                双击点赞/取消点赞
        """
        log.logger.info("开始双击")
        # x = self._layout_view.size['width']/2
        # y = self._layout_view.size['height']/2
        # opts = {
        #     'element': self._layout_view.id,
        #     'x': x,
        #     'y': y,
        #     'tapCount': 2.0,
        # }
        # self.base_parent.execute_script('mobile:tap', opts)

        tc = TouchActions(self.base_parent)
        tc.double_tap(self._layout_view)
        tc.perform()

        log.logger.info("双击完毕")
        time.sleep(2)
Exemplo n.º 21
0
 def test(self):
     sleep(0.5)
     self.logger.log("************************************")
     sleep(0.5)
     self.logger.log('Settings test initialized', 'yellow')
     sleep(0.5)
     self.logger.log("************************************", 'green')
     self.appium_worker.entrance_android()
     self.appium_worker.bekle_android("drawer_indicator")
     self.driver.find_element_by_id("drawer_indicator").click()
     sleep(1)
     self.logger.log("Scrolling down")
     element2 = self.driver.find_element_by_class_name(
         "android.widget.RelativeLayout")
     touch_actions = TouchActions(self.driver)
     touch_actions.flick_element(element2, 0, -1000, 100).perform()
     touch_actions.perform()
     sleep(1)
     self.logger.log("Clicking Settings")
     self.driver.find_elements_by_class_name(
         "android.widget.LinearLayout")[15].click()
     sleep(1)
     self.logger.log("Clicking to change language")
     self.driver.find_element_by_id("tvLanguage").click()
     sleep(1)
     self.logger.log("Language changed to : " + self.logger.funct_decode(
         self.driver.find_element_by_id("tvLanguage").text))
     if self.logger.funct_decode(
             self.driver.find_element_by_id(
                 "tvLanguage").text) != "English":
         self.driver.find_element_by_id("tvLanguage").click()
     self.appium_worker.screenshot("Language_changed")
     el1 = self.driver.find_element_by_id("cbSms")
     el1.click()
     self.driver.find_element_by_id("cbNewsletter").click()
     self.driver.back()
     self.logger.log("TEST FINISHED", "green", 1, 2,
                     self.appium_worker.logger.getFileName())
    def double_click(self, target, analysis=None):
        """ Implements double click as double tap for WinAppDriver
        """

        if analysis:
            analysis('start')

        logger.info('Tapped {0}'.format(target.get_attribute('AutomationId')),
                    also_console=PolarisInterface.output_console)

        touch = TouchActions(self)
        touch.double_tap(target).perform()

        if analysis:
            for i in range(1, 10):
                if not analysis('stop'):
                    touch.perform()
                else:
                    logger.warn(
                        "Trouble interacting with {0}.  Required {1} additional clicks to activate"
                        .format(target.get_attribute('AutomationId'), i))
                    return

            raise AssertionError('Unable to validate click after 10 tries')
Exemplo n.º 23
0
    def test(self):

        self.appium_worker.entrance_ios()
        flag1 = 0
        while flag1 == 0:
            try:
                self.driver.find_element_by_xpath(
                    "//UIAApplication[1]/UIAWindow[1]/UIATabBar[1]/UIAButton[5]"
                )
                flag1 = 1
            except NoSuchElementException:
                flag1 = 0
                self.logger.log("Wait")
                sleep(1)
        self.logger.log("Clicking My Profile")
        self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[1]/UIATabBar[1]/UIAButton[5]"
        ).click()
        sleep(1)
        #m1 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIATextField[1]").text
        #self.logger.log("Name of user : "******"//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIATextField[2]").text
        #self.logger.log("Birthday is : " + m2)
        #m3 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAStaticText[1]").text
        #m4 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAStaticText[2]").text
        #m5 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAStaticText[3]").text
        #m6 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAStaticText[4]").text
        #m7 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAStaticText[5]").text
        #self.logger.log(m3 + " " + m4 + " " + m5 + " " + m6 + " " + m7)
        #m8 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAStaticText[6]")
        #m9 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAStaticText[7]")
        #self.logger.log(str(m8) + " : " + str(m9))
        #self.logger.log("Pressing edit e-mail button")
        #self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAButton[1]").click()
        #flag1 = 0
        #while flag1 == 0:
        #    try:
        #        self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[3]/UIAAlert[1]/UIACollectionView[1]/"
        #                                          "UIACollectionCell[1]/UIAButton[1]")
        #        flag1 = 1
        #    except NoSuchElementException:
        #        flag1 = 0
        #        sleep(1)
        #self.logger.log("Entering email '*****@*****.**")
        #self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[3]/UIAAlert[1]/UIAScrollView[1]/UIATab"
        #                                  "leView[1]/UIATableCell[1]/UIATextField[1]").send_keys("*****@*****.**")
        #self.logger.log("Pressing cancel")
        #self.driver.find_element_by_xpath(" //UIAApplication[1]/UIAWindow[3]/UIAAlert[1]/UIACollectionView[1]/"
        #                                  "UIACollectionCell[1]/UIAButton[1]").click()
        #m1 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAStaticText[8]").text
        #m2 = self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAStaticText[9]").text
        #self.logger.log(m1 + " : " + m2)
        #self.logger.log("Pressing to edit phone number")
        #self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAButton[2]").click()
        #sleep(5)
        #self.logger.log("Selecting a number")
        #self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIATableView[2]/UIATableCell[2]/"
        #                                  "UIAStaticText[1]").click()
        #self.logger.log("Warning message for default phone number is expected")
        #flag1 = 0
        #count = 0
        #while flag1 == 0 and count < 5:
        #    try:
        #        self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[5]")
        #        flag1 = 1
        #    except NoSuchElementException:
        #        sleep(1)
        #        count += 1
        #        flag1 = 0
        #if flag1 == 0:
        #    self.logger.log("Warning message not shown")
        #elif flag1 == 1:
        #    self.logger.log("Warning message shown")
        #    self.logger.log("Pressing Continue")
        #    self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[5]").click()
        #
        m1 = self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAStaticText[10]"
        ).text
        m2 = self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAStaticText[11]"
        ).text
        self.logger.log(m1 + " : " + m2)
        sleep(2)
        self.logger.log("Clicking to edit Address")
        #self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAButton[3]").click()
        #self.driver.find_element_by_xpath("// //UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAImage[9]"
        #                                  "[@name= 'icon_button_edit_gray' ").click()
        self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAButton[3]"
        ).click()
        sleep(5)
        self.logger.log("Pressing to add new address")
        self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[1]/UIAButton[2]").click()
        sleep(3)
        self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[1]/UIATextField[1]").clear()
        self.logger.log("Entering address title")
        self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[1]/UIATextField[1]").send_keys(
                "Home")
        self.logger.log("Entering full address")
        self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[1]/UIAScrollView[2]/"
            "UIATextView[1]").send_keys("Zeytnioglu Cad")

        self.logger.log("Entering Zip code")
        self.driver.find_elements_by_class_name("UIATextView")[1].send_keys(
            "1000")
        #self.driver.find_element_by_xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[2]/"
        #                                  "UIATextField[1]").send_keys("1000")

        self.logger.log("Selecting country")

        self.logger.log("Clicking Done")
        self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[2]/UIAToolbar[1]/UIAButton[2]"
        ).click()
        self.logger.log("Selecting city")
        self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[1]/UIAScrollView[2]/UIATextField[3]"
        ).click()
        self.logger.log("Clicking done")
        self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[2]/UIAToolbar[1]/UIAButton[2]"
        ).click()
        self.logger.log("Selecting country")
        self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[1]/UIAScrollView[2]/UIATextField[4]"
        ).click()
        element2 = self.driver.find_element_by_xpath(
            "/UIAApplication[1]/UIAWindow[2]/UIAPicker[1]/UIAPickerWheel[1]")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -300, 100).perform()
        touch_actions.perform()
        sleep(1)
        self.logger.log("Clicking done")
        self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[2]/UIAToolbar[1]/UIAButton[2]"
        ).click()
        self.logger.log("Scrolling down")
        element2 = self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[1]/UIAScrollView[2]")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -300, 100).perform()
        touch_actions.perform()
        sleep(1)
        self.logger.log("Setting address as default")
        self.driver.find_element_by_xpath(
            " //UIAApplication[1]/UIAWindow[1]/UIAScrollView[2]/UIAImage[1]"
        ).click()
        self.logger.log("Saving address")
        self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[1]/UIAScrollView[2]/UIAButton[2]"
        ).click()
        self.logger.log("Clicking back button")
        self.driver.find_element_by_xpath(
            "//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[2]"
        ).click()
        sleep(3)
        self.logger.log("TEST FINISHED", "green", 1, 2,
                        self.appium_worker.logger.getFileName())
    def test(self):
        sleep(0.5)
        self.logger.log("************************************")

        sleep(1)
        self.logger.log('Order Waiting test initialized', 'yellow')
        sleep(0.5)
        self.logger.log("**************************")
        user1 = "*****@*****.**"
        pass1 = "1q2w3e4r"
        err_flag = 0

        self.appium_worker.entrance_android()
        flag = 0
        while flag == 0:
            try:
                self.driver.find_element_by_id("ivSubmenuProfile")
                flag = 1
            except NoSuchElementException:
                sleep(1)
                flag = 0
        #self.logger.log("Clicking left sub-menu")
        #self.driver.find_element_by_id("drawer_indicator").click()
        #sleep(1)
        #self.driver.find_element_by_class_name("android.widget.LinearLayout").click()
        sleep(1)
        self.logger.log("Clicking Inbox icon")
        self.driver.find_element_by_id("ivSubmenuInbox").click()
        sleep(1)
        self.logger.log("Clicking Waiting")
        self.driver.find_element_by_id("llWaiting").click()
        self.logger.log("Scrolling down list")
        element2 = self.driver.find_element_by_class_name(
            "android.widget.FrameLayout")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -500, 100).perform()
        touch_actions.perform()
        sleep(3)
        self.logger.log("Scrolled")
        self.logger.log("Selecting order")
        self.logger.log("Selecting package")
        self.driver.find_elements_by_id("rlWrapper")[3].click()
        sleep(1)

        try:
            self.driver.find_element_by_id("tvAddNote")
            flag = 1
        except NoSuchElementException:
            flag = 0
        if flag == 1:
            self.logger.log("Clicking Add Note")
            self.driver.find_element_by_id("tvAddNote").click()
            self.driver.find_element_by_id("etNote").send_keys("Test note")
            self.driver.back()
            self.logger.log("Clicking Save")
            self.driver.find_element_by_id("tvSave").click()
            sleep(2)
        try:
            self.driver.find_element_by_id("ivAddTrackingCode")
            flag = 1
        except NoSuchElementException:
            flag = 0
        if flag == 1:
            self.logger.log("Clicking to add Tracking Code")
            self.driver.find_element_by_id("ivAddTrackingCode").click()
            self.logger.log("Adding Tracking Code as 1234")
            self.driver.find_element_by_id("etTrackingCode").send_keys("1234")
            self.logger.log("Selecting US Carrier as UPS")
            self.driver.find_element_by_id("ivUPS").click()
            self.logger.log("Clicking OK")
            self.driver.find_element_by_id("tvOK").click()
            sleep(1)
        try:
            self.driver.find_element_by_id("ivAdd")
            flag = 1
        except NoSuchElementException:
            flag = 0
        if flag == 1:
            self.driver.find_element_by_id("ivAdd").click()
            self.driver.back()
        m1 = self.driver.find_element_by_id("etContent").text
        m2 = self.driver.find_element_by_id("tvCreationDate").text
        m3 = self.driver.find_element_by_id("tvNote").text
        m4 = self.driver.find_element_by_id("tvSender").text
        m5 = self.driver.find_element_by_id("tvPackageCode").text
        self.logger.log("Content: " + self.funct_decode(str(m1)))
        sleep(0.5)
        self.logger.log("Creation date: " + self.funct_decode(str(m2)))
        sleep(0.5)
        self.logger.log("Note : " + self.funct_decode(str(m3)))
        sleep(0.5)
        self.logger.log("Sender: " + self.funct_decode(str(m4)))
        sleep(0.5)
        self.logger.log("Package Code: " + self.funct_decode(str(m5)))
        sleep(0.5)
        self.logger.log("Clicking Waiting Packages")
        self.driver.find_element_by_id("tvWaitingPackages").click()
        # self.driver.back()
        self.logger.log("Scrolling down list")
        element2 = self.driver.find_element_by_class_name(
            "android.widget.FrameLayout")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -500, 100).perform()
        touch_actions.perform()
        sleep(3)
        self.logger.log("Scrolled")
        self.logger.log("Selecting package")
        self.driver.find_elements_by_id("rlWrapper")[5].click()
        try:
            self.driver.find_element_by_id("tvAddNote")
            flag = 1
        except NoSuchElementException:
            flag = 0
        if flag == 1:
            self.logger.log("Clicking Add Note")
            self.driver.find_element_by_id("tvAddNote").click()
            self.driver.find_element_by_id("etNote").send_keys("Test note")
            self.driver.back()
            self.logger.log("Clicking Save")
            self.driver.find_element_by_id("tvSave").click()
            sleep(2)
        try:
            self.driver.find_element_by_id("ivAddTrackingCode")
            flag = 1
        except NoSuchElementException:
            flag = 0
        if flag == 1:
            self.logger.log("Clicking to add Tracking Code")
            self.driver.find_element_by_id("ivAddTrackingCode").click()
            self.logger.log("Adding Tracking Code as 1234")
            self.driver.find_element_by_id("etTrackingCode").send_keys("1234")
            self.logger.log("Selecting US Carrier as UPS")
            self.driver.find_element_by_id("ivUPS").click()
            self.logger.log("Clicking OK")
            self.driver.find_element_by_id("tvOK").click()
            sleep(1)
        try:
            self.driver.find_element_by_id("ivAdd")
            flag = 1
        except NoSuchElementException:
            flag = 0
        if flag == 1:
            self.driver.find_element_by_id("ivAdd").click()
            self.driver.find_element_by_id("etTrackingCode").send_keys("1234")
            self.driver.find_element_by_id("tvOK").click()
            # self.driver.back()
        m1 = self.driver.find_element_by_id("etContent").text
        m2 = self.driver.find_element_by_id("tvCreationDate").text
        m3 = self.driver.find_element_by_id("tvNote").text
        m4 = self.driver.find_element_by_id("tvSender").text
        m5 = self.driver.find_element_by_id("tvPackageCode").text
        self.logger.log("Content: " + self.funct_decode(str(m1)))
        sleep(0.5)
        self.logger.log("Creation date: " + self.funct_decode(str(m2)))
        sleep(0.5)
        self.logger.log("Note : " + self.funct_decode(str(m3)))
        sleep(0.5)
        self.logger.log("Sender: " + self.funct_decode(str(m4)))
        sleep(0.5)
        self.logger.log("Package Code: " + self.funct_decode(str(m5)))
        sleep(0.5)
        self.logger.log("Clicking Waiting Packages")
        self.driver.find_element_by_id("tvWaitingPackages").click()
        # self.driver.back()
        self.logger.log("Clicking one order to delete")
        self.driver.find_elements_by_id("ivIcon")[2].click()
        sleep(1)
        self.appium_worker.screenshot("Deleting_order")
        sleep(1)
        self.logger.log("Clicking No")
        self.driver.find_element_by_id("tvNegative").click()
        self.logger.log("Going back")
        self.driver.back()

        self.driver.back()
        self.logger.log("TEST FINISHED", "green", 1, 2,
                        self.appium_worker.logger.getFileName())
    # 选择单位证件类型为 其他证件
    com_id_other_type = chrome_001.find_element_by_xpath(
        '//*[@id="proveReturn"]')
    com_id_other_type.click()
    time.sleep(1)
    com_id_other_type_chose = chrome_001.find_element_by_xpath(
        '//*[@id="proveTypeName"]')
    com_id_other_type_chose.click()
    time.sleep(1)
    # 定义触控,下拉框选择
    action_001 = TouchActions(chrome_001)
    com_id_other_type_00 = chrome_001.find_element_by_xpath(
        '//*[@id="oneLevelContain"]/ul/li[1]')
    action_001.scroll_from_element(com_id_other_type_00, 0, 200)
    action_001.perform()
    time.sleep(2)
    # 单位其他证件类型选择OK
    com_id_other_type_ok = chrome_001.find_element_by_xpath(
        '/html/body/div[9]/div/header/a[2]')
    com_id_other_type_ok.click()

    com_id_number = data_plate_file_xl.worksheets[0].cell(
        data_row + 1, 2).value  # excel中行列是从1开始数
    com_id_number_input = chrome_001.find_element_by_xpath(
        '//*[@id="proveNoNew"]')
    com_id_number_input.send_keys(com_id_number)

    try:
        # 是否法人亲临
        keyperson_value = data_plate_file_xl.worksheets[0].cell(
Exemplo n.º 26
0
touch_actions = TouchActions(driver)

#Change these two for what to scrape and name of final file
filename = 'carmax_sedans'
car_type = 'sedans'

driver.get(url + car_type)
car_tile_xpath = "//a[@class='kmx-typography--font-alt kmx-typography--weight-400 kmx-elevation-02']"
see_more_button = "//button[@class='see-more see-more__cta-all']"

dropdown_xpath = "//div[@class='mdc-select__surface mdc-ripple-upgraded']"
wait.until(EC.presence_of_all_elements_located((By.XPATH, dropdown_xpath)))
dropdown_menu = driver.find_element_by_xpath(dropdown_xpath)
dropdown_menu.location_once_scrolled_into_view
touch_actions.scroll(0, -100)
touch_actions.perform()
dropdown_menu.click()
wait.until(
    EC.presence_of_all_elements_located(
        (By.XPATH, "//li[text()='Nationwide']")))
driver.find_element_by_xpath("//li[text()='Nationwide']").click()

# Finding all relevent makes
wait.until(EC.presence_of_element_located((By.XPATH, "//div[@id='Make']")))
driver.find_element_by_xpath("//div[@id='Make']").click()
wait.until(
    EC.presence_of_all_elements_located(
        (By.XPATH, "//span[@class='refinements--value--name']")))
time.sleep(1)
car_makes = driver.find_elements_by_xpath(
    "//span[@class='refinements--value--name']")
    def test(self):
        sleep(0.5)
        self.logger.log("************************************")

        sleep(1)
        self.logger.log('Order Tracking test initialized', 'yellow')
        self.logger.log("**************************")
        user1 = "*****@*****.**"
        pass1 = "1q2w3e4r"
        err_flag = 0

        self.appium_worker.entrance_android()
        flag = 0
        while flag == 0:
            try:
                self.driver.find_element_by_id("ivSubmenuProfile")
                flag = 1
            except NoSuchElementException:
                sleep(1)
                flag = 0
        #self.logger.log("Clicking left sub-menu")
        #self.driver.find_element_by_id("drawer_indicator").click()
        #sleep(1)
        #drawer = self.appium_worker.submenu()
        #if drawer == 2:
        #    self.logger.log("Scrolling up the screen")
        #    element2 = self.driver.find_element_by_class_name("android.widget.ListView")
        #    touch_actions = TouchActions(self.driver)
        #    touch_actions.flick_element(element2, 0, 1000, 100).perform()
        #    touch_actions.perform()
        #    sleep(1)
        #self.driver.find_element_by_class_name("android.widget.LinearLayout").click()
        sleep(1)
        self.logger.log("Clicking Inbox icon")
        self.driver.find_element_by_id("ivSubmenuInbox").click()
        sleep(1)
        self.logger.log("Clicking Tracking")
        self.driver.find_element_by_id("llTracking").click()
        fl2 = 0
        while fl2 == 0:
            try:
                self.driver.find_elements_by_id("rlRoot")[1]
                fl2 = 1
            except NoSuchElementException:
                self.logger.log("wait")
                sleep(1)
                fl2 = 0
        self.logger.log("Selecting one order")
        self.driver.find_elements_by_id("rlRoot")[1].click()
        try:
            self.driver.find_element_by_id("tvBottom")
            flag = 1
        except NoSuchElementException:
            flag = 0
        if flag == 1:
            m1 = self.driver.find_element_by_id("tvContent").text
            m2 = self.driver.find_element_by_id("tvEntryDate").text
            m3 = self.driver.find_element_by_id("tvDepartureDate").text
            m4 = self.driver.find_element_by_id("tvTrackingCode").text
            m5 = self.driver.find_element_by_id("tvSender").text
            m6 = self.driver.find_element_by_id("tvPackageCode").text
            self.logger.log("Content: " + self.funct_decode(str(m1)))
            sleep(0.5)
            self.logger.log("Enty date: " + self.funct_decode(str(m2)))
            sleep(0.5)
            self.logger.log("Departure date: " + self.funct_decode(str(m3)))
            sleep(0.5)
            #self.logger.log("Tacking code " + self.funct_decode(str(m4)))
            sleep(0.5)
            self.logger.log("Sender: " + self.funct_decode(str(m5)))
            sleep(0.5)
            self.logger.log("Code: " + self.funct_decode(str(m6)))
            if self.driver.find_element_by_id("tvBottom").text is "OK":
                flag = 1
            elif self.driver.find_element_by_id(
                    "tvBottom").text is "DETAILED TRACKING":
                flag = 0
            if flag == 1:
                self.driver.find_element_by_id("tvBottom").click()
            elif flag == 0:
                self.driver.find_element_by_id("tvBottom").click()
                sleep(3)
                self.driver.back()
                self.driver.back()
        self.logger.log("Scrolling down list")
        element2 = self.driver.find_element_by_id("rlList")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -200, 100).perform()
        touch_actions.perform()
        sleep(1)
        self.logger.log("Scrolled")

        self.logger.log("Selecting one order")
        self.driver.find_element_by_id("rlRoot").click()
        try:
            self.driver.find_element_by_id("tvBottom")
            flag = 1
        except NoSuchElementException:
            flag = 0
        if flag == 1:
            m1 = self.driver.find_element_by_id("tvContent").text
            m2 = self.driver.find_element_by_id("tvEntryDate").text
            m3 = self.driver.find_element_by_id("tvDepartureDate").text
            m4 = self.driver.find_element_by_id("tvTrackingCode").text
            m5 = self.driver.find_element_by_id("tvSender").text
            m6 = self.driver.find_element_by_id("tvPackageCode").text
            self.logger.log("Content: " + self.funct_decode(str(m1)))
            sleep(0.5)
            self.logger.log("Enty date: " + self.funct_decode(str(m2)))
            sleep(0.5)
            self.logger.log("Departure date: " + self.funct_decode(str(m3)))
            sleep(0.5)
            #self.logger.log("Tacking code " + self.funct_decode(str(m4)))
            sleep(0.5)
            self.logger.log("Sender: " + self.funct_decode(str(m5)))
            sleep(0.5)
            self.logger.log("Code: " + self.funct_decode(str(m6)))
            if self.driver.find_element_by_id("tvBottom").text is "OK":
                flag = 1
            elif self.driver.find_element_by_id(
                    "tvBottom").text is "DETAILED TRACKING":
                flag = 0
            if flag == 1:
                self.driver.find_element_by_id("tvBottom").click()
            elif flag == 0:
                self.driver.find_element_by_id("tvBottom").click()
                sleep(3)
                self.driver.back()
                self.driver.back()

        self.logger.log("Scrolling down list")
        element2 = self.driver.find_element_by_id("rlList")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -500, 100).perform()
        touch_actions.perform()
        sleep(1)
        self.logger.log("Scrolled")
        self.logger.log("Selecting one order")
        self.driver.find_elements_by_id("rlWrapper")[4].click()
        try:
            self.driver.find_element_by_id("tvBottom")
            flag = 1
        except NoSuchElementException:
            flag = 0
        if flag == 1:
            m1 = self.driver.find_element_by_id("tvContent").text
            m2 = self.driver.find_element_by_id("tvEntryDate").text
            m3 = self.driver.find_element_by_id("tvDepartureDate").text
            m4 = self.driver.find_element_by_id("tvTrackingCode").text
            m5 = self.driver.find_element_by_id("tvSender").text
            m6 = self.driver.find_element_by_id("tvPackageCode").text
            self.logger.log("Content: " + self.funct_decode(str(m1)))
            sleep(0.5)
            self.logger.log("Enty date: " + self.funct_decode(str(m2)))
            sleep(0.5)
            self.logger.log("Departure date: " + self.funct_decode(str(m3)))
            sleep(0.5)
            #self.logger.log("Tacking code " + self.funct_decode(str(m4)))
            sleep(0.5)
            self.logger.log("Sender: " + self.funct_decode(str(m5)))
            sleep(0.5)
            self.logger.log("Code: " + self.funct_decode(str(m6)))
            if self.driver.find_element_by_id("tvBottom").text is "OK":
                flag = 1
            elif self.driver.find_element_by_id(
                    "tvBottom").text is "DETAILED TRACKING":
                flag = 0
            if flag == 1:
                self.driver.find_element_by_id("tvBottom").click()
            elif flag == 0:
                self.driver.find_element_by_id("tvBottom").click()
                sleep(3)
                self.driver.back()
                self.driver.back()

        self.driver.back()
        self.logger.log("TEST FINISHED", "green", 1, 2,
                        self.appium_worker.logger.getFileName())
Exemplo n.º 28
0
    def test(self):
        sleep(0.5)
        self.logger.log("************************************")
        sleep(0.5)
        self.logger.log('Support test initialized', 'yellow')
        sleep(0.5)
        self.logger.log("************************************", 'green')
        user1 = '*****@*****.**'
        pass1 = '1q2w3e4r'
        flag2 = 0
        err_flag = 0
        self.appium_worker.entrance_android()
        self.logger.log("Clicking left sub-menu")
        self.driver.find_element_by_id("drawer_indicator").click()
        drawer = self.appium_worker.submenu()
        if drawer == 2:
            self.logger.log("Scrolling up the screen")
            element2 = self.driver.find_element_by_class_name(
                "android.widget.ListView")
            touch_actions = TouchActions(self.driver)
            touch_actions.flick_element(element2, 0, 1000, 100).perform()
            touch_actions.perform()
            sleep(1)

        self.logger.log("Clicking Support")
        self.driver.find_elements_by_class_name(
            "android.widget.LinearLayout")[9].click()
        sleep(1)
        try:
            self.driver.find_element_by_id("rlCall")
            flag = 1
        except NoSuchElementException:
            self.logger.log("ERROR")
            err_flag += 1
            flag = 0
        if flag == 1:
            self.logger.log("Clicking MESSAGES")
            self.driver.find_element_by_id("tvMessages").click()
            sleep(1)
            try:
                self.driver.find_element_by_id("tvNewMessage")
                flag = 1
            except NoSuchElementException:
                self.logger.log("ERROR")
                err_flag += 1
                flag = 0
            if flag == 1:
                self.logger.log("Scrolling down the screen")
                element2 = self.driver.find_element_by_class_name(
                    "android.widget.ListView")
                touch_actions = TouchActions(self.driver)
                touch_actions.flick_element(element2, 0, -500, 100).perform()
                touch_actions.perform()
                sleep(1)
                self.logger.log("Opening a message")
                self.driver.find_elements_by_class_name(
                    "android.widget.RelativeLayout")[6].click()
                sleep(1)
                try:
                    self.driver.find_element_by_id("tvReply")
                    flag = 1
                except NoSuchElementException:
                    flag = 0
                    self.logger.log("ERROR")
                    err_flag += 1
                if flag == 1:
                    self.logger.log("Clicking REPLY")
                    self.driver.find_element_by_id("tvReply").click()
                    self.logger.log("Clicking SEND")
                    self.driver.find_element_by_id("tvSend").click()
                    self.appium_worker.screenshot("Empty_fields")
                    self.driver.find_element_by_id("etMessage").send_keys(
                        "Test reply")
                    self.driver.back()
                    self.logger.log("Clicking SEND")
                    self.driver.find_element_by_id("tvSend").click()
                    self.driver.back()
                    self.logger.log("Clicking NEW MESSAGE")
                    self.driver.find_element_by_id("tvNewMessage").click()
                    self.logger.log("Typing subject")
                    self.driver.find_element_by_id("etSubject").send_keys(
                        "test subject")
                    self.logger.log("Clicking SEND")
                    self.driver.find_element_by_id("tvSend").click()
                    sleep(0.5)
                    self.appium_worker.screenshot("Empty_fields")
                    sleep(0.5)
                    self.logger.log("Typing mesage")
                    self.driver.find_element_by_id("etMessage").send_keys(
                        "Test message")
                    self.driver.back()
                    self.logger.log("Clicking SEND")
                    self.driver.find_element_by_id("tvSend").click()
                    sleep(0.5)
                    self.appium_worker.screenshot("Message_sent")
                    self.driver.back()
                    self.logger.log("Clicking CALL ME")
                    self.driver.find_element_by_id("tvCallMe").click()
                    try:
                        self.driver.find_element_by_id("tvOK")
                        flag = 1
                    except NoSuchElementException:
                        flag = 0
                        self.logger.log("Unexpected ERROR")
                        err_flag += 1
                    if flag == 1:
                        self.logger.log("Entering subject")
                        self.driver.find_element_by_id("etSubject").send_keys(
                            "Delay")
                        self.driver.find_element_by_id("tvOK").click()
                        sleep(1)
                        self.appium_worker.screenshot("Empty_fields")
                        sleep(0.5)
                        self.logger.log("Selecting time")
                        self.driver.find_element_by_id("tvTime").click()
                        self.driver.find_elements_by_class_name(
                            "android.view.View")[25].click()
                        self.driver.find_element_by_id("button1").click()
                        self.driver.back()
                        self.logger.log("Clicking OK")
                        self.driver.find_element_by_id("tvOK").click()
                        sleep(1)
                        self.appium_worker.screenshot("Beni_ara")
                        self.logger.log("Clicking OK")
                        self.driver.find_element_by_id("tvOK").click()
                        sleep(2)
                        self.driver.back()
                        self.logger.log(
                            "TEST FINISHED", "green", 1, 2,
                            self.appium_worker.logger.getFileName())
            else:
                print 'ok2'
                self.appium_worker.screenshot("Unexpected_error")
                self.driver.back()
                self.driver.back()
                self.driver.back()
                self.driver.back()
Exemplo n.º 29
0
    def test(self):

        self.appium_worker.entrance_android()
        self.appium_worker.bekle_android("drawer_indicator")
        sleep(0.5)
        self.logger.log("************************************")
        sleep(0.5)
        self.logger.log('About Us test initialized')
        sleep(0.5)
        self.logger.log("************************************")
        sleep(0.5)
        self.logger.log("Opening left sub-menu")
        self.driver.find_element_by_id("drawer_indicator").click()
        sleep(1)
        self.logger.log("Scrolling down")
        element2 = self.driver.find_element_by_class_name(
            "android.widget.RelativeLayout")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -1000, 100).perform()
        touch_actions.perform()
        sleep(1)
        self.logger.log("Clicking About Us")
        self.driver.find_elements_by_class_name(
            "android.widget.LinearLayout")[10].click()
        sleep(2)
        try:
            self.driver.find_element_by_id("tvAboutUs")
            flag = 1
        except NoSuchElementException:
            flag = 0
        if flag == 1:
            self.logger.log("Clicking About Us")
            self.driver.find_element_by_id("tvAboutUs").click()
            sleep(1)
            self.logger.log("Scrolling down")
            element2 = self.driver.find_element_by_class_name(
                "android.webkit.WebView")
            # element2 = self.driver.find_element_by_id("webview")
            touch_actions = TouchActions(self.driver)
            touch_actions.flick_element(element2, 0, -1500, 100).perform()
            touch_actions.perform()
            sleep(3)
            self.driver.back()
            try:
                self.driver.find_element_by_id("tvAboutUs")
                flag = 1
            except NoSuchElementException:
                flag = 0
            if flag == 1:
                self.logger.log("Clicking Terms")
                self.driver.find_element_by_id("tvTerms").click()
                sleep(1)
                self.logger.log("Scrolling down")
                element2 = self.driver.find_element_by_class_name(
                    "android.webkit.WebView")
                # element2 = self.driver.find_element_by_id("webview")
                touch_actions = TouchActions(self.driver)
                touch_actions.flick_element(element2, 0, -1800, 100).perform()
                touch_actions.perform()
                sleep(3)
                self.driver.back()
                try:
                    self.driver.find_element_by_id("tvAboutUs")
                    flag = 1
                except NoSuchElementException:
                    flag = 0
                if flag == 1:
                    self.logger.log("Clicking Privacy")
                    self.driver.find_element_by_id("tvPrivacy").click()
                    sleep(1)
                    self.logger.log("Scrolling down")
                    element2 = self.driver.find_element_by_class_name(
                        "android.webkit.WebView")
                    # element2 = self.driver.find_element_by_id("webview")
                    touch_actions = TouchActions(self.driver)
                    touch_actions.flick_element(element2, 0, -700,
                                                100).perform()
                    touch_actions.perform()
                    sleep(3)
                    self.driver.back()
                    try:
                        self.driver.find_element_by_id("tvAboutUs")
                        flag = 1
                    except NoSuchElementException:
                        flag = 0
                    if flag == 1:
                        self.logger.log("Clicking FAQ")
                        self.driver.find_element_by_id("tvFaq").click()
                        sleep(1)
                        self.logger.log("Scrolling down")
                        element2 = self.driver.find_element_by_class_name(
                            "android.webkit.WebView")
                        # element2 = self.driver.find_element_by_id("webview")
                        touch_actions = TouchActions(self.driver)
                        touch_actions.flick_element(element2, 0, -1800,
                                                    100).perform()
                        touch_actions.perform()
                        sleep(3)
                        self.driver.back()
                        self.driver.back()
                        self.driver.back()
                        self.logger.log(
                            "TEST FINISHED", "green", 1, 2,
                            self.appium_worker.logger.getFileName())
                    else:
                        self.logger.log("ERROR")
                else:
                    self.logger.log("ERROR")
            else:
                self.logger.log("ERROR")
        else:
            self.logger.log("ERROR")
Exemplo n.º 30
0
    def test(self):
        sleep(0.5)
        self.logger.log("************************************")
        sleep(0.5)
        self.logger.log('Log in as guest test initialized', 'yellow')
        sleep(0.5)
        self.logger.log("************************************", 'green')
        flag = 0
        while flag == 0:
            try:
                self.driver.find_element_by_id('tvPass')
                flag = 1
            except NoSuchElementException:
                try:
                    self.driver.find_element_by_id("tvLogin")
                    flag = 2
                except NoSuchElementException:
                    sleep(1)
                    flag = 0
        if flag == 1:
            self.logger.log("Clicking Pass")
            self.driver.find_element_by_id('tvPass').click()
        if flag == 2:
            self.logger.log("Clicking Pass")
            self.driver.find_element_by_id('tvPass').click()
        self.logger.log("Clicking Continue as guest")
        self.driver.find_element_by_id('tvContinueAsGuest').click()
        sleep(4)
        self.driver.find_elements_by_class_name("android.widget.Gallery")[0]
        self.driver.find_elements_by_id("ivIcon")[0].click()
        self.logger.log("Scrolling Icon menu")
        element = self.driver.find_elements_by_class_name(
            "android.widget.Gallery")[0]
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element, -500, 0, 50).perform()
        touch_actions.perform()
        sleep(2)
        self.logger.log("Selecting an icon")
        self.driver.find_elements_by_id("ivIcon")[0].click()
        sleep(3)
        self.logger.log("Scrolling list menu")
        element1 = self.driver.find_elements_by_class_name(
            "android.widget.Gallery")[1]
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element1, -400, 0, 100).perform()
        touch_actions.perform()
        sleep(1)
        self.driver.find_elements_by_id("textView")[1].click()
        sleep(3)
        self.logger.log("Scrolling item list")
        element2 = self.driver.find_element_by_class_name(
            "android.widget.GridView")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -500, 100).perform()
        touch_actions.perform()
        sleep(1)

        self.driver.find_elements_by_id("gridview")[0].click()
        self.logger.log("Scrolling Icon menu")
        el2 = self.driver.find_elements_by_class_name(
            "android.widget.Gallery")[0]
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(el2, -200, 0, 50).perform()
        touch_actions.perform()
        self.driver.find_elements_by_id("ivIcon")[2].click()
        sleep(1)
        self.logger.log("Scrolling item list")
        el3 = self.driver.find_element_by_class_name("android.widget.GridView")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(el3, 0, -500, 100).perform()
        touch_actions.perform()
        self.logger.log("Scrolling Icon menu")
        element2 = self.driver.find_elements_by_class_name(
            "android.widget.Gallery")[0]
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, -1000, 0, 50).perform()
        touch_actions.perform()
        self.logger.log("Selecting Search Product")
        self.driver.find_elements_by_id("ivIcon")[2].click()
        sleep(1)
        self.logger.log("Searching for 'AYAK'")
        self.driver.find_element_by_id("etSearch").send_keys("ayak")
        self.driver.back()
        self.logger.log("Clicking Search")
        self.driver.find_element_by_id("tvSearch").click()
        sleep(1)
        self.logger.log("Scrolling item list")
        element3 = self.driver.find_element_by_class_name(
            "android.widget.GridView")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element3, 0, -500, 100).perform()
        touch_actions.perform()
        self.logger.log("Selecting an item")
        self.driver.find_elements_by_id("ivIcon")[0].click()
        sleep(7)
        self.logger.log("Going back")
        self.driver.back()
        self.driver.back()
        self.driver.back()
        self.logger.log("TEST FINISHED", "green", 1, 2,
                        self.appium_worker.logger.getFileName())
Exemplo n.º 31
0
    def test(self):
        sleep(0.5)
        self.logger.log("************************************")
        sleep(0.5)
        self.logger.log('Prices test initialized', 'yellow')
        sleep(0.5)
        self.logger.log("************************************", 'green')
        # user1 = '*****@*****.**'
        # pass1 = 'testpass'

        user1 = "*****@*****.**"
        pass1 = "1q2w3e4r"
        promotion_false = "SHIPMENTTEST"
        promotion_correct = "SHIPMENTTEST062016"
        pay_price = 0.0
        flag2 = 0
        flag_err = 0
        nr_products = 0
        lbs = 0

        # PRICES
        self.appium_worker.entrance_android()
        self.driver.find_element_by_id("drawer_indicator").click()
        sleep(1)
        self.logger.log("Scrolling down")

        element2 = self.driver.find_element_by_class_name(
            "android.widget.RelativeLayout")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -1000, 100).perform()
        touch_actions.perform()
        sleep(1)
        self.logger.log("Clicking Prices")
        self.driver.find_elements_by_class_name(
            "android.widget.LinearLayout")[9].click()
        self.wait_id("ivBox")
        nr_products = self.driver.find_element_by_id("tvNumOfPackages").text
        self.logger.log("Number of products is: " + str(nr_products))
        lbs = self.driver.find_element_by_id("tvWeight").text
        self.logger.log("Weight in lbs is: " + str(lbs))

        m = self.driver.find_elements_by_id("rlRoot")[0]
        m1 = m.find_element_by_id("tvText").text

        self.logger.log("*********************************")
        self.logger.log("Selecting item")
        m = self.driver.find_elements_by_id("rlRoot")[0]
        m.click()
        self.logger.log("Item selected is : ")
        flag_data = self.decide_product(m)
        self.logger.log("Weight of the added product is : " + str(flag_data))
        data_lbs, data_products = self.update_data(1, flag_data)
        self.logger.log("Updated lbs is " + str(data_lbs) +
                        " and number of products is " + str(data_products))
        self.screen_calc()

        self.logger.log("*********************************")
        self.logger.log("Selecting item")
        m1 = self.driver.find_elements_by_id("rlRoot")[3]
        m1.click()
        self.logger.log("Item selected is : ")
        flag_data = self.decide_product(
            self.driver.find_elements_by_id("rlRoot")[3])
        self.logger.log("Weight of the added product is : " + str(flag_data))
        data_lbs, data_products = self.update_data(1, flag_data)
        self.logger.log("Updated lbs is " + str(data_lbs) +
                        " and number of products is " + str(data_products))
        self.screen_calc()

        self.logger.log("*********************************")
        self.logger.log("Selecting item to remove")
        m1 = self.driver.find_elements_by_id("rlRoot")[3]
        m1.find_element_by_id("ivDecrease").click()
        self.logger.log("Item selected is : ")
        flag_data = self.decide_product(
            self.driver.find_elements_by_id("rlRoot")[3])
        self.logger.log("Weight of the removed product is : " + str(flag_data))
        data_lbs, data_products = self.update_data(0, flag_data)
        self.logger.log("Updated lbs is " + str(data_lbs) +
                        " and number of products is " + str(data_products))
        self.screen_calc()

        self.logger.log("Scrolling right")
        element2 = self.driver.find_element_by_class_name(
            "android.widget.HorizontalScrollView")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, -830, 0, 100).perform()
        touch_actions.perform()
        sleep(1)

        self.logger.log("*********************************")
        self.logger.log("Selecting item")
        m = self.driver.find_elements_by_id("rlRoot")[0]
        m.click()
        self.logger.log("Item selected is : ")
        flag_data = self.decide_product(m)
        self.logger.log("Weight of the added product is : " + str(flag_data))
        data_lbs, data_products = self.update_data(1, flag_data)
        self.logger.log("Updated lbs is " + str(data_lbs) +
                        " and number of products is " + str(data_products))
        self.screen_calc()

        self.logger.log("*********************************")
        self.logger.log("Selecting item")
        m1 = self.driver.find_elements_by_id("rlRoot")[3]
        m1.click()
        self.logger.log("Item selected is : ")
        flag_data = self.decide_product(
            self.driver.find_elements_by_id("rlRoot")[3])
        self.logger.log("Weight of the added product is : " + str(flag_data))
        data_lbs, data_products = self.update_data(1, flag_data)
        self.logger.log("Updated lbs is " + str(data_lbs) +
                        " and number of products is " + str(data_products))
        self.screen_calc()

        self.logger.log("Scrolling right")
        element2 = self.driver.find_element_by_class_name(
            "android.widget.HorizontalScrollView")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, -830, 0, 100).perform()
        touch_actions.perform()
        sleep(1)

        self.logger.log("*********************************")
        self.logger.log("Selecting item")
        m = self.driver.find_elements_by_id("rlRoot")[1]
        m.click()
        self.logger.log("Item selected is : ")
        flag_data = self.decide_product(m)
        self.logger.log("Weight of the added product is : " + str(flag_data))
        data_lbs, data_products = self.update_data(1, flag_data)
        self.logger.log("Updated lbs is " + str(data_lbs) +
                        " and number of products is " + str(data_products))
        self.screen_calc()

        self.logger.log("*********************************")
        self.logger.log("Selecting item")
        m1 = self.driver.find_elements_by_id("rlRoot")[2]
        m1.click()
        self.logger.log("Item selected is : ")
        flag_data = self.decide_product(
            self.driver.find_elements_by_id("rlRoot")[2])
        self.logger.log("Weight of the added product is : " + str(flag_data))
        data_lbs, data_products = self.update_data(1, flag_data)
        self.logger.log("Updated lbs is " + str(data_lbs) +
                        " and number of products is " + str(data_products))
        self.screen_calc()

        self.logger.log("*********************************")
        self.logger.log("Selecting item")
        m1 = self.driver.find_elements_by_id("rlRoot")[3]
        m1.click()
        self.logger.log("Item selected is : ")
        flag_data = self.decide_product(
            self.driver.find_elements_by_id("rlRoot")[3])
        self.logger.log("Weight of the added product is : " + str(flag_data))
        data_lbs, data_products = self.update_data(1, flag_data)
        self.logger.log("Updated lbs is " + str(data_lbs) +
                        " and number of products is " + str(data_products))
        self.screen_calc()

        self.logger.log("*********************************")
        self.logger.log("Selecting item to remove")
        m1 = self.driver.find_elements_by_id("rlRoot")[2]
        m1.find_element_by_id("ivDecrease").click()
        self.logger.log("Item selected is : ")
        flag_data = self.decide_product(
            self.driver.find_elements_by_id("rlRoot")[2])
        self.logger.log("Weight of the added product is : " + str(flag_data))
        data_lbs, data_products = self.update_data(0, flag_data)
        self.logger.log("Updated lbs is " + str(data_lbs) +
                        " and number of products is " + str(data_products))
        self.screen_calc()

        self.logger.log("***********************************")
        p1 = self.driver.find_element_by_id("tvAICost").text
        p2 = self.driver.find_element_by_id("tvUpsCost").text
        p3 = self.driver.find_element_by_id("tvFedexCost").text
        self.logger.log("Price of Amerikadaniste is " + p1)
        sleep(1)
        self.logger.log("Price of Ups is: " + p2)
        sleep(1)
        self.logger.log("Price of FEDEX is: " + p3)
        sleep(1)

        self.logger.log("**********************************")
        self.logger.log("Scrolling down to read the information")
        element2 = self.driver.find_element_by_class_name(
            "android.widget.HorizontalScrollView")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -1600, 100).perform()
        sleep(2)
        # touch_actions.perform()
        sleep(3)
        self.logger.log("Scrolling Up")
        flag = 0
        while flag == 0:
            try:
                self.driver.find_element_by_id("tvSupport")
                flag = 1
            except NoSuchElementException:
                flag = 0
            if flag == 1:
                self.logger.log("Clicking Support button")
                self.driver.find_element_by_id("tvSupport").click()
                sleep(3)
                self.driver.back()
                self.driver.back()
                self.logger.log("TEST FINISHED", "green", 1, 2,
                                self.appium_worker.logger.getFileName())

            if flag == 0:
                element2 = self.driver.find_element_by_class_name(
                    "android.widget.ScrollView")
                touch_actions = TouchActions(self.driver)
                touch_actions.flick_element(element2, 0, 1000, 100).perform()

            if flag_err == 0:
                self.logger.log("Test FINISHED without errors \n")
            else:
                self.logger.log("Test FINISHED with  %d errors \n" % flag_err)
Exemplo n.º 32
0
    def test(self):
        sleep(0.5)
        self.logger.log("************************************")
        sleep(0.5)
        self.logger.log('Notifications test initialized', 'yellow')
        sleep(0.5)
        self.logger.log("********************************")
        self.appium_worker.entrance_android()
        self.logger.log("Clicking left sub-menu")
        self.driver.find_element_by_id("drawer_indicator").click()
        drawer = self.appium_worker.submenu()
        if drawer == 2:
            self.logger.log("Scrolling up the screen")
            element2 = self.driver.find_element_by_class_name(
                "android.widget.ListView")
            touch_actions = TouchActions(self.driver)
            touch_actions.flick_element(element2, 0, 1000, 100).perform()
            touch_actions.perform()
            sleep(1)

        self.logger.log("Notifications")
        self.driver.find_elements_by_class_name(
            "android.widget.LinearLayout")[10].click()
        self.logger.log("Choosing a notification")
        self.driver.find_elements_by_class_name(
            "android.widget.RelativeLayout")[5].click()
        sleep(1)
        self.appium_worker.screenshot("Notification")
        self.choice()
        element2 = self.driver.find_element_by_class_name(
            "android.widget.ListView")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -500, 100).perform()
        touch_actions.perform()
        self.logger.log("Choosing a notification")
        self.driver.find_elements_by_class_name(
            "android.widget.RelativeLayout")[8].click()
        sleep(1)
        self.appium_worker.screenshot("Notification")
        self.choice()
        element2 = self.driver.find_element_by_class_name(
            "android.widget.ListView")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -500, 100).perform()
        touch_actions.perform()
        self.logger.log("Choosing a notification")
        self.driver.find_elements_by_class_name(
            "android.widget.RelativeLayout")[13].click()
        sleep(1)
        self.appium_worker.screenshot("Notification")
        self.choice()
        element2 = self.driver.find_element_by_class_name(
            "android.widget.ListView")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -500, 100).perform()
        touch_actions.perform()
        self.logger.log("Choosing a notification")
        self.driver.find_elements_by_class_name(
            "android.widget.RelativeLayout")[11].click()
        sleep(1)
        self.appium_worker.screenshot("Notification")
        self.choice()
        element2 = self.driver.find_element_by_class_name(
            "android.widget.ListView")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -500, 100).perform()
        touch_actions.perform()
        #self.logger.log("Choosing a notification")
        #self.driver.find_elements_by_class_name("android.widget.RelativeLayout")[13].click()
        #sleep(1)
        #self.appium_worker.screenshot("Notification")
        #self.choice()
        sleep(1)
        self.logger.log("Clicking to go to Home page")
        self.driver.find_element_by_id("ivSubmenuHome").click()
        self.logger.log("TEST FINISHED", "green", 1, 2,
                        self.appium_worker.logger.getFileName())
Exemplo n.º 33
0
    def test(self):
        sleep(0.5)
        self.logger.log("************************************")
        sleep(1)
        self.logger.log('Delivered Orders test initialized', 'yellow')
        sleep(0.5)
        self.logger.log("**************************")
        user1 = "*****@*****.**"
        pass1 = "1q2w3e4r"
        err_flag = 0

        self.appium_worker.entrance_android()
        flag = 0
        while flag == 0:
            try:
                self.driver.find_element_by_id("ivSubmenuProfile")
                flag = 1
            except NoSuchElementException:
                sleep(1)
                flag = 0
        #self.driver.find_element_by_id("drawer_indicator").click()
        #sleep(1)
        #drawer = self.appium_worker.submenu()
        #if drawer == 2:
        #    self.logger.log("Scrolling up the screen")
        #    element2 = self.driver.find_element_by_class_name("android.widget.ListView")
        #    touch_actions = TouchActions(self.driver)
        #    touch_actions.flick_element(element2, 0, 1000, 100).perform()
        #    touch_actions.perform()
        #    sleep(1)
        #self.driver.find_element_by_class_name("android.widget.LinearLayout").click()
        self.logger.log("Clicking Inbox icon")
        self.driver.find_element_by_id("ivSubmenuInbox").click()
        sleep(1)
        self.logger.log("Clicking Delivered")
        self.driver.find_element_by_id("llDelivered").click()
        flag = 0
        while flag == 0:
            try:
                self.driver.find_element_by_class_name(
                    "android.widget.ListView")
                flag = 1
            except NoSuchElementException:
                flag = 0
                sleep(2)
        # sleep(5)
        element2 = self.driver.find_element_by_class_name(
            "android.widget.ListView")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -500, 100).perform()
        touch_actions.perform()
        self.logger.log("Choosing a package")
        self.driver.find_elements_by_id("rlRoot")[3].click()
        p1 = self.driver.find_element_by_id("tvContent")
        p2 = self.driver.find_element_by_id("tvEntryDate")
        p3 = self.driver.find_element_by_id("tvDepartureDate")
        p4 = self.driver.find_element_by_id("tvDeliveryDate")
        self.logger.log("Content: " + p1.text)
        sleep(0.5)
        self.logger.log("Entry date: " + p2.text)
        sleep(0.5)
        self.logger.log("Departure date: " + p3.text)
        sleep(0.5)
        self.logger.log("Delivered date: " + p4.text)
        self.appium_worker.screenshot("package")
        self.driver.find_element_by_id("tvBottom").click()
        element2 = self.driver.find_element_by_class_name(
            "android.widget.ListView")
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -500, 100).perform()
        touch_actions.perform()
        self.logger.log("Choosing a package")
        self.driver.find_elements_by_id("rlRoot")[5].click()
        p1 = self.driver.find_element_by_id("tvContent")
        p2 = self.driver.find_element_by_id("tvEntryDate")
        p3 = self.driver.find_element_by_id("tvDepartureDate")
        p4 = self.driver.find_element_by_id("tvDeliveryDate")
        self.logger.log("Content: " + p1.text)
        sleep(0.5)
        self.logger.log("Entry date: " + p2.text)
        sleep(0.5)
        self.logger.log("Departure date: " + p3.text)
        sleep(0.5)
        self.logger.log("Delivered date: " + p4.text)
        self.driver.find_element_by_id("tvBottom").click()
        self.driver.back()
        self.driver.back()
        self.logger.log("TEST FINISHED", "green", 1, 2,
                        self.appium_worker.logger.getFileName())
Exemplo n.º 34
0
    def test(self):
        sleep(0.5)
        self.logger.log("************************************")
        sleep(0.5)
        self.logger.log('Buy For Me initialized', 'yellow')
        sleep(0.5)
        self.logger.log("********************************")
        user1 = "*****@*****.**"
        pass1 = "1q2w3e4r"
        promotion_false = "SHIPMENTTEST"
        promotion_correct = "SHIPMENTTEST062016"
        pay_price = 0.0
        flag2 = 0
        flag_err = 0

        self.appium_worker.entrance_android()
        self.appium_worker.bekle_android("drawer_indicator")
        self.logger.log("Clicking left sub menu")
        # CHANGE LANGUAGE
        # flag = 0
        # while flag == 0:
        #    try:
        #        self.driver.find_element_by_id("ivSubmenuProfile")
        #        flag = 1
        #    except NoSuchElementException:
        #        sleep(1)
        #        flag = 0
        # self.logger.log("Clicking 'PROFILE' button")
        # self.driver.find_element_by_id("ivSubmenuProfile").click()
        # self.logger.log("Clicking 'SETTINGS' button")
        # self.driver.find_element_by_id("ivSettings").click()
        # self.logger.log("Clicking 'LANGUAGE' to change language of application")
        # self.driver.find_element_by_id("tvLanguage").click()
        # sleep(2)
        # m1 = self.driver.find_element_by_id("tvLanguage").text
        # self.logger.log("Language changed to : " + str(m1))
        # self.logger.log("Going back")
        # self.driver.back()
        # self.logger.log("Clicking 'HOME' button")
        # self.driver.find_element_by_id("ivSubmenuHome").click()

        # BUY FOR ME
        self.driver.find_element_by_id("drawer_indicator").click()
        self.driver.find_elements_by_class_name(
            "android.widget.LinearLayout")[16].click()
        flag = 0
        while flag == 0:
            try:
                self.driver.find_elements_by_id("tvFinalizeOrder")
                flag = 1
            except NoSuchElementException:
                print "wait"
                sleep(1)
                flag = 0

        try:
            self.driver.find_element_by_id("ivAdd")
            flag2 = 1
        except NoSuchElementException:
            sleep(0.5)
        try:
            self.driver.find_element_by_class_name("android.widget.ScrollView")
            flag2 = 2
        except NoSuchElementException:
            sleep(0.5)
        if flag2 == 2:
            self.logger.log("Scrolling down to read 'Buy For Me' details")
            element2 = self.driver.find_element_by_class_name(
                "android.widget.ScrollView")
            touch_actions = TouchActions(self.driver)
            touch_actions.flick_element(element2, 0, -500, 100).perform()
            touch_actions.perform()
            sleep(1)
        self.logger.log("Clicking 'PREVIOUS ORDERS' button")
        self.driver.find_element_by_id("rlPrevious").click()
        self.appium_worker.bekle_android("tvWhatToBuy")
        self.logger.log("Opening one of the orders")
        self.driver.find_elements_by_class_name(
            "android.widget.RelativeLayout")[1].click()
        self.appium_worker.bekle_android("tvSiteAmount")
        self.logger.log("**********************************")
        m1 = self.driver.find_element_by_id("tvSiteAmount").text
        m2 = self.driver.find_element_by_id("tvCollectedAmount").text
        m3 = self.driver.find_element_by_id("tvOrderDate").text
        m4 = self.driver.find_element_by_id("tvPurchaseDate").text
        self.logger.log("Amount of shopping : " + self.funct_decode(str(m1)))
        self.logger.log("Amount that will be collected : " +
                        self.funct_decode(str(m2)))
        self.logger.log("Date of order : " + self.funct_decode(str(m3)))
        self.logger.log("Date bought : " + self.funct_decode(str(m4)))
        self.logger.log("************************************")
        self.logger.log("Going back")
        self.driver.back()
        self.driver.find_element_by_id("rlNewBFM").click()
        flag = 0
        # while flag == 0:
        #    m1 = self.driver.find_element_by_id("tvHeader").text
        #    print self.funct_decode(m1)
        #    if str(self.funct_decode(m1)) is "BUY FOR ME":
        #        print "AAA"
        #        flag = 1
        #    else:
        #        sleep(1)
        #        flag = 0
        # self.appium_worker.bekle_android("tvBfmDetailHeader")
        flag = 0
        while flag == 0:
            try:
                self.driver.find_element_by_id("tvAddFirstProduct")
                flag = 1
            except NoSuchElementException:
                try:
                    self.driver.find_element_by_id("tvFinalizeOrder")
                    flag = 1
                except NoSuchElementException:
                    sleep(1)
                    flag = 0

        print "aa"
        try:
            self.driver.find_element_by_id("tvAddFirstProduct")
            self.logger.log("No orders were placed on the list")
            flag1 = 1
        except NoSuchElementException:
            try:
                self.driver.find_element_by_id("tvFinalizeOrder")
                self.logger.log("Order already created")
                flag1 = 2
            except NoSuchElementException:
                sleep(0.5)
        if flag1 == 1:
            self.logger.log("Clicking to crate a order")
            self.driver.find_element_by_id("tvAddFirstProduct").click()
            self.logger.log("Entering the URL of the product")
            self.driver.find_element_by_id("etProductUrl").send_keys("link")
            self.driver.back()
            self.logger.log("Entering the details of the product")
            self.driver.find_element_by_id("etProductProperties").send_keys(
                "clothes")
            self.driver.back()
            self.logger.log("Selecting the delivery type")
            self.driver.find_element_by_id("tvSpinner").click()
            self.driver.find_elements_by_id("tvSpinner")[1].click()
            sleep(0.5)
            m1 = self.driver.find_element_by_id("tvSpinner").text
            self.logger.log("Type of delivery selected is : " +
                            self.funct_decode(m1))
            self.logger.log("Clicking ADD")
            self.driver.find_element_by_id("tvAdd").click()
            sleep(3)
            try:
                self.driver.find_element_by_id("tvAdd")
                flag = 1
            except NoSuchElementException:
                sleep(1)
                flag = 0
            if flag == 1:
                self.driver.find_element_by_id("tvAdd").click()
            self.appium_worker.bekle_android("tvFinalizeOrder")
            self.logger.log("Clicking to finalize order")
            self.driver.find_element_by_id("tvFinalizeOrder").click()
            # self.logger.log("Trying to add product without adding link")
            # self.logger.log("Clicking ADD")
            # self.driver.find_element_by_id("tvAdd").click()
            # sleep(0.5)
            # self.appium_worker.screenshot("Empty_link_field")
            # self.driver.find_element_by_id("tvAddFirstProduct").click()
            # self.logger.log("Adding link field 'link'")
            # self.driver.find_element_by_id("etProductUrl").send_keys("link")
            # self.driver.back()
            # self.logger.log("Trying to add product without adding details")
            # self.logger.log("Clicking ADD")
            # self.driver.find_element_by_id("tvAdd").click()
            # sleep(0.5)
            # self.appium_worker.screenshot("Empty_details_field")
            # self.driver.find_element_by_id("tvAddFirstProduct").click()
            # self.logger.log("Adding product details 'clothes'")
            # self.logger.log("Adding link field 'link'")
            # self.driver.find_element_by_id("etProductUrl").send_keys("link")
            # self.driver.find_element_by_id("etProductProperties").send_keys("clothes")
            # self.driver.back()
            # self.logger.log("Clicking ADD")
            # self.driver.find_element_by_id("tvAdd").click()
        if flag1 == 2:
            self.logger.log("Clicking to Complete Order")
            self.driver.find_element_by_id("tvFinalizeOrder").click()
            # count_prod = 0
            # flag = 0
            # elem = self.driver.find_element_by_id("favGrid")
            # while flag == 0:
            #    print count_prod
            #    try:
            #        elem.find_elements_by_class_name("android.widget.LinearLayout")[count_prod]
            #        flag = 0
            #        flag1 = 1
            #    except NoSuchElementException:
            #        sleep(0.5)
            #        flag = 1
            #    if flag1 == 1:
            #        count_prod += 1
            site_amount = 100.0
            app_amount = 0

        self.appium_worker.bekle_android("etSiteAmount")
        self.logger.log("Entering ammount to be paid to the site : " +
                        str(site_amount))
        self.driver.find_element_by_id("etSiteAmount").send_keys("100")
        self.logger.log("Calculating the amount that will be taken")
        self.logger.log("Clicking CALCULATE")
        self.driver.find_element_by_id("tv2").click()
        sleep(2)
        m1 = self.driver.find_element_by_id("tvTotalAmount").text
        self.logger.log("Amount calculated as : " + str(m1))
        m2 = m1[1:4]
        m3 = m1[5:]
        app_amount = float(m2 + "." + m3)
        elem = self.driver.find_element_by_id("favGrid")
        if app_amount > (site_amount * 1.0596) + 15:
            self.logger.log("There are more than 5 products on the BFM list")
            count_prod = 0
            left = app_amount - ((site_amount * 1.0596) + 15)
            left = str(left)
            left = left[0:1]
            aa = int(left)
            count_prod = aa / 3
            count_prod += 4
            try:
                elem.find_elements_by_class_name(
                    "android.widget.LinearLayout")[count_prod]
                flag2 = 1
            except NoSuchElementException:
                sleep(0.5)
                flag2 = 0
            if flag2 == 1:
                self.logger.log("Amount calculated correctly")
        elif app_amount == (site_amount * 1.0596) + 15:
            self.logger.log("Amount calculated correctly")
        self.logger.log("Clicking to continue")
        self.driver.find_element_by_id("tvContinue").click()
        sleep(2)
        self.logger.log("Entering card holder name 'Test'")
        self.driver.find_element_by_id("etCardHolderName").send_keys("Test" +
                                                                     "\n")
        self.logger.log("Entering card holder surname 'Surname'")
        self.driver.find_element_by_id("etCardHolderSurName").send_keys(
            "Surname" + "\n")
        self.logger.log("Entering the card number '4090700214269159'")
        self.driver.find_element_by_id("etCardNumber").send_keys(
            "4090700214269159")
        self.logger.log("Selecting expire date")
        self.driver.find_element_by_id("tvExpireDate").click()
        # self.driver.find_elements_by_id("numberpicker_input")[1].send_keys("2017")
        self.driver.find_elements_by_id("numberpicker_input")[0].click()
        element2 = self.driver.find_elements_by_id("numberpicker_input")[1]
        touch_actions = TouchActions(self.driver)
        touch_actions.flick_element(element2, 0, -200, 100).perform()
        touch_actions.perform()
        self.logger.log("Clicking Ok")
        self.driver.find_element_by_id("btnOk").click()
        self.logger.log("Entering CCV number '494'")
        self.driver.find_element_by_id("etCCV").send_keys(494)
        self.driver.back()
        self.driver.find_element_by_id("tvOK").click()
        self.appium_worker.bekle_android("tvConfirmText")
        # sleep(8)
        sleep(1)
        self.appium_worker.screenshot("BFM_Completed")
        self.driver.back()
        self.driver.back()
        self.logger.log("TEST FINISHED", "green", 1, 2,
                        self.appium_worker.logger.getFileName())

        if flag_err == 0:
            self.logger.log("Test finished without errors \n")
        else:
            self.logger.log("Test finished with  %d errors \n" % flag_err)
Exemplo n.º 35
0
    )
except Exception:
    pass

print('  waiting key instruction...')
blank = cv2.waitKey(0)
blank = blank - 48
print('    key:', blank)

print('  performing keypad inputs...')
touch = TouchActions(driver)
for c in os.getenv('skpaypw'):
    code = int(c)
    key = code if code > blank else code - 1
    key = str(key)
    touch.tap(driver.find_element_by_id('keypad11pay-keypad-' + key))
    print('    interpreted: keypad11pay-keypad-' + key)

if os.getenv('purchase') == '1':
    touch.perform()
    WebDriverWait(driver,
                  10).until(EC.presence_of_element_located((By.ID, 'popup')))
    driver.find_element_by_css_selector('#popup button').click()
    WebDriverWait(driver,
                  10).until(EC.element_to_be_clickable(
                      (By.ID, 'btn-req-auth')))
    driver.find_element_by_id('btn-req-auth').click()

driver.switch_to.default_content()
print('\nDONE.')
 def long_press(self, tag_name, id_or_name):
     """ Long press the element """
     driver = self._current_application()
     element = self._find_element_by_tag_name(tag_name, id_or_name)
     long_press = TouchActions(driver).long_press(element)
     long_press.perform()
Exemplo n.º 37
0
 def test(self):
     sleep(0.5)
     self.logger.log("************************************")
     sleep(0.5)
     self.logger.log('Share test initialized', 'yellow')
     sleep(0.5)
     self.logger.log("*****************************", 'green')
     self.appium_worker.entrance_android()
     self.appium_worker.bekle_android("drawer_indicator")
     self.logger.log("Opening left sub-menu")
     self.driver.find_element_by_id("drawer_indicator").click()
     sleep(1)
     self.logger.log("Scrolling down")
     element2 = self.driver.find_element_by_class_name(
         "android.widget.RelativeLayout")
     touch_actions = TouchActions(self.driver)
     touch_actions.flick_element(element2, 0, -1000, 100).perform()
     touch_actions.perform()
     sleep(1)
     self.logger.log("Clicking Share")
     self.driver.find_elements_by_class_name(
         "android.widget.LinearLayout")[12].click()
     self.appium_worker.bekle_android("tvContacts")
     self.logger.log("Clicking With Contact button")
     self.driver.find_element_by_id("tvContacts").click()
     self.appium_worker.bekle_android("tvShare")
     self.logger.log("Clicking Share without selecting any contact")
     self.driver.find_element_by_id("tvShare").click()
     sleep(0.5)
     self.logger.log("Watning message shown", 'green')
     self.appium_worker.screenshot("No_contacts")
     # self.driver.find_element_by_id("etSearch").send_keys("test")
     sleep(1)
     self.logger.log("Selecting a contact")
     self.driver.find_elements_by_class_name(
         "android.widget.RelativeLayout")[1].click()
     self.logger.log("Clicking Share button")
     self.driver.find_element_by_id("tvShare").click()
     sleep(0.5)
     self.appium_worker.screenshot("Invitation_sms")
     sleep(1)
     #self.driver.find_element_by_id("tvFacebook").click()
     ## sleep(6)
     #fl3 = 0
     #while fl3 == 0:
     #    try:
     #        self.driver.find_element_by_class_name("android.widget.ImageView")
     #        fl3 = 1
     #    except NoSuchElementException:
     #        fl3 = 0
     #self.driver.find_element_by_class_name("android.widget.ImageView").click()
     self.appium_worker.bekle_android("tvEmail")
     self.logger.log("Clicking Via Invitation button")
     self.driver.find_element_by_id("tvEmail").click()
     self.appium_worker.bekle_android("custom")
     self.logger.log("Clicking Send without entering e-mail")
     self.driver.find_element_by_id("button1").click()
     self.appium_worker.bekle_android("tvPositive")
     self.appium_worker.screenshot("No_email")
     self.logger.log("Clicking OK")
     self.driver.find_element_by_id("tvPositive").click()
     self.appium_worker.bekle_android("tvEmail")
     self.logger.log("Clicking Via Invitation button")
     self.driver.find_element_by_id("tvEmail").click()
     self.appium_worker.bekle_android("custom")
     self.logger.log("Entering e-mail")
     self.driver.find_element_by_id("custom").send_keys("*****@*****.**")
     self.driver.back()
     self.logger.log("Clicking Send")
     self.driver.find_element_by_id("button1").click()
     self.driver.back()
     self.driver.back()
     sleep(1)
     self.driver.back()
     self.logger.log("TEST FINISHED", "green", 1, 2,
                     self.appium_worker.logger.getFileName())
Exemplo n.º 38
0
 def scroll_to(cls, web_element):
     ta = TouchActions(cls.driver)
     coords = web_element.location_once_scrolled_into_view
     ta.scroll(coords.get("x"), coords.get("y"))
     ta.perform()
Exemplo n.º 39
0
def swipe_left(duration=1):
    WebDriverWait(driver, 10).until(
        ExpectedConditions.presence_of_element_located((By.ID, get_element_id("drag_area"))))
    pager = find_element_by_id('drag_area');
    flick = TouchActions(driver).flick_element(pager, -1000, 0, 70);
    flick.perform();
Exemplo n.º 40
0
def inputpw(driver, pw):
    # get window size
    scr_width = driver.get_window_size()['width']
    scr_height = driver.get_window_size()['height']
    # define key sise
    key_width = 0.0785*scr_width   #  0.0785 = key_width / scr_width
    key_height = 0.0679*scr_height #  0.0679 = key_height / scr_height
    gap_x_ratio = 0.0220         # gap_x_ratio = 25/src_width
    gap_y_ratio = 0.0165        # gap_y_ratio = 30/scr_height
    q_pos_x = 0.0074*scr_width
    q_pos_y = 0.6640*scr_height
    a_pos_x = 0.0574*scr_width
    z_pos_x = 0.1574*scr_width

    pos_map_x = {}
    pos_map_y = {}
    #line Q
    pos_map_x['q'] = q_pos_x + key_width/2
    pos_map_y['q'] = q_pos_y + key_height/2
    pos_map_x['w'] = q_pos_x + 1*key_width + 1*gap_x_ratio*scr_width + key_width/2 
    pos_map_y['w'] = q_pos_y + key_height/2
    pos_map_x['e'] = q_pos_x + 2*key_width + 2*gap_x_ratio*scr_width + key_width/2
    pos_map_y['e'] = q_pos_y + key_height/2
    pos_map_x['r'] = q_pos_x + 3*key_width + 3*gap_x_ratio*scr_width + key_width/2
    pos_map_y['r'] = q_pos_y + key_height/2
    pos_map_x['t'] = q_pos_x + 4*key_width + 4*gap_x_ratio*scr_width + key_width/2
    pos_map_y['t'] = q_pos_y + key_height/2
    pos_map_x['y'] = q_pos_x + 5*key_width + 5*gap_x_ratio*scr_width + key_width/2
    pos_map_y['y'] = q_pos_y + key_height/2
    pos_map_x['u'] = q_pos_x + 6*key_width + 6*gap_x_ratio*scr_width + key_width/2
    pos_map_y['u'] = q_pos_y + key_height/2
    pos_map_x['i'] = q_pos_x + 7*key_width + 7*gap_x_ratio*scr_width + key_width/2
    pos_map_y['e'] = q_pos_y + key_height/2
    pos_map_x['o'] = q_pos_x + 8*key_width + 8*gap_x_ratio*scr_width + key_width/2
    pos_map_y['o'] = q_pos_y + key_height/2
    pos_map_x['p'] = q_pos_x + 9*key_width + 9*gap_x_ratio*scr_width + key_width/2
    pos_map_y['p'] = q_pos_y + key_height/2
    #line A
    pos_map_x['a'] = a_pos_x + key_width/2
    pos_map_y['a'] = q_pos_y + gap_y_ratio*scr_height + key_height + key_height/2
    pos_map_x['s'] = a_pos_x + 1*key_width + 1*gap_x_ratio*scr_width + key_width/2
    pos_map_y['s'] = q_pos_y + gap_y_ratio*scr_height + key_height + key_height/2
    pos_map_x['d'] = a_pos_x + 2*key_width + 2*gap_x_ratio*scr_width + key_width/2
    pos_map_y['d'] = q_pos_y + gap_y_ratio*scr_height + key_height + key_height/2
    pos_map_x['f'] = a_pos_x + 3*key_width + 3*gap_x_ratio*scr_width + key_width/2
    pos_map_y['f'] = q_pos_y + gap_y_ratio*scr_height + key_height + key_height/2
    pos_map_x['g'] = a_pos_x + 4*key_width + 4*gap_x_ratio*scr_width + key_width/2
    pos_map_y['g'] = q_pos_y + gap_y_ratio*scr_height + key_height + key_height/2
    pos_map_x['h'] = a_pos_x + 5*key_width + 5*gap_x_ratio*scr_width + key_width/2
    pos_map_y['h'] = q_pos_y + gap_y_ratio*scr_height + key_height + key_height/2
    pos_map_x['j'] = a_pos_x + 6*key_width + 6*gap_x_ratio*scr_width + key_width/2
    pos_map_y['j'] = q_pos_y + gap_y_ratio*scr_height + key_height + key_height/2
    pos_map_x['k'] = a_pos_x + 7*key_width + 7*gap_x_ratio*scr_width + key_width/2
    pos_map_y['k'] = q_pos_y + gap_y_ratio*scr_height + key_height + key_height/2
    pos_map_x['l'] = a_pos_x + 8*key_width + 8*gap_x_ratio*scr_width + key_width/2
    pos_map_y['l'] = q_pos_y + gap_y_ratio*scr_height + key_height + key_height/2
    #line Z
    pos_map_x['z'] = z_pos_x + key_width/2
    pos_map_y['z'] = q_pos_y + 2*gap_y_ratio*scr_height + 2*key_height + key_height/2
    pos_map_x['x'] = z_pos_x + 1*key_width + 1*gap_x_ratio*scr_width + key_width/2
    pos_map_y['x'] = q_pos_y + 2*gap_y_ratio*scr_height + 2*key_height + key_height/2
    pos_map_x['c'] = z_pos_x + 2*key_width + 2*gap_x_ratio*scr_width + key_width/2
    pos_map_y['c'] = q_pos_y + 2*gap_y_ratio*scr_height + 2*key_height + key_height/2
    pos_map_x['v'] = z_pos_x + 3*key_width + 3*gap_x_ratio*scr_width + key_width/2
    pos_map_y['v'] = q_pos_y + 2*gap_y_ratio*scr_height + 2*key_height + key_height/2
    pos_map_x['b'] = z_pos_x + 4*key_width + 4*gap_x_ratio*scr_width + key_width/2
    pos_map_y['b'] = q_pos_y + 2*gap_y_ratio*scr_height + 2*key_height + key_height/2
    pos_map_x['n'] = z_pos_x + 5*key_width + 5*gap_x_ratio*scr_width + key_width/2
    pos_map_y['n'] = q_pos_y + 2*gap_y_ratio*scr_height + 2*key_height + key_height/2
    pos_map_x['m'] = z_pos_x + 6*key_width + 6*gap_x_ratio*scr_width + key_width/2
    pos_map_y['m'] = q_pos_y + 2*gap_y_ratio*scr_height + 2*key_height + key_height/2
    #line digit: same as line A
    pos_map_x['1'] = q_pos_x + key_width/2
    pos_map_y['1'] = q_pos_y + key_height/2
    pos_map_x['2'] = q_pos_x + 1*key_width + 1*gap_x_ratio*scr_width + key_width/2 
    pos_map_y['2'] = q_pos_y + key_height/2
    pos_map_x['3'] = q_pos_x + 2*key_width + 2*gap_x_ratio*scr_width + key_width/2
    pos_map_y['3'] = q_pos_y + key_height/2
    pos_map_x['4'] = q_pos_x + 3*key_width + 3*gap_x_ratio*scr_width + key_width/2
    pos_map_y['4'] = q_pos_y + key_height/2
    pos_map_x['5'] = q_pos_x + 4*key_width + 4*gap_x_ratio*scr_width + key_width/2
    pos_map_y['5'] = q_pos_y + key_height/2
    pos_map_x['6'] = q_pos_x + 5*key_width + 5*gap_x_ratio*scr_width + key_width/2
    pos_map_y['6'] = q_pos_y + key_height/2
    pos_map_x['7'] = q_pos_x + 6*key_width + 6*gap_x_ratio*scr_width + key_width/2
    pos_map_y['7'] = q_pos_y + key_height/2
    pos_map_x['8'] = q_pos_x + 7*key_width + 7*gap_x_ratio*scr_width + key_width/2
    pos_map_y['8'] = q_pos_y + key_height/2
    pos_map_x['9'] = q_pos_x + 8*key_width + 8*gap_x_ratio*scr_width + key_width/2
    pos_map_y['9'] = q_pos_y + key_height/2
    pos_map_x['0'] = q_pos_x + 9*key_width + 9*gap_x_ratio*scr_width + key_width/2
    pos_map_y['0'] = q_pos_y + key_height/2

    pos_map_x['upper'] = pos_map_x['q']
    pos_map_y['upper'] = pos_map_y['z']
    pos_map_x['digit'] = pos_map_x['q']
    pos_map_y['digit'] = q_pos_y + 3*gap_y_ratio*scr_height + 3*key_height + key_height/2
    pos_map_x['ok'] = pos_map_x['m']
    pos_map_y['ok'] = pos_map_y['digit']

    pwmode = 'lower'
    '''
    pages = driver.find_element_by_xpath("//Button[@id='btnMainWallet']") 
    touch_actions = TouchActions(driver)
    touch_actions.flick_element(pages,0,-100,0).perform()
    print "flick ok!!!!!!!!!!!!!"
    '''

    for letter in pw:
        if letter >= 'a' and letter <= 'z':
            if pwmode !='lower':
                touch_actions = TouchActions(driver)
                touch_actions.tap_and_hold(pos_map_x['upper'],pos_map_y['upper'])
                touch_actions.release(pos_map_x['upper'],pos_map_y['upper'])
                touch_actions.perform()
                pwmode = 'lower'
            touch_actions = TouchActions(driver)
            touch_actions.tap_and_hold(pos_map_x[letter],pos_map_y[letter])
            touch_actions.release(pos_map_x[letter],pos_map_y[letter])
            touch_actions.perform()
        elif letter >= 'A' and letter <= 'Z':
            if pwmode !='upper':
                touch_actions = TouchActions(driver)
                touch_actions.tap_and_hold(pos_map_x['upper'],pos_map_y['upper'])
                touch_actions.release(pos_map_x['upper'],pos_map_y['upper'])
                touch_actions.perform()
                pwmode = 'upper'
            letter = chr(ord(letter) + 32)
            touch_actions = TouchActions(driver)
            touch_actions.tap_and_hold(pos_map_x[letter],pos_map_y[letter])
            touch_actions.release(pos_map_x[letter],pos_map_y[letter])
            touch_actions.perform()
        elif letter >= '0' and letter <= '9':
            if pwmode !='digit':
                touch_actions = TouchActions(driver)
                touch_actions.tap_and_hold(pos_map_x['digit'],pos_map_y['digit'])
                touch_actions.release(pos_map_x['digit'],pos_map_y['digit'])
                touch_actions.perform()
                pwmode = 'digit'
            touch_actions = TouchActions(driver)
            touch_actions.tap_and_hold(pos_map_x[letter],pos_map_y[letter])
            touch_actions.release(pos_map_x[letter],pos_map_y[letter])
            touch_actions.perform()
        else:
            print "unsupport sign now!"
            return 0
    touch_actions = TouchActions(driver)
    touch_actions.tap_and_hold(pos_map_x['ok'],pos_map_y['ok'])
    touch_actions.release(pos_map_x['ok'],pos_map_y['ok'])
    touch_actions.perform()
    return 1
Exemplo n.º 41
0
 def test(self):
     self.appium_worker.entrance()
     try:
         self.driver.find_element_by_id("ivSubmenuWhatToBuy")
         flag1 = 1
     except:
         try:
             self.driver.find_element_by_id("fancyCoverFlow")
             flag1 = 2
         except NoSuchElementException:
             sleep(1)
     if flag1 == 1:
         self.logger.log("Clicking What To Buy button")
         self.appium_worker.bekle("ivSubmenuWhatToBuy")
         self.driver.find_element_by_id("ivSubmenuWhatToBuy").click()
     if flag1 == 2:
         sleep(1)
     self.logger.log("fancy")
     #self.appium_worker.bekle("fancyCoverFlow")
     self.driver.find_elements_by_class_name("android.widget.Gallery")[0]
     self.driver.find_elements_by_id("ivIcon")[0].click()
     self.logger.log("Scrolling icon menu")
     element = self.driver.find_elements_by_class_name(
         "android.widget.Gallery")[0]
     touch_actions = TouchActions(self.driver)
     touch_actions.flick_element(element, -500, 0, 50).perform()
     touch_actions.perform()
     sleep(3)
     self.driver.find_elements_by_id("ivIcon")[0].click()
     sleep(3)
     self.logger.log("Scrolling list menu")
     element1 = self.driver.find_elements_by_class_name(
         "android.widget.Gallery")[1]
     touch_actions = TouchActions(self.driver)
     touch_actions.flick_element(element1, -400, 0, 100).perform()
     touch_actions.perform()
     sleep(3)
     self.driver.find_elements_by_id("textView")[1].click()
     sleep(3)
     self.logger.log("Scrolling down items")
     element2 = self.driver.find_element_by_class_name(
         "android.widget.GridView")
     touch_actions = TouchActions(self.driver)
     touch_actions.flick_element(element2, 0, -500, 100).perform()
     touch_actions.perform()
     sleep(3)
     self.logger.log("Scrolling icon menu")
     self.driver.find_elements_by_id("gridview")[0].click()
     el2 = self.driver.find_elements_by_class_name(
         "android.widget.Gallery")[0]
     touch_actions = TouchActions(self.driver)
     touch_actions.flick_element(el2, -200, 0, 50).perform()
     touch_actions.perform()
     self.driver.find_elements_by_id("ivIcon")[2].click()
     sleep(1)
     self.logger.log("Scrolling down items")
     el3 = self.driver.find_element_by_class_name("android.widget.GridView")
     touch_actions = TouchActions(self.driver)
     touch_actions.flick_element(el3, 0, -500, 100).perform()
     touch_actions.perform()
     element2 = self.driver.find_elements_by_class_name(
         "android.widget.Gallery")[0]
     touch_actions = TouchActions(self.driver)
     touch_actions.flick_element(element2, -1000, 0, 50).perform()
     touch_actions.perform()
     self.driver.find_elements_by_id("ivIcon")[2].click()
     sleep(1)
     self.logger.log("Searching for 'ayak'")
     self.driver.find_element_by_id("etSearch").send_keys("ayak")
     self.logger.log("Clicking to search")
     self.driver.find_element_by_id("tvSearch").click()
     sleep(3)
     self.driver.back()
     self.appium_worker.bekle("tvName")
     self.appium_worker.screenshot("search.png")
     self.driver.back()
     self.driver.back()
     self.logger.log("TEST FINISHED", "green", 1, 2,
                     self.appium_worker.logger.getFileName())