Skip to content

Commit 160bf38

Browse files
committed
Loadable Component
1 parent 2fc5b51 commit 160bf38

10 files changed

Lines changed: 26 additions & 6 deletions

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# selenium_python
1+
# Selenium with Python
22

33
## Install
44

@@ -8,6 +8,12 @@ Please use virtualenv if you don't want to add dependencies to your global pytho
88
pip install -r requirements.txt
99
```
1010

11+
## Lint Code
12+
13+
```bash
14+
pylint ./**/*.py
15+
```
16+
1117
## Generate graph
1218

1319
```bash

classes.png

186 KB
Loading

elements/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
Elements abstraction layer
3+
"""

packages.png

18.9 KB
Loading

pages/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
Pages In Page Object Model defines the components of the real application example main page, login, footer, header...
3+
"""

pages/main_page.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class MainPage(BasePage):
1313

1414
search_text_element = SearchTextElement()
1515

16+
def load(self):
17+
self.driver.get("http://www.python.org")
18+
1619
def is_title_matches(self):
1720
"""Verifies that the hardcoded text "Python" appears in page title"""
1821
return "Python" in self.driver.title

requirements.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
coverage==4.5.1
2-
pycallgraph==1.0.1
1+
astroid==2.0.4
2+
isort==4.3.4
3+
lazy-object-proxy==1.3.1
4+
mccabe==0.6.1
5+
pylint==2.1.1
36
selenium==3.14.0
7+
six==1.11.0
48
urllib3==1.23
9+
wrapt==1.10.11

tests/base_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class BaseTest(unittest.TestCase):
1212

1313
def setUp(self):
1414
self.driver = webdriver.Firefox()
15-
self.driver.get("http://www.python.org")
1615

1716
def tearDown(self):
1817
self.driver.close()

tests/test_python_search.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def test_search_in_python_org(self):
2222

2323
# Load the main page. In this case the home page of Python.org.
2424
main_page = MainPage(self.driver)
25+
main_page.load()
2526
# Checks if the word "Python" is in title
2627
assert main_page.is_title_matches(), "python.org title doesn't match."
2728
# Sets the text of search textbox to "pycon"

tests/test_python_search_without_pom.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
from tests.base_test import BaseTest
99

1010

11-
class TestPythonOrgSearch(BaseTest):
11+
class TestPythonOrgSearchNoPOM(BaseTest):
1212
"""A sample test class to show how page object works"""
1313

14-
1514
def test_search_in_python_org(self):
1615
"""
1716
Tests python.org search feature.
@@ -20,6 +19,7 @@ def test_search_in_python_org(self):
2019
This test verifies that the results were not empty.
2120
"""
2221

22+
self.driver.get("http://www.python.org")
2323
# Checks if the word "Python" is in title
2424
assert "Python" in self.driver.title, "python.org title doesn't match."
2525
# Sets the text of search textbox to "pycon"

0 commit comments

Comments
 (0)