-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
33 lines (26 loc) · 972 Bytes
/
test.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
"""
Sanity check for webdriver
docker run --rm -v $(pwd):/usr/workspace aedocker python ae.py
"""
import unittest
from selenium import webdriver
class TestTemplate(unittest.TestCase):
def setUp(self):
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--headless')
self.driver = webdriver.Chrome(options=chrome_options)
self.driver.implicitly_wait(10)
def tearDown(self):
self.driver.quit()
def test_google_search_divs(self):
try:
self.driver.get('https://www.google.com/')
divs = self.driver.find_elements_by_tag_name('div')
if (len(divs)==0):
self.fail('No divs found!')
except Exception as ex:
self.fail(ex)
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(TestTemplate)
unittest.TextTestRunner(verbosity=2).run(suite)