2018-06-26 00:47:21 +03:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
"""Page model for home page."""
|
|
|
|
|
|
|
|
from pypom import Page
|
|
|
|
|
|
|
|
from selenium.webdriver.common.by import By
|
|
|
|
|
|
|
|
|
|
|
|
class HomePage(Page):
|
|
|
|
"""Page object model for home page."""
|
|
|
|
|
|
|
|
def wait_for_page_to_load(self):
|
|
|
|
self.wait.until(
|
|
|
|
lambda _: self.is_element_displayed(
|
|
|
|
By.CSS_SELECTOR, ".dropdown--profile__username"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
return self
|
|
|
|
|
|
|
|
def log_out(self):
|
|
|
|
element = self.selenium.find_element_by_css_selector(
|
|
|
|
".dropdown .dropdown--profile__username"
|
|
|
|
)
|
|
|
|
element.click()
|
|
|
|
logout = element.find_elements_by_tag_name("li")
|
|
|
|
logout[-1].click()
|
|
|
|
|
|
|
|
def search(self, term):
|
2018-06-26 19:53:39 +03:00
|
|
|
element = self.selenium.find_element_by_css_selector(".navbar__search__input")
|
2018-06-26 00:47:21 +03:00
|
|
|
element.click()
|
|
|
|
element.send_keys(term)
|
2018-06-26 19:53:39 +03:00
|
|
|
button = self.selenium.find_element_by_css_selector(".input-group-btn .btn")
|
2018-06-26 00:47:21 +03:00
|
|
|
button.click()
|
|
|
|
from pages.queries import QueryPage
|
|
|
|
|
|
|
|
return QueryPage(self.selenium).wait_for_page_to_load()
|