-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsimpletest.py
More file actions
47 lines (29 loc) · 885 Bytes
/
simpletest.py
File metadata and controls
47 lines (29 loc) · 885 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
30
31
32
33
34
35
36
37
38
39
40
41
#Tested in python3
#To run on OSX:
#
#
# brew install python
# pip3 install selenium
#
#
# To run:
# python3 simpletest.py
#
import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By
class WebDriverPythonBasics(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Chrome()
def test_saucelabs_homepage_header_displayed(self):
self.browser.get("https://www.saucelabs.com")
element = self.browser.find_element(By.XPATH, '//a[text()="Platforms"]');
self.assertTrue(element.is_displayed());
element.click();
pricing_link = self.browser.find_element(By.XPATH, '//a[text()="Pricing"]');
self.assertTrue(pricing_link.is_displayed());
pricing_link.click();
def tearDown(self):
self.browser.close()
if __name__ == '__main__':
unittest.main()