-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
70 lines (52 loc) · 1.86 KB
/
main.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from DriverInitialization import DriverInitialization
from MainPage import MainPage
from ReleasesPage import ReleasesPage
from SearchPage import SearchPage
from DecoratorsPage import DecoratorsPage
import time
def decorated_close(test):
def wrapper(*args):
driver = test(*args)
driver.driver.close()
print("driver closed")
return wrapper
class RunChrome:
@decorated_close
def test1(self):
"""
test sequence 1
"""
# 1. Driver Initialization
initialization_object = DriverInitialization
driver = initialization_object.initialize_driver("https://www.python.org/")
# 2. Going to Downloads -> All Releases
driver = MainPage(driver)
driver.go_to_all_releases()
# 3. Printing the last version of python
driver = ReleasesPage(driver)
driver.display_last_release
return driver.driver
@decorated_close
def test2(self):
"""
test sequence 1
"""
# 1. driver initialization and opening Chrome Browser
initialization_object = DriverInitialization
driver = initialization_object.initialize_driver("https://www.python.org/")
# 2. Search bar
main_page_driver = MainPage(driver)
main_page_driver.use_search_bar()
# 3. Open first result link
search_page_driver = SearchPage(main_page_driver.driver)
search_page_driver.click_on_first_result()
# 4. Select Examples
decorator_page_driver = DecoratorsPage(search_page_driver.driver)
decorator_page_driver.select_examples()
# 5. Verify current example count is 5
decorator_page_driver.verify_examples_count()
return decorator_page_driver
chromeTest = RunChrome()
chromeTest.test2()