mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:07:45 +00:00
WebContent: Don't assume start nodes for finding elements remain valid
When timeouts are implemented, the start node used to find elements may not remain valid for the entire duration of the timeout. For example, the active document element may change, or the start node may be removed from the DOM. To handle this, we will need to re-evaluate the start node on each iteration of the find() operation. This patch wraps the steps to do so in a lambda to be executed on each iteration.
This commit is contained in:
parent
061bca99a9
commit
297186c68a
2 changed files with 46 additions and 27 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibIPC/ConnectionToServer.h>
|
||||
|
@ -93,7 +94,9 @@ private:
|
|||
void restore_the_window();
|
||||
Gfx::IntRect maximize_the_window();
|
||||
Gfx::IntRect iconify_the_window();
|
||||
ErrorOr<JsonArray, Web::WebDriver::Error> find(Web::DOM::ParentNode& start_node, Web::WebDriver::LocationStrategy using_, StringView value);
|
||||
|
||||
using StartNodeGetter = Function<ErrorOr<Web::DOM::ParentNode*, Web::WebDriver::Error>()>;
|
||||
ErrorOr<JsonArray, Web::WebDriver::Error> find(StartNodeGetter&& start_node_getter, Web::WebDriver::LocationStrategy using_, StringView value);
|
||||
|
||||
struct ScriptArguments {
|
||||
String script;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue