Merge lp:~elopio/selenium-simple-test/workaround-alert-dict into lp:selenium-simple-test

Proposed by Leo Arias
Status: Merged
Approved by: Corey Goldberg
Approved revision: 220
Merged at revision: 219
Proposed branch: lp:~elopio/selenium-simple-test/workaround-alert-dict
Merge into: lp:selenium-simple-test
Diff against target: 14 lines (+4/-0)
1 file modified
src/sst/actions.py (+4/-0)
To merge this branch: bzr merge lp:~elopio/selenium-simple-test/workaround-alert-dict
Reviewer Review Type Date Requested Status
Corey Goldberg (community) Approve
Review via email: mp+83689@code.launchpad.net

This proposal supersedes a proposal from 2011-11-28.

Commit message

the text of the alert is sometimes returned in a dictionary. This workaround takes the item from the dictionary when this happens.

Description of the change

Because of a selenium issue [1], the text of the alert is sometimes returned in a dictionary.
This workaround takes the item from the dictionary when this happens.

[1] http://code.google.com/p/selenium/issues/detail?id=2955

To post a comment you must log in.
Revision history for this message
Corey Goldberg (coreygoldberg) wrote :

looks good to me. thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/sst/actions.py'
2--- src/sst/actions.py 2011-11-28 17:51:15 +0000
3+++ src/sst/actions.py 2011-11-28 21:16:36 +0000
4@@ -979,6 +979,10 @@
5 waitfor(browser.switch_to_alert)
6 alert = browser.switch_to_alert()
7 alert_text = alert.text
8+ # XXX workaround because Selenium sometimes returns the value in a
9+ # dictionary. See http://code.google.com/p/selenium/issues/detail?id=2955
10+ if isinstance(alert_text, dict):
11+ alert_text = alert_text['text']
12 if expected_text and expected_text != alert_text:
13 error_message = 'Element text should be %r.\nIt is %r.' \
14 % (expected_text, alert_text)

Subscribers

People subscribed via source and target branches