forked from nekitvand/page_object_for_habr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBaseApp.py
21 lines (14 loc) · 817 Bytes
/
BaseApp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class BasePage:
def __init__(self, driver):
self.driver = driver
self.base_url = "https://ya.ru/"
def find_element(self, locator,time=10):
return WebDriverWait(self.driver,time).until(EC.presence_of_element_located(locator),
message=f"Can't find element by locator {locator}")
def find_elements(self, locator,time=10):
return WebDriverWait(self.driver,time).until(EC.presence_of_all_elements_located(locator),
message=f"Can't find elements by locator {locator}")
def go_to_site(self):
return self.driver.get(self.base_url)