File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 1
1
< script >
2
+ window . name = 'remote' ;
2
3
document . write ( '<h1 id="res">Node is ' + ( typeof nw === 'undefined' ? 'DISABLED' : 'ENABLED' ) + '</h1>' ) ;
3
4
document . write ( '<h1 id="res2">chrome.app.window is ' + ( typeof chrome . app . window === 'undefined' ? 'DISABLED' : 'ENABLED' ) + '</h1>' ) ;
4
5
document . write ( '<h1 id="res3">chrome.runtime is ' + ( typeof chrome . runtime === 'undefined' ? 'DISABLED' : 'ENABLED' ) + '</h1>' ) ;
Original file line number Diff line number Diff line change 23
23
html = open ('index.html' , 'w' )
24
24
html .write ('''
25
25
<script>
26
+ window.name = 'local';
26
27
nw.Window.open('http://localhost:%s/remote.html', function(win) {
27
28
document.write('<h1 id="res">returned window is ' + typeof win + '</h1>');
28
29
win.y = 0;
35
36
driver = webdriver .Chrome (executable_path = os .environ ['CHROMEDRIVER' ], chrome_options = chrome_options , desired_capabilities = capabilities )
36
37
time .sleep (1 )
37
38
try :
38
- wait_window_handles (driver , 2 )
39
- driver .switch_to_window (driver .window_handles [0 ])
39
+ wait_switch_window_name (driver , 'local' )
40
40
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
44
43
assert ("object" in result )
45
- driver . switch_to_window (driver . window_handles [ - 1 ] )
44
+ wait_switch_window_name (driver , 'remote' )
46
45
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 )
48
47
print result
49
48
assert ("DISABLED" in result )
50
49
finally :
You can’t perform that action at this time.
0 commit comments