Пример #1
0
class GooglePageTest(unittest.TestCase):
    google = "https://www.google.pl/"
    search_bar = "lst-ib"
    lucky_find = "//*[@value='Szczęśliwy traf']"
    about_us = "//*[@id='fsl'/a[3]"
    keyboard_id = 'kbd'

    def setUp(self):
        self.driver = webdriver.Firefox()
        self.driver.get(self.google)
        self.driver.maximize_window()
        self.google_page = GooglePage(self.driver)

    def test_simple_search(self):
        self.google_page.input_text(self.search_bar, "pyrkon\n")
        self.driver.implicitly_wait(3)
        current_url = self.driver.current_url
        self.assertEqual(current_url, "https://www.google.pl/#q=pyrkon")

    def test_is_keyboard_visible(self):
        self.google_page.open_keyboard()
        self.driver.implicitly_wait(3)
        self.assertTrue(self.driver.find_element_by_id(self.keyboard_id).is_displayed())

    def tearDown(self):
        self.driver.quit()
Пример #2
0
def test_dispatcher(browser):
    main_page = MainPage(browser)
    main_page.open_base_page()
    main_page.try_it_click_button()
    fire_page = FirePage(browser)
    fire_page.open_fire_page()
    fire_page.find_enter_element_field()
    fire_page.search_button_click()
    fire_page.targeted_address()
    fire_page.targeted_address_id()
    browser.get('https://www.google.by/maps/@53.706657,27.747712,7z?hl=ru')
    google_page = GooglePage(browser)
    google_page.enter_google()
    google_page.button_search_click()
    google_page.google_address()
    sleep(5)
Пример #3
0
 def setUp(self):
     self.driver = webdriver.Firefox()
     self.driver.get(self.google)
     self.driver.maximize_window()
     self.google_page = GooglePage(self.driver)
from behave import *
from pages.google_page import GooglePage
from nose.tools import assert_equal

googlePage = GooglePage()


@given('que acesso a página do Google')
def step_impl(context):
    googlePage.acess_page('https://www.google.com.br/')


@given('que preencho o campo de pesquisa com Python')
def step_impl(context):
    googlePage.send_keys_input_pesquisa()


@when('clico no botão de pesquisar')
def step_impl(context):
    googlePage.click_button_pesquisar()


@then('devo visualizar os resultados')
def step_impl(context):
    assert_equal(googlePage.get_text_title_resultado(), 'Python')
Пример #5
0
def test_google_search(driver):
    google_page = GooglePage(driver, "https://google.com")
    google_page.go_to_page()
    google_page.fill_search("selenium")
    google_page.click_search()
    assert google_page.get_title() == "selenium - Google Search"
Пример #6
0
 def test_a(self):
     query = 'cats'
     google_page = GooglePage(self.driver, query)
     google_page.enter_query()
     self.assertIn(query, self.driver.title)
Пример #7
0
def feeling_lucky_search(context, phrase):
    google = GooglePage(context.behave_driver)
    google.feeling_lucky_search(phrase)
Пример #8
0
def normal_search(context, search_phrase):
    google = GooglePage(context.behave_driver)
    google.normal_search(search_phrase)
Пример #9
0
def check_results_count(context, results_count):
    google = GooglePage(context.behave_driver)
    print ('results count: ' + str(google.return_results_count()))
    assert google.return_results_count() > results_count
Пример #10
0
def empty_list_results(context):
    google_page = GooglePage(context.driver)
    assert not check_element_exists(google_page.result_count)
Пример #11
0
def list_results(context):
    google_page = GooglePage(context.driver)
    assert google_page.result_count.is_displayed()
Пример #12
0
def list_results(context):
    google_page = GooglePage(context.driver)
    assert google_page.result_list.is_displayed(), (
        'Elemento não está sendo exibido')
Пример #13
0
def click_search_button(context):
    google_page = GooglePage(context.driver)
    google_page.search_button.submit()
Пример #14
0
def user_type(context, search_word):
    google_page = GooglePage(context.driver)
    google_page.input_field = search_word