mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:17:35 +00:00
WebDriver: Implement GET /session/{session id}/timeouts
endpoint
This commit is contained in:
parent
4db5f6d081
commit
5c32eacac9
7 changed files with 68 additions and 2 deletions
36
Userland/Services/WebDriver/TimeoutsConfiguration.cpp
Normal file
36
Userland/Services/WebDriver/TimeoutsConfiguration.cpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/JsonObject.h>
|
||||
#include <WebDriver/TimeoutsConfiguration.h>
|
||||
|
||||
namespace WebDriver {
|
||||
|
||||
// https://w3c.github.io/webdriver/#dfn-timeouts-object
|
||||
JsonObject timeouts_object(TimeoutsConfiguration const& timeouts)
|
||||
{
|
||||
// The timeouts object for a timeouts configuration timeouts is an object initialized with the following properties:
|
||||
auto timeouts_object = JsonObject {};
|
||||
|
||||
// "script"
|
||||
// timeouts' script timeout value, if set, or its default value.
|
||||
if (timeouts.script_timeout.has_value())
|
||||
timeouts_object.set("script", *timeouts.script_timeout);
|
||||
else
|
||||
timeouts_object.set("script", JsonValue {});
|
||||
|
||||
// "pageLoad"
|
||||
// timeouts' page load timeout’s value, if set, or its default value.
|
||||
timeouts_object.set("pageLoad", timeouts.page_load_timeout);
|
||||
|
||||
// "implicit"
|
||||
// timeouts' implicit wait timeout’s value, if set, or its default value.
|
||||
timeouts_object.set("implicit", timeouts.implicit_wait_timeout);
|
||||
|
||||
return timeouts_object;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue