forked from gunesmes/page-object-python-selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.py
More file actions
29 lines (22 loc) · 898 Bytes
/
Copy pathbase.py
File metadata and controls
29 lines (22 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
# this Base class is serving basic attributes for every single page inherited from Page class
class Page(object):
def __init__(self, driver, base_url='http://www.app.com/'):
self.base_url = base_url
self.driver = driver
self.timeout = 30
def find_element(self, *locator):
return self.driver.find_element(*locator)
def open(self,url):
url = self.base_url + url
self.driver.get(url)
def get_title(self):
return self.driver.title
def get_url(self):
return self.driver.current_url
def hover(self, *locator):
element = self.find_element(*locator)
hover = ActionChains(self.driver).move_to_element(element)
hover.perform()