|
1 |
| -import os |
2 |
| -import sys |
3 |
| -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
4 |
| -from nw_util import * |
5 |
| - |
6 |
| -from selenium import webdriver |
7 |
| -from selenium.webdriver.chrome.options import Options |
8 |
| -from selenium.webdriver.common.action_chains import ActionChains |
9 |
| - |
10 |
| -chrome_options = Options() |
11 |
| -chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__))) |
12 |
| - |
13 |
| -driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options) |
14 |
| -driver.implicitly_wait(2) |
15 |
| -try: |
16 |
| - print driver.current_url |
17 |
| - element = driver.find_element_by_id('resize-window') |
18 |
| - ActionChains(driver).click(element).perform() |
19 |
| - res = wait_for_element_id(driver, "resize") |
20 |
| - print res |
21 |
| - assert("width: 777, height: 555" in res) |
22 |
| -finally: |
23 |
| - driver.quit() |
| 1 | +import os |
| 2 | +import sys |
| 3 | +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| 4 | +from nw_util import * |
| 5 | + |
| 6 | +from selenium import webdriver |
| 7 | +from selenium.webdriver.chrome.options import Options |
| 8 | +from selenium.webdriver.common.action_chains import ActionChains |
| 9 | + |
| 10 | +chrome_options = Options() |
| 11 | +chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__))) |
| 12 | + |
| 13 | +driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options) |
| 14 | +driver.implicitly_wait(2) |
| 15 | +try: |
| 16 | + print driver.current_url |
| 17 | + element = driver.find_element_by_id('resize-window') |
| 18 | + ActionChains(driver).click(element).perform() |
| 19 | + res = wait_for_element_id(driver, "resize") |
| 20 | + print res |
| 21 | + assert("width: 7" in res) |
| 22 | + assert("height: 5" in res) |
| 23 | +finally: |
| 24 | + driver.quit() |
0 commit comments