w3c / webdriver

Remote control interface that enables introspection and control of user agents.
https://w3c.github.io/webdriver/
Other
675 stars 191 forks source link

GET/POST for '/session/{session id}/alert/text' references alert message vs. text field #1146

Open whimboo opened 6 years ago

whimboo commented 6 years ago

In the WebDriver spec the endpoint for /session/{session id}/alert/text references different elements for the GET and POST request. While GET returns the value of the alert message, POST sets the text field of an alert.

https://w3c.github.io/webdriver/webdriver-spec.html#get-alert-text https://w3c.github.io/webdriver/webdriver-spec.html#send-alert-text

andreastt commented 6 years ago

I don’t think I understand this bug.

Get Alert Text says:

Let message be the text message associated with the current user prompt, or otherwise be null.

Send Alert Text says:

Perform user agent dependent steps to set the value of current user prompt’s text field to text.

Is the problem that the first talks about “text message” and the latter about “text field”?

whimboo commented 6 years ago

Well, it's not only the wording here, but both methods really rely on different elements. While you can enter text with Send Alert Text , you really get the message of the alert as response for Get Alert Text. It's not only the wording, but a behavior which seem to exist for a while?

andreastt commented 6 years ago

What do you mean by “different elements”?

whimboo commented 6 years ago

Please see: https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt

Which says:

message is a string of text to display to the user. This parameter is optional and can be omitted if there is nothing to show in the prompt window.

And this is different from the content of the textbox, which is visible for some alerts like the prompt, and is handled as result of the alert:

result is a string containing the text entered by the user, or null.