Web Automation: setUserInputForCurrentJavaScriptPrompt should fail if current dialog...
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Aug 2017 08:29:19 +0000 (08:29 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Aug 2017 08:29:19 +0000 (08:29 +0000)
commit8996557e703c76faa5268fe114dcf2c1e9e7a16e
tree598c1be25477d5346bbc188102c8df441a6f62fd
parent15104daa6b8841c465e822346691bf6d97252525
Web Automation: setUserInputForCurrentJavaScriptPrompt should fail if current dialog is not a prompt
https://bugs.webkit.org/show_bug.cgi?id=175261

Reviewed by Brian Burg.

Source/WebDriver:

* CommandResult.cpp:
(WebDriver::CommandResult::CommandResult): Handle ElementNotInteractable protocol error.

Source/WebKit:

According to the spec, send alert text command should fail if the current dialog is not a prompt. This patch
adds JavaScriptDialogType enum to API::AutomationSessionClient and a new virtual method to ask the client about
the type of the current dialog. WebAutomationSession::setUserInputForCurrentJavaScriptPrompt() uses the new
client method to check the type of the current dialog and fail in case it's not a prompt. Cocoa needs an
implementation, for now it always returns Prompt as the type to keep compatibility.

18.4 Send Alert Text.
https://w3c.github.io/webdriver/webdriver-spec.html#send-alert-text

This fixes selenium test testSettingTheValueOfAnAlertThrows.

* UIProcess/API/APIAutomationSessionClient.h:
(API::AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage):
* UIProcess/API/glib/WebKitAutomationSession.cpp:
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewGetCurrentScriptDialogType):
* UIProcess/API/glib/WebKitWebViewPrivate.h:
* UIProcess/Automation/Automation.json:
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::setUserInputForCurrentJavaScriptPrompt):
* UIProcess/Cocoa/AutomationSessionClient.h:
* UIProcess/Cocoa/AutomationSessionClient.mm:
(WebKit::AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220394 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebDriver/ChangeLog
Source/WebDriver/CommandResult.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/APIAutomationSessionClient.h
Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h
Source/WebKit/UIProcess/Automation/Automation.json
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h
Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm