예제 #1
0
    def open_edit_job(self, link_index):
        wait_for_element(self.driver, '.nav-link', 10)

        nav_links = self.driver.find_elements_by_css_selector('.nav-link')
        nav_links[link_index].click()

        return JobEdit(self.driver)
예제 #2
0
 def _submit_login(self):
     wait_for_element(self.driver,
                      SUBMIT_BUTTON_SELECTOR,
                      timeout=ELEMENT_VISIBLE_TIMEOUT)
     submit_button = self.driver.find_element_by_css_selector(
         SUBMIT_BUTTON_SELECTOR)
     submit_button.click()
예제 #3
0
    def get_po(self):
        wait_for_element(self.driver, '.box-item-body', 10)

        box_items = self.driver.find_elements_by_css_selector('.w-20')
        conf = box_items[1].text.split("\n")

        return conf[1]
예제 #4
0
    def get_projects_names(self):
        wait_for_element(self.driver,
                         PROJECT_NAME_SELECTOR,
                         timeout=ELEMENT_VISIBLE_TIMEOUT)
        projects_names_elements = self.driver.find_elements_by_css_selector(
            PROJECT_NAME_SELECTOR)

        return [x.text for x in projects_names_elements]
예제 #5
0
    def get_form_errors(self):
        wait_for_element(self.driver,
                         FORM_ERRORS_SELECTOR,
                         timeout=ELEMENT_VISIBLE_TIMEOUT)
        form_errors_elements = self.driver.find_elements_by_css_selector(
            FORM_ERRORS_SELECTOR)

        return [x.text for x in form_errors_elements]
예제 #6
0
    def open_job(self, job_index):
        wait_for_element(
            self.driver,
            '.box-item-body.hover-item-body.cursor-pointer.radius', 20)
        jobs_links_elements = self.driver.find_elements_by_css_selector(
            '.box-item-body.hover-item-body.cursor-pointer.radius')
        jobs_links_elements[job_index].click()

        return JobDetails(self.driver)
예제 #7
0
    def submit_expecting_success(self):
        self._submit_btn()

        wait_for_element(self.driver, '#job', timeout=30)

        submit_btn = self.driver.find_element_by_css_selector('#job')
        submit_btn.click()

        return JobPage(self.driver)
예제 #8
0
    def type_password(self, password):
        wait_for_element(self.driver,
                         PASSWORD_FIELD_SELECTOR,
                         timeout=ELEMENT_VISIBLE_TIMEOUT)
        password_field = self.driver.find_element_by_css_selector(
            PASSWORD_FIELD_SELECTOR)

        clear_input(password_field)
        password_field.send_keys(password)

        return LoginPage(self.driver)
예제 #9
0
    def type_email(self, email):
        wait_for_element(self.driver,
                         EMAIL_FIELD_SELECTOR,
                         timeout=ELEMENT_VISIBLE_TIMEOUT)
        email_field = self.driver.find_element_by_css_selector(
            EMAIL_FIELD_SELECTOR)

        clear_input(email_field)
        email_field.send_keys(email)

        return LoginPage(self.driver)
예제 #10
0
    def get_project_name(self):
        wait_for_element(self.driver,
                         PROJECT_NAME_SKELETON_SELECTOR,
                         timeout=ELEMENT_VISIBLE_TIMEOUT)
        wait_for_element_disappeared(self.driver,
                                     PROJECT_NAME_SKELETON_SELECTOR,
                                     timeout=ELEMENT_VISIBLE_TIMEOUT)
        project_name_element = self.driver.find_element_by_css_selector(
            PROJECT_NAME_SELECTOR)

        return project_name_element.text
예제 #11
0
    def open_project(self, project_index):
        wait_for_element(self.driver,
                         PROJECT_LINK_SELECTOR,
                         timeout=ELEMENT_VISIBLE_TIMEOUT)
        projects_links_elements = self.driver.find_elements_by_css_selector(
            PROJECT_LINK_SELECTOR)

        current_url = self.driver.current_url
        projects_links_elements[project_index].click()

        wait_url_changed(self.driver, current_url, timeout=REDIRECT_TIMEOUT)
        return IssuesPage(self.driver)
예제 #12
0
def give_master_permissions(mail, password, master_user):
    with TenBisBrowser(implicitly_wait_seconds=7, is_visible=True, is_profile_dir=True, downloaded_data_dir=None) as browser:
        browser.get_browser().get("https://www.10bis.co.il/Account/UserAccountManagement")
        email_xpath = '/html/body/div[2]/table/tbody/tr/td/div/table/tbody/tr[3]/td[1]/div/div[3]/div/div[2]/div[1]/div[2]/input'
        wait_for_element(browser, email_xpath, By.XPATH)
        elem = browser.get_browser().find_element_by_xpath(email_xpath)
        elem.clear()
        elem.send_keys(mail)
        elem = browser.get_browser().find_element_by_xpath('/html/body/div[2]/table/tbody/tr/td/div/table/tbody/tr[3]/td[1]/div/div[3]/div/div[2]/div[2]/div[2]/input')
        elem.clear()
        elem.send_keys(password)
        enter = '/html/body/div[2]/table/tbody/tr/td/div/table/tbody/tr[3]/td[1]/div/div[3]/div/div[2]/div[4]'
        browser.get_browser().find_element_by_xpath(enter).click()
        id_xpath = '/html/body/div[2]/table/tbody/tr/td/div/div'
        wait_for_element(browser, id_xpath, By.XPATH)
        user_id = browser.get_browser().find_element_by_xpath(id_xpath).get_attribute('data-account-user-id')
        try:
            card = '/html/body/div[2]/table/tbody/tr/td/div/div/div[1]/div/div[1]'
            wait_for_element(browser, card, By.XPATH, timeout=4)
            browser.get_browser().find_element_by_xpath(card).click()
        except Exception:
            pass
        browser.get_browser().find_element_by_xpath('/html/body/div[2]/table/tbody/tr/td/div/div/div[2]/div[1]/div[1]/table/tbody/tr[2]/td[2]/table/tbody/tr[7]/td[2]/div').click()
        user = '******'
        wait_for_element(browser, user, By.XPATH)
        elem = browser.get_browser().find_element_by_xpath(user)
        elem.clear()
        elem.send_keys(master_user)
        time.sleep(3)
        browser.get_browser().find_element_by_xpath('//*[@id="userMcLinksInterfaceDiv"]/div/table[2]/tfoot/tr[2]/td[1]/div').click()
        log.debug("user id: %s" % user_id)
        return user_id
예제 #13
0
    def __init__(self, driver, independent: bool = True):
        super().__init__(driver)
        # merge all parent element locators with this element locators
        # ends up self.element_locators include all parent element locators
        self.element_locators = {
            **self.element_locators,
            **HeaderComponent.element_locators,
            **FooterComponent.element_locators,
        }

        if independent:
            self.driver.get(base_url)
            # need this one to avoid 'NosuchElementException'
            # - esp for when find element by link test
            # reference: https://stackoverflow.com/questions/6936149/how-to-use-find-element-by-link-text-properly-to-not-raise-nosuchelementexcept
            wait_for_element(self.driver, By.ID, 'root')
예제 #14
0
    def __init__(self, driver, independent: bool = True):
        """
            independent param: whether driver directory load this page independently (true) or load from another page (e.g., Home Page) as dependency
        """
        super().__init__(driver)
        # merge all parent element locators with this element locators
        # ends up self.element_locators include all parent element locators
        self.element_locators = {
            **self.element_locators,
            **HeaderComponent.element_locators,
            **FooterComponent.element_locators,
        }

        if independent:
            self.driver.get(signup_url)
            # need this one to avoid 'NosuchElementException'
            # - esp for when find element by link test
            # reference: https://stackoverflow.com/questions/6936149/how-to-use-find-element-by-link-text-properly-to-not-raise-nosuchelementexcept
            wait_for_element(self.driver, By.ID, 'root')
예제 #15
0
    def get_errors(self):
        wait_for_element(self.driver, 'button[type=button]', timeout=2)
        errors_elements = self.driver.find_elements_by_css_selector(
            'button[type=button]')

        return [x.text for x in errors_elements]
예제 #16
0
    def get_jobs_names(self):
        wait_for_element(self.driver, 'span.ce-ml-10', 20)
        jobs_names_elements = self.driver.find_elements_by_css_selector(
            'span.ce-ml-10')

        return [x.text for x in jobs_names_elements]
예제 #17
0
def order_meal(mail, password, restaurant_id, dish_id, loosers_ids):
    with TenBisBrowser(implicitly_wait_seconds=7, is_visible=True, is_profile_dir=True, downloaded_data_dir=None) as browser:
        browser.get_browser().get(rest_url_template % restaurant_id)
        signed_user = '******'
        wait_for_element(browser, signed_user, locator_type=By.XPATH)
        browser.get_browser().find_element_by_xpath(signed_user).click()
        email_xpth ='//*[@id="LogonPopupPartialView"]/div/div/div[4]/div[1]/div[2]/input'
        wait_for_element(browser, email_xpth, locator_type=By.XPATH)
        elem = browser.get_browser().find_element_by_xpath(email_xpth)
        elem.clear()
        elem.send_keys(mail)
        elem = browser.get_browser().find_element_by_xpath('//*[@id="LogonPopupPartialView"]/div/div/div[4]/div[2]/div[2]/input')
        elem.clear()
        elem.send_keys(password)
        time.sleep(3)
        browser.get_browser().find_element_by_xpath('//*[@id="LogonPopupPartialView"]/div/div/div[4]/div[4]').click()
        address = '//*[@id="chooseAddressListForm"]/div/table[1]/tbody/tr[1]/td[3]/div/span'
        wait_for_element(browser, address, locator_type=By.XPATH)
        time.sleep(2)
        browser.get_browser().find_element_by_xpath(address).click()
        dish_list = '//*[@id="myTabs"]/div[1]/div[1]/div/div[2]'
        wait_for_element(browser, dish_list, locator_type=By.XPATH)
        time.sleep(1)
        dishes =  browser.get_browser().find_element_by_xpath(dish_list).find_elements_by_xpath('//div[contains(@class,"dishesBox")]')
        for dish in dishes:
            if dish.get_attribute("data-dishid") == dish_id:
                dish.click()
                break
        else:
            raise Exception("did not find dish id %s" % dish_id)

        users = '//*[@id="dishContent"]/table/thead/tr/td[2]/div[3]'
        wait_for_element(browser, users, locator_type=By.XPATH)
        all_users = browser.get_browser().find_element_by_xpath('//*[@id="dishContent"]/table/thead/tr/td[2]/div[3]').find_elements_by_xpath("//select")[3].find_elements_by_tag_name("option")
        for user in all_users:
            if user.get_attribute("value") == loosers_ids[0]:
                user.click()
                break
        browser.get_browser().find_element_by_xpath('//*[@id="dishContent"]/table/tfoot/tr[3]/td/div[1]').click()
        shoppingCartBottom = '//*[@id="shoppingCartBottom"]/td/div'
        wait_for_element(browser, shoppingCartBottom, locator_type=By.XPATH)
        browser.get_browser().find_element_by_xpath(shoppingCartBottom).click()
        confirm = '//*[@id="orderConfirmationBtn"]'
        wait_for_element(browser, confirm, locator_type=By.XPATH)
        browser.get_browser().find_element_by_xpath(confirm).click()
예제 #18
0
    def input_po(self, po):
        wait_for_element(self.driver, 'po', 10)
        input_po = self.driver.find_element_by_name("po")

        clear_input(input_po)
        input_po.send_keys(po)