One script we have asks the user for a few values via successive JavaScript calls to window.prompt(). Selenium records this action, both the prompt texts and the values I typed in, but it doesn't seem to be able to play it back properly. It 'succeeds' in that no errors occur, but only the first prompt value actually makes it back to my script. Furthermore, the default ordering Selenium records makes the second value get returned in the first one's spot, and the rest still blank:
# [info] Executing: |answerOnNextPrompt | TEXT1 | |
# [info] Executing: |select | id | label=mychoice |
# [info] Executing: |answerOnNextPrompt | TEXT2 | |
# [info] Executing: |assertPrompt | Please enter a value for q1 | |
# [info] Executing: |answerOnNextPrompt | TEXT3 | |
# [info] Executing: |assertPrompt | Please enter a value for q2 | |
# [info] Executing: |answerOnNextPrompt | TEXT4 | |
# [info] Executing: |assertPrompt | Please enter a value for q3 | |
# [info] Executing: |assertPrompt | Please enter a value for q4 | |
I reordered it into what seems more sensible to me:
# [info] Executing: |answerOnNextPrompt | TEXT1 | |
# [info] Executing: |select | id | label=mychoice |
# [info] Executing: |assertPrompt | Please enter a value for q1 | |
# [info] Executing: |answerOnNextPrompt | TEXT2 | |
# [info] Executing: |assertPrompt | Please enter a value for q2 | |
# [info] Executing: |answerOnNextPrompt | TEXT3 | |
# [info] Executing: |assertPrompt | Please enter a value for q3 | |
# [info] Executing: |answerOnNextPrompt | TEXT4 | |
# [info] Executing: |assertPrompt | Please enter a value for q4 | |
After that I get TEXT1 as the first value, but the rest still blank.
I also tried waitForPrompt in place of each assertPrompt, but no dice.
My guess is that Selenium can't actually handle this situation because answerOnNextPrompt seems to need to come before the action that triggers the prompt, but it is the action that triggers the next prompt, so after the first one triggered by select there's no way to do it because they don't stack.
I'd like to be proven wrong, though...any ideas?
(If not, I might report it as a bug / something they need to change in the API, maybe by combining answerOnNextPrompt with assertPrompt: it could just take an optional argument with how the prompt ought to be answered.)
Platform is Selenium IDE 1.0.2 on Firefox 3.5.3 on win32.