-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcheck.py
53 lines (36 loc) · 1.31 KB
/
check.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
#!/usr/bin/python3
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium_wait import wait_for_page_loaded
BROWSERS = []
def start_browsers():
global BROWSERS
chrome_options = Options()
# chrome_options.add_argument("--window-size=1920x1080")
# chrome_options.binary_location = '/usr/bin/google-chrome-stable'
# chrome_options.add_argument('--headless')
# chrome_options.add_argument('--no-sandbox')
# chrome_options.add_argument('--log-level=DEBUG')
for i in range(1):
browser = webdriver.Chrome(executable_path='/tests/chrome',
chrome_options=chrome_options,
service_args=["--log-path=/tmp/chrome.log"])
BROWSERS.append(browser)
def get_browser():
global BROWSERS
while BROWSERS == []:
time.sleep(0.3)
return BROWSERS.pop()
# Start pool of browsers:
start_browsers()
# Get one browser
br = get_browser()
br.get("https://todomvc4tasj.herokuapp.com/")
element = br.find_element_by_xpath("//*[@id='new-todo']")
element.send_keys("test")
time.sleep(1)
element.send_keys(Keys.ENTER)
br.get_screenshot_as_file('tmp2.png')
element2 = br.find_element_by_css_selector("ul.todo-list > li")