1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 16:15:08 +00:00
Commit graph

43 commits

Author SHA1 Message Date
Timothy Flynn
61d0b66bfb WebDriver+Browser: Implement GET /session/{id}/source 2022-11-03 14:48:04 +00:00
Linus Groh
629fbc2cfc WebDriver: Implement POST /session/{session id}/execute/async endpoint 2022-11-02 23:46:30 +00:00
Linus Groh
f88a0c51a3 WebDriver: Implement POST /session/{session id}/execute/sync endpoint 2022-11-02 23:46:30 +00:00
Timothy Flynn
1ffaad29e1 WebDriver+Browser: Implement GET /session/{id}/screenshot
This doesn't follow the spec to a tee. Our OutOfProcessWebView already
has a bitmap that can be used as the window screenshot. Therefore, we
can bypass the steps that assume we need to access the window's frame
buffer in-flight.

We also don't create an HTMLCanvasElement. We would need a Document in
the WebDriver process to do so. Instead, we can still run the encoding
steps exactly as-is using the screenshot bitmap.
2022-11-02 17:55:37 +00:00
Timothy Flynn
11d0489fa3 WebDriver+Browser: Implement POST /session/{id}/window/minimize 2022-11-02 15:41:19 +00:00
Timothy Flynn
89b2ff72f7 WebDriver+Browser: Implement POST /session/{id}/window/maximize 2022-11-02 15:41:19 +00:00
Timothy Flynn
174248678e WebDriver+Browser: Implement POST /session/{id}/window/rect 2022-11-02 15:41:19 +00:00
Timothy Flynn
dac91c5790 WebDriver+Browser: Implement GET /session/{id}/window/rect 2022-11-02 15:41:19 +00:00
martinfalisse
76da0c6c54 WebDriver: Implement GET /session/{id}/element/{id}/text endpoint 2022-11-01 10:55:34 +00:00
Tobias Christiansen
a534e61b44 WebDriver: Implement GET /session/{id}/element/{id}/name endpoint 2022-10-22 13:44:49 +02:00
Sam Atkins
607767fd10 WebDriver: Extract repeated "check for window or return error" code
If `TRY()` doesn't solve your problems, you're not using enough of it.
2022-10-21 19:59:03 +02:00
Sam Atkins
3232622255 WebDriver: Use WebDriverError::from_code() for all error creation 2022-10-21 19:59:03 +02:00
Sam Atkins
89c3e0b567 WebDriver: Rename HttpError -> WebDriverError 2022-10-21 19:59:03 +02:00
Tobias Christiansen
354a845d65 WebDriver: Implement GET /session/{id}/element/{id}/css/{name} 2022-10-20 21:26:10 +02:00
Tobias Christiansen
92fd97ed63 WebDriver: Fix old current_window style 2022-10-19 22:34:10 +02:00
Tobias Christiansen
e87456e38f WebDriver: Implement GET /session/{id}/element/{id}/property/{name} 2022-10-19 22:30:06 +02:00
Linus Groh
6641c99c80 WebDriver: Implement GET /session/{session id}/window/handles endpoint 2022-10-19 22:23:47 +02:00
Linus Groh
7cb9b85c25 WebDriver: Rename Session::{get_window_object => current_window}()
- It's not a "window object" (in the JS sense), it's a simple struct
  storing a handle and is_open property
- We usually omit 'get' for getters
- The new name makes it more clear that this is looked up using the
  m_current_window_handle as a key
2022-10-19 21:11:37 +02:00
Linus Groh
24ee5a2202 WebDriver: Move GET /session/{session id}/window impl into Session 2022-10-19 21:11:37 +02:00
Linus Groh
0064d2e8c8 WebDriver: Implement POST /session/{session id}/timeouts endpoint 2022-10-19 21:11:37 +02:00
Linus Groh
5c32eacac9 WebDriver: Implement GET /session/{session id}/timeouts endpoint 2022-10-19 21:11:37 +02:00
Linus Groh
4db5f6d081 WebDriver: Use monotonic timer in Session::find() 2022-10-19 21:11:37 +02:00
Linus Groh
f0a8e3bc05 WebDriver: Replace hardcoded timeout with a TimeoutsConfiguration struct 2022-10-19 21:11:37 +02:00
Tobias Christiansen
249350a7a3 WebDriver: Implement GET /session/{id}/element/{id}/attribute/{name} 2022-10-19 17:30:58 +02:00
Tobias Christiansen
e1fb64abad WebDriver: Implement POST /session/{id}/element/{id}/elements 2022-10-19 15:32:31 +02:00
Tobias Christiansen
d26bbcab42 WebDriver: Implement POST /session/{id}/element/{id}/element 2022-10-19 15:32:31 +02:00
Tobias Christiansen
063bd663a7 WebDriver: Implement POST /session/{id}/elements endpoint 2022-10-19 15:32:31 +02:00
Linus Groh
8fc4c5d27b WebDriver: Avoid some JsonValue copies in Session::find_element() 2022-10-18 23:22:38 +02:00
Linus Groh
dd4e5d5028 WebDriver: Make functions always match their spec command name
This is easier to grasp than sometimes naming it after the HTTP method,
and sometimes not.
2022-10-18 23:22:38 +02:00
Tobias Christiansen
5fcf00f30d WebDriver: Add POST /session/{id}/element endpoint
This allows you to query for elements in the active document!
The IDs of matching elements are returned through the WebDriver
interface, for now there's nothing to do with this information.

This introduces a `LocalElement` to the Session, which for now only
holds the ID of a real browser-side element. Once more data of elements
are available to the Session, they can be stored alongside in this
struct.

Fixme's introduced are:
    - Only CSS selector location strategy is implemented for now
    - `get_or_create_a_web_element_reference` returns the elements ID
      instead of a UUID generated in a spec way.
2022-10-18 19:18:33 +02:00
Linus Groh
727e982c50 WebDriver: Put endpoint functions in spec order 2022-10-17 18:20:05 +02:00
Linus Groh
eafb924580 WebDriver: Include section number and title in spec comments
Also, only add the HTTP method and path to the Client side where they
are relevant for seeing which parameters are available and such.
2022-10-17 18:20:05 +02:00
Tobias Christiansen
122e2d2076 WebDriver: Implement POST /session/{id}/cookie endpoint
This allows the WebDriver to create a cookie.
We use a Web::Cookie::ParsedCookie to transport the data through IPC
to take advantage of the RFC6265 Section 5.3 implementation in the
CookieJar.
2022-10-17 15:48:22 +02:00
Tobias Christiansen
fefe447cf5 WebDriver: Implement DELETE /session/{id}/cookie/{name} endpoint 2022-10-17 11:31:30 +02:00
Tobias Christiansen
0d6dc2492d WebDriver: Implement DELETE /session/{id}/cookie endpoint 2022-10-17 11:31:30 +02:00
Tobias Christiansen
a34f8c444b WebDriver: Implement GET /session/{id}/cookie/{name} endpoint 2022-10-16 16:32:59 +02:00
Tobias Christiansen
001699f2d6 WebDriver: Implement GET /session/{id}/cookie endpoint 2022-10-15 22:28:34 +02:00
Moustafa Raafat
a4fa604bde WebDriver: Implement POST /session/{id}/forward endpoint 2022-10-15 21:01:59 +02:00
Moustafa Raafat
9132656856 WebDriver: Implement POST /session/{id}/back endpoint 2022-10-15 21:01:59 +02:00
Tobias Christiansen
a33cad1197 WebDriver: Fix HTTP Status for 'no such window' error
The 'no such window' error returns a 404, not a 400.
2022-10-15 15:43:42 +01:00
Tobias Christiansen
1179d951f6 WebDriver: Implement POST /session/{id}/refresh endpoint 2022-10-15 15:43:42 +01:00
Sam Atkins
096fe865c6 WebDriver: Implement GET /session/{id}/url endpoint 2022-10-12 23:07:42 +02:00
Sam Atkins
80603f141a WebDriver: Add new WebDriver service
WebDriver aims to implement the WebDriver specification found at
https://w3c.github.io/webdriver/webdriver-spec.html . It's an HTTP
server that can create Browser sessions and control them.

Co-authored-by: Florent Castelli <florent.castelli@gmail.com>
2022-10-12 23:07:42 +02:00