Skip to content

Commit 58d3298

Browse files
committed
[test] fix window-resizeto: handle multiple windows
1 parent 5a6e566 commit 58d3298

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

test/sanity/window-resizeto/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<html>
22
<head>
3+
<title>main window</title>
34
<style>
45
button {
56
-webkit-app-region: no-drag;

test/sanity/window-resizeto/newpop.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<title>5093 as a menu window</title>
4+
<title>new popup</title>
55
<meta charset="UTF-8">
66
<style>
77
html,

test/sanity/window-resizeto/test.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,25 @@
1717
print driver.current_url
1818
driver.implicitly_wait(10)
1919
wait_window_handles(driver, 2)
20+
popup_window = None
21+
main_window = None
22+
for handle in driver.window_handles:
23+
driver.switch_to_window(handle)
24+
print driver.title
25+
if 'new popup' in driver.title:
26+
popup_window = handle
27+
else:
28+
main_window = handle
29+
assert(popup_window)
30+
assert(main_window)
2031
print 'switch to opened window'
21-
driver.switch_to_window(driver.window_handles[-1])
32+
driver.switch_to_window(popup_window)
2233
result = wait_for_element_id(driver, 'yellow')
2334
print 'window size: %s' % result
2435
assert('200, 300' in result)
25-
driver.switch_to_window(driver.window_handles[0])
36+
driver.switch_to_window(main_window)
2637
driver.find_element_by_id('btn_resizeto').click()
27-
driver.switch_to_window(driver.window_handles[-1])
38+
driver.switch_to_window(popup_window)
2839
result = driver.find_element_by_id('yellow').get_attribute('innerHTML')
2940
print 'window size: %s' % result
3041
assert('180, 180' in result)

0 commit comments

Comments
 (0)