Example #1
0
def step_impl(context):
    page = BasePage(context.driver)
    context.driver.maximize_window()
    WebDriverWait(context.driver, 15).until(
        expected_conditions.visibility_of_all_elements_located(
            BasePageLocators.H1))
    assert page.h1.is_displayed()
Example #2
0
def step_impl(context):
    #1 title_tag = context.browser.find_element(By.TAG_NAME, 'h1')
    #2 title_tag = context.browser.find_element(*HomePageLocators.TITLE)  #1 * deconstructs tuple
    #6 page = HomePage(context.browser) #2
    page = BasePage(context.driver)  #6
    #2 assert title_tag.is_displayed()
    assert page.title.is_displayed()  #2
def step_impl(context):
    # title_tag = context.driver.find_element(By.TAG_NAME, 'h1')
    # title_tag = context.driver.find_element(*HomepageLocators.TITLE)   # find_element expects 2 args; * enables that the tuple gets deconstructed into 2 separate elements and pass them to the method
    # not needed after adding the page model and locators file
    page = BasePage(context.driver)
    assert page.title.is_displayed(
    )  # check that it is visible, not only present on the page
Example #4
0
def step_impl(context, content):
    # HomePageLocators.TITLE is a tuple but the method is looking for 2 args
    # so we use * to unpack the tuple
    # title_tag = context.browser.find_element(*HomePageLocators.TITLE)

    page = BasePage(context.driver)
    assert page.title.text == content
def step_impl(context, link_text):
    page = BasePage(context.driver)
    links = page.dropdown_links
    matching_links = [l for l in links if l.text == link_text]
    if len(matching_links) > 0:
        matching_links[0].click()
    else:
        raise RuntimeError()
Example #6
0
def step_impl(context):
    # HomePageLocators.TITLE is a tuple but the method is looking for 2 args
    # so we use * to unpack the tuple
    # title_tag = context.browser.find_element(By.TAG_NAME, 'h1')
    #title_tag = context.browser.find_element(*HomePageLocators.TITLE)

    page = BasePage(context.driver)
    assert page.title.is_displayed()
Example #7
0
def step_impl(context, link_text):
    page = BasePage(context.driver)
    links = page.navigation
    matching_links = [l for l in links if l.text == link_text]
    if len(matching_links) > 0:
        matching_links[0].click()
    else:
        raise RuntimeError('The {} link does not exist'.format(link_text))
Example #8
0
def step_impl(context, link_text):
    page = BasePage(context.browser)
    links = page.navigation

    matching_links = [l for l in links if l.text == link_text]
    if len(matching_links) > 0:
        matching_links[0].click()
    else:
        raise RuntimeError()
def step_impl(context, link_text):
    # link = context.driver.find_element_by_id(link_id)
    page = BasePage(context.driver)
    links = page.navigation
    # find right link
    matching_links = [l for l in links if l.text == link_text]
    if len(matching_links) > 0:
        matching_links[0].click()
    else:
        raise RuntimeError()
Example #10
0
def step_impl(context, link_text):
    page = BasePage(context.driver)
    links = page.navigation

    matching_links = [l for l in links if l.text == link_text]

    if len(matching_links) > 0:
        matching_links[0].click()
    else:
        raise RuntimeError(f'Matching link ({link_text!r}) not found')
def step_impl(context, link_text):
    page = BasePage(context.driver)
    links = page.links

    found_links = [l for l in links if l.text == link_text]

    if len(found_links) > 0:
        found_links[0].click()
    else:
        raise RuntimeError()
def step_implementation(context, link_text):
    page = BasePage(context.driver)
    nav_links = page.navigation
    for link in nav_links:
        print("found link text:" + link.text)
        print("desired link text:" + link_text)
        if link.text == link_text:
            link.click()
            return

    raise RuntimeError(f"Link with text {link_text} not found on {context.driver.current_url}")
Example #13
0
def step_impl(context, link_text):
    page = BasePage(context.driver)
    links = page.navigation
    print(links)

    matching_links = [l for l in links if l.text == link_text]

    if len(matching_links) > 0:
        matching_links[0].click()
    else:
        return RuntimeError()
def step_impl(context, link_text):
    page = BasePage(context.browser)
    links = page.navigation

    matching_links = [l for l in links if l.text == link_text]
    # provides a list of objects found by selenium where the text of the link is equal to what we've passed in
    # i.e. what the user wants to click per the acceptance tests
    if len(matching_links) > 0:
        matching_links[0].click()
    else:
        raise RuntimeError()
def step_impl(context, page_name):
    page = HomePage(context.driver)
    base_page = BasePage(
        context.driver)  # not required to do like this, but just showing
    if page_name == 'home_page':
        assert context.driver.current_url == page.url
        assert base_page.email.is_displayed()
    elif page_name == 'cookies_page':
        WebDriverWait(context.driver, 10).until(
            expected_conditions.url_matches(page.cookies_link))
        assert context.driver.current_url == page.cookies_link
        assert base_page.email.is_displayed()
def step_impl(context, link_text):
    page = BasePage(context.driver)
    links = page.top_menu
    matching_links = []
    for l in links:
        if l.text == link_text:
            matching_links.append(l)

    # matching_links = [link for link in links if link.text == link_text]

    if len(matching_links) > 0:
        matching_links[0].click()
    else:
        raise RuntimeError()
Example #17
0
def step_impl(
        context,
        link_text):  # link_text is placeholder for "(.*)" in each when step
    page = BasePage(
        context.driver)  # we call the generic Base page context driver
    links = page.navigation  # then return all navigation links

    # build list of links that matches our link_text
    matching_links = [l for l in links if l.text == link_text]

    if len(matching_links) > 0:
        matching_links[0].click()
    else:
        raise RuntimeError()
def step_impl(context, content):
    # title_tag = context.driver.find_element(By.TAG_NAME, 'h1')
    # title_tag = context.driver.find_element(*HomepageLocators.TITLE) # not needed after adding the page model and locators file
    page = BasePage(context.driver)
    assert page.title.text == content
def step_impl(context):
    page = BasePage(context.driver)
    assert page.clear_button.is_displayed()
    assert page.download_button.is_displayed()
    assert page.predict_button.is_displayed()
Example #20
0
def step_impl(context):
    page = BasePage(context.driver)
    page.submit_button.click()
Example #21
0
def step_impl(context, content):
    page = BasePage(context.driver)
    assert page.title.text == content
Example #22
0
def step_impl(context, content, field_name):
    page = BasePage(context.driver)
    page.form_field(field_name).send_keys(content)
Example #23
0
def step_impl(context, field_name):
    page = BasePage(context.driver)
    page.form_field(field_name).click()
Example #24
0
def step_impl(context, link_text):
    page = BasePage(context.driver)
    links = page.dropdown_links
    matching_links = [l for l in links if l.text == link_text]
    matching_links[0].click()
Example #25
0
def step_impl(context):
    page = BasePage(context.driver)
    page.dropdown.click()
Example #26
0
def step_impl(context):
    page = BasePage(context.driver)
    page.login.click()
Example #27
0
def step_impl(context):
    context.driver = webdriver.Chrome(
        'C:/chromedriver.exe')  ## path to chromedriver
    page = BasePage(context.driver)
    context.driver.get(page.url)
Example #28
0
def step_impl(context):
    # title_tag = context.browser.find_element(*HomePageLocators.TITLE) # * is used for unpacking tuple TITLE
    page = BasePage(
        context.driver)  # it's improved version of previous line of code
    assert page.title.is_displayed()
Example #29
0
def step_impl(context):
    page = BasePage(context.driver)
    assert page.title.is_displayed()
def step_impl(context):
    expected_url = BasePage(context.driver).url
    assert context.driver.current_url == expected_url