File tree Expand file tree Collapse file tree 2 files changed +32
-8
lines changed Expand file tree Collapse file tree 2 files changed +32
-8
lines changed Original file line number Diff line number Diff line change 44
44
result = driver .find_element_by_id ('res1' ).get_attribute ('innerHTML' )
45
45
print result
46
46
assert ("ENABLED" in result )
47
- driver .switch_to_frame (driver .find_element_by_tag_name ("iframe" ))
48
- result2 = wait_for_element_id (driver , 'res2' )
49
- print result2
50
- assert ("DISABLED" in result2 )
47
+ timeout = 10
48
+ ret = ''
49
+ elem_id = 'res2'
50
+ while timeout > 0 :
51
+ try :
52
+ driver .switch_to_frame (driver .find_element_by_tag_name ("iframe" ))
53
+ ret = driver .find_element_by_id (elem_id ).get_attribute ('innerHTML' )
54
+ break
55
+ except selenium .common .exceptions .NoSuchElementException :
56
+ pass
57
+ time .sleep (1 )
58
+ timeout = timeout - 1
59
+ if timeout <= 0 :
60
+ raise Exception ('Timeout when waiting for element' + elem_id )
61
+ print ret
62
+ assert ("DISABLED" in ret )
51
63
finally :
52
64
server .terminate ()
53
65
driver .quit ()
Original file line number Diff line number Diff line change 44
44
result = driver .find_element_by_id ('res1' ).get_attribute ('innerHTML' )
45
45
print result
46
46
assert ("ENABLED" in result )
47
- driver .switch_to_frame (driver .find_element_by_tag_name ("iframe" ))
48
- result2 = wait_for_element_id (driver , 'res2' )
49
- print result2
50
- assert ("ENABLED" in result2 )
47
+ timeout = 10
48
+ ret = ''
49
+ elem_id = 'res2'
50
+ while timeout > 0 :
51
+ try :
52
+ driver .switch_to_frame (driver .find_element_by_tag_name ("iframe" ))
53
+ ret = driver .find_element_by_id (elem_id ).get_attribute ('innerHTML' )
54
+ break
55
+ except selenium .common .exceptions .NoSuchElementException :
56
+ pass
57
+ time .sleep (1 )
58
+ timeout = timeout - 1
59
+ if timeout <= 0 :
60
+ raise Exception ('Timeout when waiting for element' + elem_id )
61
+ print ret
62
+ assert ("ENABLED" in ret )
51
63
finally :
52
64
server .terminate ()
53
65
driver .quit ()
You can’t perform that action at this time.
0 commit comments