def click_client(self):
     client_xpath = self.table_xpath + '//td[1]'
     client = Find(by=By.XPATH, value=client_xpath, context=self)
     client_name = client.text
     client.click()
     self.wait_for_loading(10)
     return client_name
Exemplo n.º 2
0
class ChannelPayrollPage(BasePage):
    url = 'https://ci004.godo.io/channel_payroll.aspx'
    channel_payment_due = Find(by=By.XPATH, value="//a[@id='payrolldetailplus_']")
    channel_paid = Find(by=By.XPATH, value="//a[@id='paymentPaidChannel']")
    channel_entries = Finds(by=By.XPATH, value="//tbody[@ng-repeat='payment in vm.channelPaymentDue track by $index']")
    channel_names = Finds(by=By.XPATH, value="//tbody[@ng-repeat='payment in vm.channelPaymentDue track by $index']")
    channel_paid_entries = Finds(by=By.XPATH, value="//tr[@ng-repeat='payment in vm.channelPaid track by $index']")
    channel_paid_amounts = Finds(by=By.XPATH, value="//*[@id='dtChannelPaid']/tbody/tr/td[4]")
    channel_detail = Finds(by=By.XPATH, value="//a[@ng-click='vm.showDetails(payment.channelId)']")
    direct_deposit = Finds(by=By.XPATH, value="//input[@value='directdeposit']")
    cash = Finds(by=By.XPATH, value="//input[@value='cash']")
    check = Finds(by=By.XPATH, value="//input[@value='check']")
    check_number = Finds(by=By.XPATH, value="//input[@type='text']")
    pay_button = Finds(by=By.XPATH, value="//button[@ng-click='vm.commitChannelPayment(payment)']")
    OK_button = Find(by=By.XPATH, value="//button[@ng-click='vm.cancel()']")




    guide_list = Find(by=By.XPATH, value="//select[@id='selectGuides']")
    event_due = Finds(by=By.XPATH, value ="//*[contains(@id,'guidePayroll')]/tbody/tr[1]/td[6]")
    activity_timedate = Finds(by=By.XPATH, value ="//a[contains(@ng-click,'vm.openManifest')]")

    show_entries = Find(by=By.XPATH, value="//select[@name='guidePayrollAll_length']")
    payment_entry = Finds(by=By.XPATH, value="//tr[@class='row']|//tr[@class='odd']|//tr[@class='even']")
Exemplo n.º 3
0
class LoginPage(BasePage):

    def __init__(self, domain, *args, **kwargs):
        super().__init__(url=domain, *args, **kwargs)

    # Base login page.

    login_input = Find(by=By.NAME, value="username")
    password_input = Find(by=By.NAME, value="password")
    login_button = Find(by=By.CSS_SELECTOR, value="input[type=submit]")

    # Page to select company for call center user. ccu_companyList.aspx

    logout_button = Find(by=By.XPATH, value="//a[@href='/login.aspx?command=logout']")
    company_list = Finds(CompanyList, by=By.XPATH, value="//tbody/tr")

    def choose_company(self, company):
        for item in self.company_list:
            title = item.company_name.text
            if title == company:
                item.login_button.click()
                break

    def get_url(self):
        return self._driver.current_url
Exemplo n.º 4
0
class GrouponPage(BasePage):
    import_codes = Find(by=By.XPATH,
                        value="//div[@name='inputCodeForm']//button")
    groupon_list = Finds(GrouponList, by=By.XPATH, value="//tbody/tr")
    details = Find(by=By.XPATH, value="//a[text()='Details']")
    view_redemptions = Find(by=By.XPATH,
                            value="//a[text()='View Redemptions']")
    view_codes = Find(by=By.XPATH, value="//a[text()='View Codes']")
    code_list_not_redeemed = Finds(CodeList,
                                   by=By.XPATH,
                                   value="//td[text()=0]/..")
    code_list_redeemed = Finds(CodeList,
                               by=By.XPATH,
                               value="//td[text()=1]/..")

    def select_groupon(self, name):
        for item in self.groupon_list:
            if item.groupon_name.text == name:
                item.edit_button.click()
                break

    def copy_code(self, order):
        for item in self.code_list_not_redeemed:
            if item.redeemed.text == "0":
                order.promo_code = item.code.text
                break

    def copy_redeemed_code(self, order):
        for item in self.code_list_redeemed:
            if item.redeemed.text == "1":
                order.promo_code = item.code.text
                break
Exemplo n.º 5
0
class Day(WebElement):
    date = Find(by=By.XPATH,
                value="./div[@class='cal_month_day_date ng-binding']")
    events_list = Finds(Event,
                        by=By.XPATH,
                        value=".//div[@class='cal_week_event ng-scope']")
    view_all = Find(by=By.XPATH, value=".//a[text()='[View All]']")
Exemplo n.º 6
0
class PaymentsPage(BasePage):
    '''Объект страницы платежи

    search_input {WebElemnt} - Поле для поиска по названию или ИНН
    communal_payment {WebElemnt} - ссылка на выбор категории "ЖКХ"
    proposal_list {WebElemnt} - список совпадений, при вводе значений в search_input
    '''

    search_input = Find(
        by=By.CSS_SELECTOR, value="input[placeholder*='Название или ИНН получателя']"
        )
    communal_payment = Find(by=By.CSS_SELECTOR, value="div[aria-label='ЖКХ'")
    proposal_list = Finds(by=By.CSS_SELECTOR, value="div[data-qa-file='GridColumn']")

    def proposal_list_text(self):
        """Возвращает текст элементов из списка совпадений

        Returns:
            [List]
        """
        return [provider.text for provider in self.proposal_list]

    def stateless_input(self, name):
        """Поиск по названию/ИНН. После ввода в поискову строку, ожидает появление списка совпадений

        Arguments:
            name {str} -- [Название/ИНН]
        """

        self.search_input.send_keys(name)
        wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div[data-qa-file='GridColumn']")))
Exemplo n.º 7
0
class SearchForm(BasePage):
    min_price_input = Find(by=By.XPATH, value="//input[@name='price_before']")
    max_price_input = Find(by=By.XPATH, value="//input[@name='price_after']")
    show_results = Find(
        by=By.XPATH,
        value="//div[contains(@class, 'ModelFilter__ParamListBtnSel')]//span")

    def select_brand(self, brand):
        Find(by=By.XPATH,
             value="//div[@id='Attr_prof_1000']//label[text()='{}']".format(
                 brand),
             context=self).click()
        LOGGER.info("Brand has been set to '%s'", brand)

    def select_min_price(self, min_price):
        self.min_price_input.send_keys(min_price)
        LOGGER.info("Min price has been set to '%s'", min_price)

    def select_max_price(self, max_price):
        self.max_price_input.send_keys(max_price)
        LOGGER.info("Max price has been set to '%s'", max_price)

    def click_show_results(self):
        self.show_results.click()
        LOGGER.info("Click show results button")
Exemplo n.º 8
0
class ProductEntry:
    def __init__(self, product_entry):
        self.a_link = Find(by=By.CSS_SELECTOR,
                           value="a.s-access-detail-page",
                           context=product_entry)
        self.name = Find(by=By.CSS_SELECTOR,
                         value="h2.s-access-title",
                         context=product_entry).get_attribute('data-attribute')
        self.dash_name = '-'.join(self.name.split(' '))
        self.url = self.a_link.get_attribute('href')

    def get_asin(self):
        return urlparse(self.url).path.split('/')[3]

    def get_unquoted_product_part(self):
        return unquote(urlparse(self.url).path.split('/')[1])

    @allure.step
    def check_url(self):
        logging.info(self.dash_name + '\n' + self.get_unquoted_product_part())
        return self.dash_name.startswith(self.get_unquoted_product_part())

    @allure.step
    def check_asin(self):
        asin = self.get_asin()
        logging.info(asin + ' ' + self.url)
        return len(asin) == 10 and set(asin).issubset(
            set("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"))

    @allure.step
    def open_details_page(self):
        self.a_link.click()
        return DetailsPage(self.get_asin())
class ModelsPage(AbstractBasePage, unittest.TestCase):
    createdModelsHeader = Find(by=By.XPATH,
                               value='.//*[text()="Created Models"]')
    targetModel = Find(by=By.XPATH, value='.//*[text()="Model for autotest"]')
    archiveButtonForTargetModel = Find(
        by=By.XPATH,
        value='.//*[text()="Model for autotest"]/following::*[text()="Archive"]'
    )

    def __init__(self):
        AbstractBasePage.__init__(
            self, "https://advisors.stratifi.com/advisor/models")

# --------------Clicks-----------------------

    def press_archive_button_for_target_model(self):
        self.archiveButtonForTargetModel.click()

# ---------------Asserts-------------------------------

    def check_models_page_loaded(self):
        assert self.is_element_present(
            "createdModelsHeader", timeout=10), "Models page was not loaded"

    def check_if_created_model_is_in_the_list(self):
        assert self.is_element_present(
            "targetModel", timeout=10), "Unable to find a target model"

    def check_if_target_model_was_deleted(self):
        self.assertFalse(self.is_element_present("targetModel", timeout=10),
                         "Target model was not deleted")
Exemplo n.º 10
0
class CartPage(BasePage):
    order = Find(
        by=By.CSS_SELECTOR,
        value=
        "a[class='button-style button-style_primary button-style_small cart-form__button']"
    )
    order_form = Find(by=By.CSS_SELECTOR, value="div[class='cart-form__flex']")
    remove = Find(
        by=By.XPATH,
        value=
        "//div[@class='cart-form__offers-part cart-form__offers-part_remove']/div/a"
    )
    remove_field = Find(by=By.XPATH,
                        value="//div[@class='cart-form__control']//input")

    def click_order_link(self):
        wait(self.order.is_displayed)
        self.order.click()

    def click_remove_field(self):
        wait(self.remove_field.is_displayed)
        self.remove_field.click()

    def click_remove(self):
        wait(self.remove.is_displayed)
        self.remove.click()
Exemplo n.º 11
0
class LoginPage(KibanaBasePage):
    '''
    Kibana Login Page
    '''

    username_field = Find(**data_test_subj('loginUsername'))
    password_field = Find(**data_test_subj('loginPassword'))
    login_button = Find(**data_test_subj('loginSubmit'))

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

    def loaded(self):
        wait(lambda: self.is_element_present('username_field') is True)

    def enter_username(self, name):
        self.username_field.clear()
        self.username_field.send_keys(name)

    def enter_password(self, password):
        self.password_field.clear()
        self.password_field.send_keys(password)

    def click_submit(self):
        self.login_button.click()

    def login(self, username, password):
        self.open()
        self.loaded()
        self.enter_username(username)
        self.enter_password(password)
        self.click_submit()
Exemplo n.º 12
0
class CatalogPage(BasePage):
    subsections = Finds(by=By.XPATH, value="//ul[@class='catalog-bar__list']/li/a")
    subsection_page_header = Find(by=By.CSS_SELECTOR, value="h1[class='schema-header__title']")
    products = Finds(by=By.XPATH, value="//a[@data-bind='attr: {href: product.html_url}']/span/..")
    compare_button = Find(by=By.CSS_SELECTOR, value="a[class ='compare-button__sub compare-button__sub_main']")
    remove_compare_icon = Find(by=By.CSS_SELECTOR, value="a[title='Очистить список сравнения']")
    remove_compare_button = Find(by=By.CSS_SELECTOR, value="a[class='compare-button__sub']")

    def click_subsection_link(self, index):
        self.subsections[index].click()

    def click_product_link(self, index):
        wait(self.subsection_page_header.is_displayed)
        self.products[index].click()

    def click_compare(self):
        wait(self.compare_button.is_displayed)
        self.compare_button.click()

    def click_remove_compare_icon(self):
        wait(self.remove_compare_icon.is_displayed)
        self.remove_compare_icon.click()

    def click_remove_compare_button(self):
        wait(self.remove_compare_button.is_displayed)
        self.remove_compare_button.click()
Exemplo n.º 13
0
class ResultItem(WebElement):
    title = Find(by=By.XPATH, value=".//span[@itemprop='name']")
    min_price = Find(by=By.XPATH,
                     value=".//span[@class='PriceBlock__PriceValue']/span")
    max_price = Find(
        by=By.XPATH,
        value=".//span[contains(@class, 'PriceBlock__PriceLastValue')]/span")
class PackagesCreatePage(AbstractBasePage):
    createPackageHeader = Find(by=By.XPATH,
                               value='.//*[text()="Create a Package"]')
    packageNameField = Find(by=By.XPATH, value='.//*[@name="description"]')
    templateDropdown = Find(by=By.XPATH,
                            value='.//*[text()="Select template"]/parent::*')
    atLeastOneAccount = Find(by=By.XPATH, value='.//td[text()="1"]')
    firstStrategy = Find(by=By.XPATH, value='.//*[text()="StratiFi RE RR"]')

    def __init__(self):
        AbstractBasePage.__init__(
            self, "http://operations.stratifi.com/packages/create")

    # ------------Clicks------------------------------

    def select_the_first_strategy(self):
        self.firstStrategy.click()

    # ------------Send Keys------------------------------

    def enter_package_name(self, package_name):
        self.packageNameField.send_keys(package_name)

    # ---------------Asserts-------------------------------

    def check_if_there_is_at_least_one_account(self):
        assert self.is_element_present(
            "atLeastOneAccount",
            timeout=60), "There are no accounts for selected strategy"

    def check_if_create_a_package_page_is_loaded(self):
        assert self.is_element_present(
            "createPackageHeader",
            timeout=10), "Create package page was not loaded"
Exemplo n.º 15
0
 def remove_assignment(self, assignment_value):
     self.wait_for_loading()
     remove_assignment_button = Find(by=By.XPATH, value='//li[contains(text(),"{}")]/span'.format(assignment_value),
                                     context=self)
     remove_assignment_button.click()
     self.update.click()
     self._driver.refresh()
Exemplo n.º 16
0
 def navigate_created_group(self):
     created_group_btn_xpath = self.created_group_btn_xpath.format(self._sections[-1], self._groups[-1])
     created_group_btn = Find(
         by=By.XPATH, value=created_group_btn_xpath, context=self)
     created_group_btn.click()
     self.wait_for_loading()
     self.wait_for_ember()
     return GroupPage()
Exemplo n.º 17
0
class DocumentsPage(AbstractBasePage, unittest.TestCase):
    reviewDocumentsHeader = Find(
        by=By.XPATH,
        value='.//*[@class="container"]/child::*[text()="Review Documents"]')
    markAsSubmittedFirst = Find(by=By.XPATH,
                                value='(.//*[text()="Mark as submitted"])[1]')
    markAsSubmittedSecond = Find(by=By.XPATH,
                                 value='(.//*[text()="Mark as submitted"])[2]')
    markAsSubmittedThird = Find(by=By.XPATH,
                                value='(.//*[text()="Mark as submitted"])[3]')
    sendButton = Find(by=By.XPATH, value='.//*[text()="Send"]')
    almostThereHeader = Find(by=By.XPATH, value='.//*[text()="Almost there!"]')
    sendButtonOnAlmostThereScreen = Find(
        by=By.XPATH,
        value='.//*[text()="Almost there!"]/following::*[text()="Send"]')
    congrats = Find(by=By.XPATH, value='.//*[text()="Congratulations!"]')
    okButton = Find(by=By.XPATH, value='.//*[text()="OK"]')
    linkAccBreadCrumb = Find(by=By.XPATH, value='.//*[text()="Link Accounts"]')

    def __init__(self):
        AbstractBasePage.__init__(
            self,
            "https://advisors.stratifi.com/advisor/investors/17/documents")

# --------------Clicks-----------------------

    def mark_all_documents_as_signed(self):
        self.markAsSubmittedFirst.click()
        self.markAsSubmittedSecond.click()
        self.markAsSubmittedThird.click()

    def press_send_button(self):
        self.sendButton.click()

    def press_ok_button(self):
        self.okButton.click()

    def press_send_button_on_almost_there_screen(self):
        self.sendButtonOnAlmostThereScreen.click()

    def press_link_acc_breadcrumb(self):
        self.linkAccBreadCrumb.click()

# ---------------Asserts-------------------------------

    def check_if_documents_page_is_loaded(self):
        assert self.is_element_present(
            "reviewDocumentsHeader",
            timeout=20), "Unable to load Review Documents Page"

    def check_if_almost_there_shown(self):
        assert self.is_element_present(
            "almostThereHeader",
            timeout=20), "Almost there! screen was not shown"

    def check_if_congrats_massage_was_shown(self):
        assert self.is_element_present(
            "congrats", timeout=20), "Congratulations! message was not shown"
Exemplo n.º 18
0
class MainPage(BasePage):
    ver_label = Find(by=By.XPATH, value='//*[@id="verNo"]/div')
    reboot_link_btn = Find(by=By.LINK_TEXT, value="Reboot")
    reboot_ok_btn = Find(by=By.XPATH, value="//button[@class='button green']")
    label_list = Finds(
        by=By.XPATH,
        value=
        '//div[@class="ant-col ant-form-item-control-wrapper"]/div/span/div/div[@class="ant-row"]/div[1]'
    )
Exemplo n.º 19
0
class CalendarPage(BasePage):
    days_list = Finds(Day,
                      by=By.XPATH,
                      value="//div[@class='cal_month_day ng-scope']")
    without_booking = Find(by=By.XPATH,
                           value="//label[@for='hide-without-booking']")
    preloader_image = Find(by=By.XPATH,
                           value="//img[@src='/assets/images/preloader.gif']")
    view_all_links = Finds(by=By.XPATH, value=".//a[text()='[View All]']")
Exemplo n.º 20
0
 def __init__(self, product_entry):
     self.a_link = Find(by=By.CSS_SELECTOR,
                        value="a.s-access-detail-page",
                        context=product_entry)
     self.name = Find(by=By.CSS_SELECTOR,
                      value="h2.s-access-title",
                      context=product_entry).get_attribute('data-attribute')
     self.dash_name = '-'.join(self.name.split(' '))
     self.url = self.a_link.get_attribute('href')
Exemplo n.º 21
0
 def add_object(self, object_title):
     self.wait_for_element_to_be_clickable(element={'type': 'xpath', 'value': self.add_object_btn_xpath})
     add_object_btn = Find(by=By.XPATH, value=self.add_object_btn_xpath, context=self)
     add_object_btn.click()
     object_title_field = self.get_input_by_label('Title')
     self.clear_send_keys(object_title_field, object_title)
     self.create_object_btn.click()
     self.wait_for_loading()
     self.wait_for_ember()
     return ObjectPage()
Exemplo n.º 22
0
 def random_event(self):
     random_number = random.randint(1, 20)
     join_link = Find(
         by=By.XPATH,
         value=
         "//div[@class='afishaList complete']//div[@class='date__content']["
         + str(random_number) + "]//div["
         "@class='date__text inline-top']/a",
         context=self)
     join_link.click()
Exemplo n.º 23
0
class Price(BasePage):
    min = Find(Textfield, By.XPATH, value='//*[@id="price[min]"]')
    max = Find(Textfield, By.XPATH, value='//*[@id="price[max]"]')
    ok = Find(by=By.ID, value='submitprice')

    def price(self, min, max):
        self.min.send_keys(min)
        self.min.send_keys(Keys.TAB)
        self.max.send_keys(max)
        self.ok.click()
Exemplo n.º 24
0
 def add_group(self, group_data):
     add_group_btn = Find(by=By.XPATH, value=self.add_group_btn_xpath.format(self._sections[-1]), context=self)
     add_group_btn.click()
     group_name_field = self.get_input_by_label('Group Name')
     self.clear_send_keys(group_name_field, group_data.get('group_name'))
     description_field = self.get_input_by_label('Description')
     self.clear_send_keys(description_field, group_data.get('description'))
     self.add_btn.click()
     self._set_group(group_data.get('group_name'))
     self.wait_for_invisibility_of_element(element={'type': 'xpath', 'value': self.group_form_xpath})
Exemplo n.º 25
0
 def link_is_present(self):
     try:
         ticket_link = Find(by=By.XPATH,
                            value="//div[@class='performance__ticket']/a",
                            context=self)
         ticket_link.click()
     except:
         print(
             "Возможная причина прерывания теста, из-за того, что к данному событию нет билетов, а есть "
             "кнопка 'Оставить "
             "заявку.")
 def get_filtered_data(self, table_name, column):
     self.replace_bad_elements()
     column_name = self.row_names_selects_map.get(column, column)
     column = Find(
         by=By.XPATH,
         value='//span[contains(., "{}")]/../..//div[.="{}"]/parent::th'.format(table_name, column_name),
         context=self
     )
     column_id = column.get_attribute('id')
     rows = Finds(by=By.CSS_SELECTOR, value='td[aria-describedby="{}"]'.format(column_id), context=self)
     rows_text = [r.text for r in rows]
     return set(filter(lambda x: x.strip() and 'Clients' not in x, rows_text))
 def get_row_data_widget(self):
     service = Find(Select, by=By.ID, value='serviceid', context=self)
     fiscal_year = Find(Select, by=By.ID, value='finyearid', context=self)
     data = {
         'first_name': self.first_name_field.get_attribute('value'),
         'last_name': self.last_name_field.get_attribute('value'),
         'email': self.email_field.get_attribute('value'),
         'fiscal_year': fiscal_year.get_text_selected(),
         'service': service.get_text_selected(),
         'amount': self.amount_field.get_attribute('value')
     }
     return data
Exemplo n.º 28
0
 def filter_data(self, filter_name, filter_value):
     filter_element = getattr(self, filter_name + '_filter')
     if filter_name == 'status':
         self.status_filter.click()
         value = Find(by=By.XPATH, value='//option[text()="{}"]'.format(filter_value), context=self)
         value.click()
         self.status_filter.send_keys(keys.Keys.RETURN)
     else:
         filter_element.clear()
         filter_element.send_keys(filter_value)
         filter_element.send_keys(keys.Keys.RETURN)
     self.wait_for_loading()
Exemplo n.º 29
0
class LoginPage(BasePage):
    username_input = Find(by=By.CSS_SELECTOR, value="input[type='text'][placeholder='Ник или e-mail']")
    password_input = Find(by=By.CSS_SELECTOR, value="input[type='password']")
    submit_button = Find(by=By.XPATH, value="//div/button")

    def type_username(self, username):
        self.username_input.send_keys(username)

    def type_password(self, password):
        self.password_input.send_keys(password)

    def click_submit(self):
        self.submit_button.click()
Exemplo n.º 30
0
class JakDojadePage(BasePage):
    url = 'https://jakdojade.pl/wroclaw/trasa/'

    from_field = Find(by=By.CSS_SELECTOR, value='.cn-direction-a input')
    to_field = Find(by=By.CSS_SELECTOR, value='.cn-direction-b input')
    find_routes = Find(by=By.CSS_SELECTOR,
                       value='#cn-planner button.cn-planner-action-button')

    header = Find(by=By.CSS_SELECTOR, value='header')

    routes = Finds(RoutePropositionWidget,
                   By.CSS_SELECTOR,
                   value='.cn-planner-routes-results')
Exemplo n.º 31
0
class GooglePage(BasePage):
    url = "https://www.google.com"
    search_field = Find(by=By.NAME, value="q")
    search_button = Find(by=By.NAME, value="btnK")

    def open(self):
        BasePage.open(self)
        assert "Google" in get_driver_no_init().title

    def search(self, text_to_search):
        self.search_field.send_keys(text_to_search)
        self.search_field.submit()
        return ResultPage()
class RequestOFFPage(BasePage):

    url = 'https://ci004.godo.io/guide_requestOff.aspx'
    request_off_entry = Finds(
        by=By.XPATH,
        value="//tr[@class='row']|//tr[@class='odd']|//tr[@class='even']")
    approval_dropdown = Finds(
        by=By.XPATH, value="//select[contains(@id, 'requestoff_status_')]")
    not_approved_button = Find(by=By.XPATH,
                               value="//label[@class ='btn btn-danger']")
    approved_button = Find(by=By.XPATH,
                           value="//label[@class ='btn btn-success']")
    tables = Finds(by=By.XPATH, value="//table[@id = 'dtRequestOff']")
    rows = Finds(by=By.XPATH, value="//*[@id='dtRequestOff']/tbody/tr")
Exemplo n.º 33
0
class MainPage(BasePage):

    account_button = Find(by=By.XPATH, value="//*[@id='gb']/div[1]/div[1]/div[2]/div[5]/div[1]/a")
    logout_button = Find(by=By.XPATH, value="//*/a[contains(text(), 'Выйти')]")

    def __init__(self, driver):
        self.driver = driver
        self.wait = WebDriverWait(driver, 10)
        super(MainPage, self).__init__(url="https://mail.google.com/mail/#inbox", driver=driver)

    def logout(self):
        self.account_button.click()
        self.wait.until(expected_conditions.visibility_of(self.logout_button))
        self.logout_button.click()
Exemplo n.º 34
0
    def __init__(self, asin):
        super(DetailsPage, self).__init__(driver=Driver.get())
        self.list_asin = asin
        self.asin = Find(by=By.XPATH,
                         value="//li[b[contains(text(), 'ASIN:')]]",
                         context=self).text.split(':')[1].strip()
        self.string_date_first = Find(
            by=By.XPATH,
            value=
            "//li[b[contains(text(), 'Date first available at Amazon.com.au:')]]",
            context=self).text.split(':')[1].strip()

        self.date_first = datetime.strptime(self.string_date_first, "%d %B %Y")
        self.body = Find(by=By.TAG_NAME, value="body", context=self)
Exemplo n.º 35
0
class LaptopsPageLocators(BasePage):
    laptops_name = Finds(by=By.XPATH,
                         value='.//*[@class="ModelFilter__CheckboxLink"]/a')

    laptops_price_min_input = Find(by=By.CSS_SELECTOR, value="#minnum_45")
    laptops_price_max_input = Find(by=By.CSS_SELECTOR, value="#maxnum_45")

    show_laptops_diagonal_results = Find(
        by=By.XPATH, value=".//*[@id='Attr_prof_5828']/div/div[2]/span[1]")
    show_laptops_name_results = Find(
        by=By.XPATH, value=".//*[@id='Attr_prof_1000']/div/div[2]/span[1]")

    diagonal_checkbox = Finds(by=By.XPATH,
                              value='.//*[@class="ModelFilter__CheckboxLink"]')
Exemplo n.º 36
0
class SitePage(BasePage):
    new_page_link = Find(Link, by=By.XPATH, value='//a[@href="/new/"]')
    cart_link = Find(Link,
                     by=By.XPATH,
                     value='//a[@class="trigger" and @href="/cart/"]')

    def open_cart_page(self):
        self.cart_link.click()

        return CartPage(self._driver)

    def open_new_products_page(self):
        self.new_page_link.click()

        return NewPage(self._driver)
Exemplo n.º 37
0
class FlightResultsPage(BasePage):
    flightList = Find(by=By.XPATH, value='.//div[@id="flight-listings"]')
    flightPrice = Find(by=By.XPATH,
                       value='(.//article[contains(@class,"contract-block")]/descendant::strong[contains(@id,'
                             '"TOTALFARE")]/span)[1]')

    def validate_flight_results_page_is_displayed(self):
        self.is_element_present("flightList", timeout=30), "flightList was not displayed"
        assert "air/Listing/" in self._driver.current_url, "Flights list url is not right"

    def validate_price_from_first_result_is_more_than_zero(self):
        self.is_element_present("flightPrice", timeout=10), "Can't find flightPrice"
        # Get price value from first result
        price = self.flightPrice.get_attribute('defaultvalue')
        assert price > 0, "Price value should be positive"
Exemplo n.º 38
0
 def open_page_number(
     self, number
 ):  #TODO make smart pagination navigation that doesn't depend on current state
     current_page = Find(by=By.CSS_SELECTOR,
                         value="span.pagnCur",
                         context=self)
     logging.info(' '.join([current_page.text, str(number)]))
     if current_page.text == str(number):
         pass
     else:
         xpath_page_link = '//span[contains(@class, "pagnLink")]/a[contains(text(), "%d")]' % number
         logging.info(xpath_page_link)
         page_link = Find(by=By.XPATH, value=xpath_page_link, context=self)
         page_link.click()
     self.update_product_list()
Exemplo n.º 39
0
 def add_filter(self, name, _filter, value):
     self.add_filter_btn.click()
     f = Find(by=By.XPATH, value=self.filter_name_xpath.format(name), context=self)
     f.click()
     inner_btn = Find(by=By.XPATH, value=self.filter_btn_xpath.format(name), context=self)
     inner_btn.click()
     self.filter_options_btn.click()
     filter_option = Find(by=By.XPATH, value=self.filter_option_xpath.format(_filter), context=self)
     filter_option.click()
     self.clear_send_keys(self.filter_value_field, value)
     self.form_update_btn.click()
     self.wait_for_loading()
Exemplo n.º 40
0
    def generate_report(self, name, report_type, report_format, fields):
        self.actions_btn.click()
        self.generate_report_btn.click()
        report_name_field = self.get_input_by_label('Report name')
        self.clear_send_keys(report_name_field, name)
        report_type_select = self.get_a_by_label('Report type')
        report_type_select.click()
        report_type = Find(by=By.XPATH, value=self.search_result_xpath.format(report_type), context=self)
        report_type.click()

        report_format_select = self.get_a_by_label('Report format')
        report_format_select.click()
        report_format = Find(by=By.XPATH, value=self.search_result_xpath.format(report_format), context=self)
        report_format.click()

        report_fields_input = self.get_input_by_label('Report Fields')

        for field in fields:
            report_fields_input.click()
            field = Find(by=By.XPATH, value=self.search_result_xpath.format(field), context=self)
            field.click()

        self.form_update_btn.click()
        self.wait_for_loading()
Exemplo n.º 41
0
 def update_user(self, user_username, user_info):
     self.filter_data('login', user_username)
     update_link = Find(by=By.XPATH, value="//a[contains(@href,'update?id={}')]".format(user_info['id']), context=self)
     update_link.click()
Exemplo n.º 42
0
 def get_item(self, item_name):
     item_name = item_name.replace(' ', '-').replace('/', '-').lower()
     item = Find(by=By.CSS_SELECTOR, value='section > a[href*="{}"]'.format(item_name), context=self)
     item.click()
     return ServiceItemPage()
Exemplo n.º 43
0
 def view_partner(self, partner_name, partner_info):
     self.filter_data('name', partner_name)
     update_link = Find(by=By.XPATH, value="//a[contains(@href,'update?id={}')]".format(partner_info['id']),
                        context=self)
     update_link.click()
Exemplo n.º 44
0
 def add_package(self, package_name):
     package = Find(by=By.XPATH, value='//td[contains(., "{}")]/a'.format(package_name), context=self)
     package.click()
     return package.get_attribute('data-id')
Exemplo n.º 45
0
 def choose_option(self, option):
     option = Find(by=By.XPATH, value='//option[.="{}"]'.format(option), context=self)
     option.click()
Exemplo n.º 46
0
 def view_product(self, product_title, product_info):
     self.filter_data('title', product_title)
     update_link = Find(by=By.XPATH, value="//a[contains(@href,'update?id={}')]".format(product_info['id']),
                        context=self)
     update_link.click()
Exemplo n.º 47
0
 def open_additional_page(self, text):
     link = Find(by=By.XPATH, value='//a[contains(text(),"{}")]'.format(text), context=self)
     link.click()
 def view_inventory_group(self, inventory_group_id):
     update_link = Find(by=By.XPATH, value="//a[contains(@href,'update?id={}')]".format(inventory_group_id),
                        context=self)
     update_link.click()
 def delete_inventory_group(self, inventorygroup_info):
     delete_link = Find(by=By.XPATH, value="//a[contains(@href,'delete?id={}')]".format(inventorygroup_info['id']),
                        context=self)
     delete_link.click()
 def activate_first_client(self):
     switcher = Find(by=By.CSS_SELECTOR, value='.iSwitcher a', context=self)
     switcher.click()
     term = Find(by=By.XPATH, value='//span[.="Long Term"]', context=self)
     term.click()
     self.wait_for_loading(5)
Exemplo n.º 51
0
 def open_page(self, text):
     self._driver.execute_script("$('a[target=_blank]').removeAttr('target')")
     link = Find(by=By.XPATH, value='//td/a[@href="/page/0/{}"]'.format(text), context=self)
     link.click()
 def click_transaction_plus(self):
     transaction_plus = Find(by=By.CSS_SELECTOR, value='.subgrid-data span.ui-icon-plus', context=self)
     transaction_plus.click()
     self.wait_for_loading(10)
Exemplo n.º 53
0
 def open_product(self, product_title):
     self._driver.execute_script("$('a[target=_blank]').removeAttr('target')")
     product_link = Find(by=By.XPATH, value='//a[text()="{}"]'.format(product_title), context=self)
     product_link.click()
Exemplo n.º 54
0
 def get_consultant(self, free=False):
     select_id = 'consultant_field' if not free else 'free_consultant_field'
     s = Find(Select, by=By.ID, value=select_id, context=self)
     return s.get_text_selected()
Exemplo n.º 55
0
 def view_opportunity(self, opportunity_id):
     update_link = Find(by=By.XPATH, value="//a[contains(@href,'update?id={}')]".format(opportunity_id),
                        context=self)
     update_link.click()
 def view_item(self, item_id):
     update_link = Find(by=By.XPATH, value="//a[contains(@href,'items/update?id={}')]".format(item_id),
                        context=self)
     update_link.click()
Exemplo n.º 57
0
 def remove_product(self, item_name):
     delete_btn = Find(by=By.XPATH, value='//tr[contains(., "{}")]//a'.format(item_name), context=self)
     delete_btn.click()
 def set_date(self, date_type, date_value):
     assert date_type.lower() in ['start', 'end']
     input_id = 'billing_searchMonthFrom' if date_type.lower() == 'start' else 'billing_searchMonthTo'
     date_field = Find(by=By.ID, value=input_id, context=self)
     date_field.clear()
     date_field.send_keys(date_value)
 def to_previous_page(self):
     time.sleep(4)
     page = Find(by=By.XPATH, value='//div[@id="clientsList"]//div[.=" <"]', context=self)
     page.click()
     time.sleep(2)
 def set_date_and_search(self):
     date_field = Find(by=By.CSS_SELECTOR, value='input[ng-model="billingDateFrom"]', context=self)
     date_field.clear()
     date_field.send_keys('2015-01-01')
     self.search_btn_click()
     time.sleep(5)