Skip to content

Commit 5c35a0d

Browse files
committed
[test] fix race condition in issue5980-aws-sdk-embedded-youtobe-video-crash
1 parent f0457d0 commit 5c35a0d

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

test/sanity/issue5980-aws-sdk-embedded-youtobe-video-crash/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
<title>issue5980-aws-sdk-embedded-youtobe-vedio-crash</title>
77
</head>
88
<body>
9-
<iframe src="https://www.youtube.com/embed/C0DPdy98e4c"></iframe>
9+
<iframe src="https://www.youtube.com/embed/C0DPdy98e4c" id="iframe_a"></iframe>
1010
</body>
1111
</html>

test/sanity/issue5980-aws-sdk-embedded-youtobe-video-crash/test.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,22 @@
2727
switch_to_app(driver)
2828
print driver.current_url
2929
print 'waiting for crash'
30-
wait_for_element_tag(driver, "iframe")
31-
assert(driver.find_element_by_tag_name("iframe") is not None)
32-
driver.switch_to_frame(driver.find_element_by_tag_name("iframe"))
33-
wait_for_element_class(driver, "ytp-large-play-button")
30+
wait_for_element_id(driver, "iframe_a")
31+
driver.switch_to_frame("iframe_a")
32+
timeout = 10
33+
while timeout > 0:
34+
try:
35+
ret = driver.find_element_by_class_name('ytp-large-play-button')
36+
break
37+
except selenium.common.exceptions.NoSuchElementException:
38+
driver.switch_to_default_content()
39+
driver.switch_to_frame("iframe_a")
40+
except selenium.common.exceptions.WebDriverException:
41+
pass
42+
time.sleep(1)
43+
timeout = timeout - 1
44+
if timeout <= 0:
45+
raise Exception('Timeout when waiting for element ytp-large-play-button')
3446
assert(driver.find_element_by_class_name("ytp-large-play-button") is not None)
3547
print 'There is no crash'
3648
finally:

0 commit comments

Comments
 (0)