Repository navigation
Add default prompt value for user prompt WebDriver tests - #12310
Conversation
When the JavaScript `prompt()` function is called without a default value, some browsers (like IE) return "undefined" for the default prompt value if the argument is omitted. This commit refactors the user prompt handler tests so that prompt() is called with an appropriate value for the default value argument, providing a consistent behavior across browsers.
|
I think @whimboo should have a look at this. |
|
Hi @jimevans. Thank you for the PR. I had a quick glance over it and two questions came up for me:
|
|
Following code review, a better approach for setting the default prompt value for JavaScript prompts is in the create_dialog fixture.
|
|
||
| dialog_params = "text" | ||
| if dialog_type == "prompt": | ||
| # For prompt() dialogs, add a value for the 'default' argument |
There was a problem hiding this comment.
Please note that IE needs that.
| dialog_params = "text" | ||
| if dialog_type == "prompt": | ||
| # For prompt() dialogs, add a value for the 'default' argument | ||
| dialog_params += ", ''" |
There was a problem hiding this comment.
Mind, completely moving this into the script code so that we can get rid of the call to format()?
…cript Acting on comments from code review.
|
|
||
| # Script completes itself when the user prompt has been opened. | ||
| # For prompt() dialogs, add a value for the 'default' argument, | ||
| # as some user agents (IE, for example) do not produce consistent |
There was a problem hiding this comment.
Kudos for resisting "(i.e. IE)" :P
There was a problem hiding this comment.
@jugglinmike True confession time, I very nearly did "(e.g., IE)".
|
Oh, and please don't forget to squash before merge. Thanks. |
|
wdspec timeouts. |
When the JavaScript
prompt()function is called without a default value,some browsers (like IE) return "undefined" for the default prompt value if
the argument is omitted. This commit refactors the user prompt handler
tests so that prompt() is called with an appropriate value for the default
value argument, providing a consistent behavior across browsers.