def step_impl(context): main_page = MainPage(context.driver) main_page.click_button_travellers() main_page.field_person = main_page.driver.find_element_by_xpath( "//*[@id='traveler-selector-hp-flight']/div/ul/li/div/div/div/div[1]/div[4]/button") main_page.field_person.click() main_page.btn_close = main_page.driver.find_element_by_xpath( "//*[@id='traveler-selector-hp-flight']/div/ul/li/div/footer/div/div[2]/button") main_page.btn_close.click()
import time from selenium import webdriver from features.pages.login_page import LoginPage from features.pages.main_page import MainPage from features.pages.search_results_page import SearchResultsPage driver = webdriver.Chrome("D:/Tools/chromedriver.exe") driver.implicitly_wait(5) driver.get("https://www.instagram.com/accounts/login/") login_page = LoginPage(driver) login_page.enter_username("pyautomation") login_page.enter_password("Ab123456789!") login_page.click_login() main_page = MainPage(driver) main_page.click_not_now_button() main_page.type_in_search_field("#fitness") main_page.click_result_with_text("#fitness") time.sleep(3) search_results_page = SearchResultsPage(driver) # assert "Follow" in search_results_page.get_follow_button_text() search_results_page.get_button_text("Follow") driver.quit()
def __init__(self, driver): self.launch_page = LaunchPage(driver) self.login_page = LoginPage(driver) self.main_page = MainPage(driver)
def before_all(context): context.browser = Browser() context.main_page = MainPage() context.browser.login()
def step_impl(context): main_page = MainPage(context.driver) main_page.click_not_now_button()
def step_impl(context, text): main_page = MainPage(context.driver) main_page.click_result_with_text(text)
def step_impl(context, query): main_page = MainPage(context.driver) main_page.type_in_search_field(query)
def enter_text_in_search_field(context): main_page = MainPage(context.driver) main_page.type_in_search_field("fitness") main_page.click_result("#fitness") time.sleep(5)
def step_impl(context): main_page = MainPage(context.driver) main_page.click_search_button()
def step_impl(context, date): main_page = MainPage(context.driver) main_page.enter_returning_date(date)
def step_impl(context, date): main_page = MainPage(context.driver) main_page.enter_departure_date(date)
def step_impl(context, city, airport): main_page = MainPage(context.driver) main_page.enter_destination_place(city) main_page.click_result_dest()
def step_impl(context, city, airport): main_page = MainPage(context.driver) time.sleep(2) main_page.enter_departure_place(city) main_page.click_result_dep()
def step_impl(context): main_page = MainPage(context.driver) main_page.click_to_flights_menu()
def step_impl(context): login_page = LoginPage(context.driver) login_page.enter_username(context.config.get("user", "username")) login_page.enter_password(context.config.get("user", "password")) login_page.click_login_button() MainPage(context.driver) # Verify user is on main page