WebKit Bugzilla
Attachment 358315 Details for
Bug 193139
: WebDriver: element click command should handle user prompts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
wd-click-prompts.diff (text/plain), 5.18 KB, created by
Carlos Garcia Campos
on 2019-01-04 06:36:23 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Carlos Garcia Campos
Created:
2019-01-04 06:36:23 PST
Size:
5.18 KB
patch
obsolete
>diff --git a/Source/WebDriver/ChangeLog b/Source/WebDriver/ChangeLog >index 767eefa4158..f8123da39e4 100644 >--- a/Source/WebDriver/ChangeLog >+++ b/Source/WebDriver/ChangeLog >@@ -1,3 +1,13 @@ >+2019-01-04 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ WebDriver: element click command should handle user prompts >+ https://bugs.webkit.org/show_bug.cgi?id=193139 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Session.cpp: >+ (WebDriver::Session::elementClick): Handle user prompts. >+ > 2019-01-04 Carlos Garcia Campos <cgarcia@igalia.com> > > [GLIB] WebDriver: browser close not correctly detected on session close in some cases >diff --git a/Source/WebDriver/Session.cpp b/Source/WebDriver/Session.cpp >index 9a2cb52bfe3..071070f0941 100644 >--- a/Source/WebDriver/Session.cpp >+++ b/Source/WebDriver/Session.cpp >@@ -1520,41 +1520,47 @@ void Session::elementClick(const String& elementID, Function<void (CommandResult > return; > } > >- OptionSet<ElementLayoutOption> options = { ElementLayoutOption::ScrollIntoViewIfNeeded, ElementLayoutOption::UseViewportCoordinates }; >- computeElementLayout(elementID, options, [this, protectedThis = makeRef(*this), elementID, completionHandler = WTFMove(completionHandler)](Optional<Rect>&& rect, Optional<Point>&& inViewCenter, bool isObscured, RefPtr<JSON::Object>&& error) mutable { >- if (!rect || error) { >- completionHandler(CommandResult::fail(WTFMove(error))); >- return; >- } >- if (isObscured) { >- completionHandler(CommandResult::fail(CommandResult::ErrorCode::ElementClickIntercepted)); >- return; >- } >- if (!inViewCenter) { >- completionHandler(CommandResult::fail(CommandResult::ErrorCode::ElementNotInteractable)); >+ handleUserPrompts([this, elementID, completionHandler = WTFMove(completionHandler)](CommandResult&& result) mutable { >+ if (result.isError()) { >+ completionHandler(WTFMove(result)); > return; > } >- >- getElementTagName(elementID, [this, elementID, inViewCenter = WTFMove(inViewCenter), completionHandler = WTFMove(completionHandler)](CommandResult&& result) mutable { >- bool isOptionElement = false; >- if (!result.isError()) { >- String tagName; >- if (result.result()->asString(tagName)) >- isOptionElement = tagName == "option"; >+ OptionSet<ElementLayoutOption> options = { ElementLayoutOption::ScrollIntoViewIfNeeded, ElementLayoutOption::UseViewportCoordinates }; >+ computeElementLayout(elementID, options, [this, protectedThis = makeRef(*this), elementID, completionHandler = WTFMove(completionHandler)](Optional<Rect>&& rect, Optional<Point>&& inViewCenter, bool isObscured, RefPtr<JSON::Object>&& error) mutable { >+ if (!rect || error) { >+ completionHandler(CommandResult::fail(WTFMove(error))); >+ return; >+ } >+ if (isObscured) { >+ completionHandler(CommandResult::fail(CommandResult::ErrorCode::ElementClickIntercepted)); >+ return; >+ } >+ if (!inViewCenter) { >+ completionHandler(CommandResult::fail(CommandResult::ErrorCode::ElementNotInteractable)); >+ return; > } > >- Function<void (CommandResult&&)> continueAfterClickFunction = [this, completionHandler = WTFMove(completionHandler)](CommandResult&& result) mutable { >- if (result.isError()) { >- completionHandler(WTFMove(result)); >- return; >+ getElementTagName(elementID, [this, elementID, inViewCenter = WTFMove(inViewCenter), completionHandler = WTFMove(completionHandler)](CommandResult&& result) mutable { >+ bool isOptionElement = false; >+ if (!result.isError()) { >+ String tagName; >+ if (result.result()->asString(tagName)) >+ isOptionElement = tagName == "option"; > } > >- waitForNavigationToComplete(WTFMove(completionHandler)); >- }; >- if (isOptionElement) >- selectOptionElement(elementID, WTFMove(continueAfterClickFunction)); >- else >- performMouseInteraction(inViewCenter.value().x, inViewCenter.value().y, MouseButton::Left, MouseInteraction::SingleClick, WTFMove(continueAfterClickFunction)); >+ Function<void (CommandResult&&)> continueAfterClickFunction = [this, completionHandler = WTFMove(completionHandler)](CommandResult&& result) mutable { >+ if (result.isError()) { >+ completionHandler(WTFMove(result)); >+ return; >+ } >+ >+ waitForNavigationToComplete(WTFMove(completionHandler)); >+ }; >+ if (isOptionElement) >+ selectOptionElement(elementID, WTFMove(continueAfterClickFunction)); >+ else >+ performMouseInteraction(inViewCenter.value().x, inViewCenter.value().y, MouseButton::Left, MouseInteraction::SingleClick, WTFMove(continueAfterClickFunction)); >+ }); > }); > }); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
mcatanzaro
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193139
: 358315