Skip to content

Commit cfe998e

Browse files
committed
[test] fix open-remote
1 parent 4023945 commit cfe998e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

test/sanity/open-remote/remote.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script>
2+
window.name = 'remote';
23
document.write('<h1 id="res">Node is ' + (typeof nw === 'undefined' ? 'DISABLED': 'ENABLED') + '</h1>');
34
document.write('<h1 id="res2">chrome.app.window is ' + (typeof chrome.app.window === 'undefined' ? 'DISABLED': 'ENABLED') + '</h1>');
45
document.write('<h1 id="res3">chrome.runtime is ' + (typeof chrome.runtime === 'undefined' ? 'DISABLED': 'ENABLED') + '</h1>');

test/sanity/open-remote/test.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
html = open('index.html', 'w')
2424
html.write('''
2525
<script>
26+
window.name = 'local';
2627
nw.Window.open('http://localhost:%s/remote.html', function(win) {
2728
document.write('<h1 id="res">returned window is ' + typeof win + '</h1>');
2829
win.y = 0;
@@ -35,16 +36,14 @@
3536
driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options, desired_capabilities = capabilities)
3637
time.sleep(1)
3738
try:
38-
wait_window_handles(driver, 2)
39-
driver.switch_to_window(driver.window_handles[0])
39+
wait_switch_window_name(driver, 'local')
4040
print driver.current_url
41-
time.sleep(1)
42-
result = driver.find_element_by_id('res').get_attribute('innerHTML')
43-
print result
41+
result = wait_for_element_id(driver, 'res')
42+
print 'result=' + result
4443
assert("object" in result)
45-
driver.switch_to_window(driver.window_handles[-1])
44+
wait_switch_window_name(driver, 'remote')
4645
for id in ['res', 'res2', 'res3']:
47-
result = driver.find_element_by_id(id).get_attribute('innerHTML')
46+
result = wait_for_element_id(driver, id)
4847
print result
4948
assert("DISABLED" in result)
5049
finally:

0 commit comments

Comments
 (0)