[WebDriver BiDi] Update captureScreenshot tests with box clip
diff --git a/tools/webdriver/webdriver/bidi/modules/browsing_context.py b/tools/webdriver/webdriver/bidi/modules/browsing_context.py
index 35ad93e..7d3ccf2 100644
--- a/tools/webdriver/webdriver/bidi/modules/browsing_context.py
+++ b/tools/webdriver/webdriver/bidi/modules/browsing_context.py
@@ -15,16 +15,16 @@
self["scrollIntoView"] = scroll_into_view
-class ViewportOptions(Dict[str, Any]):
+class BoxOptions(Dict[str, Any]):
def __init__(self, x: float, y: float, width: float, height: float):
- self["type"] = "viewport"
+ self["type"] = "box"
self["x"] = x
self["y"] = y
self["width"] = width
self["height"] = height
-ClipOptions = Union[ElementOptions, ViewportOptions]
+ClipOptions = Union[ElementOptions, BoxOptions]
class BrowsingContext(BidiModule):
diff --git a/webdriver/tests/bidi/browsing_context/capture_screenshot/clip.py b/webdriver/tests/bidi/browsing_context/capture_screenshot/clip.py
index 4cc83f2..5d2385e 100644
--- a/webdriver/tests/bidi/browsing_context/capture_screenshot/clip.py
+++ b/webdriver/tests/bidi/browsing_context/capture_screenshot/clip.py
@@ -1,6 +1,6 @@
import pytest
from tests.support.image import png_dimensions
-from webdriver.bidi.modules.browsing_context import ElementOptions, ViewportOptions
+from webdriver.bidi.modules.browsing_context import ElementOptions, BoxOptions
from webdriver.bidi.modules.script import ContextTarget
from . import (
@@ -129,7 +129,7 @@
)
reference_data = await bidi_session.browsing_context.capture_screenshot(
context=top_context["context"],
- clip=ViewportOptions(
+ clip=BoxOptions(
x=element_coordinates[0],
y=element_coordinates[1],
width=expected_size[0],
@@ -156,7 +156,7 @@
)
data = await bidi_session.browsing_context.capture_screenshot(
context=top_context["context"],
- clip=ViewportOptions(
+ clip=BoxOptions(
x=element_coordinates[0],
y=element_coordinates[1],
width=element_dimensions[0],
@@ -184,7 +184,7 @@
)
new_data = await bidi_session.browsing_context.capture_screenshot(
context=top_context["context"],
- clip=ViewportOptions(
+ clip=BoxOptions(
x=element_coordinates[0],
y=element_coordinates[1],
width=element_dimensions[0],
@@ -240,7 +240,7 @@
)
new_data = await bidi_session.browsing_context.capture_screenshot(
context=top_context["context"],
- clip=ViewportOptions(
+ clip=BoxOptions(
x=element_coordinates[0],
y=element_coordinates[1],
width=element_dimensions[0],
@@ -289,7 +289,7 @@
)
new_data = await bidi_session.browsing_context.capture_screenshot(
context=top_context["context"],
- clip=ViewportOptions(
+ clip=BoxOptions(
x=element_coordinates[0],
y=element_coordinates[1],
width=expected_size[0],
diff --git a/webdriver/tests/bidi/browsing_context/capture_screenshot/invalid.py b/webdriver/tests/bidi/browsing_context/capture_screenshot/invalid.py
index c6efbbb..a0c0acc 100644
--- a/webdriver/tests/bidi/browsing_context/capture_screenshot/invalid.py
+++ b/webdriver/tests/bidi/browsing_context/capture_screenshot/invalid.py
@@ -3,7 +3,7 @@
from ... import get_viewport_dimensions
import webdriver.bidi.error as error
-from webdriver.bidi.modules.browsing_context import ElementOptions, ViewportOptions
+from webdriver.bidi.modules.browsing_context import ElementOptions, BoxOptions
from webdriver.bidi.modules.script import ContextTarget
pytestmark = pytest.mark.asyncio
@@ -98,7 +98,7 @@
with pytest.raises(error.InvalidArgumentException):
await bidi_session.browsing_context.capture_screenshot(
context=top_context["context"],
- clip=ViewportOptions(x=value, y=0, width=0, height=0),
+ clip=BoxOptions(x=value, y=0, width=0, height=0),
)
@@ -107,7 +107,7 @@
with pytest.raises(error.InvalidArgumentException):
await bidi_session.browsing_context.capture_screenshot(
context=top_context["context"],
- clip=ViewportOptions(x=0, y=value, width=0, height=0),
+ clip=BoxOptions(x=0, y=value, width=0, height=0),
)
@@ -118,7 +118,7 @@
with pytest.raises(error.InvalidArgumentException):
await bidi_session.browsing_context.capture_screenshot(
context=top_context["context"],
- clip=ViewportOptions(x=0, y=0, width=value, height=0),
+ clip=BoxOptions(x=0, y=0, width=value, height=0),
)
@@ -129,7 +129,7 @@
with pytest.raises(error.InvalidArgumentException):
await bidi_session.browsing_context.capture_screenshot(
context=top_context["context"],
- clip=ViewportOptions(x=0, y=0, width=0, height=value),
+ clip=BoxOptions(x=0, y=0, width=0, height=value),
)
@@ -137,7 +137,7 @@
with pytest.raises(error.UnableToCaptureScreenException):
await bidi_session.browsing_context.capture_screenshot(
context=top_context["context"],
- clip=ViewportOptions(x=0, y=0, width=0, height=0),
+ clip=BoxOptions(x=0, y=0, width=0, height=0),
)
@@ -149,7 +149,7 @@
with pytest.raises(error.UnableToCaptureScreenException):
await bidi_session.browsing_context.capture_screenshot(
context=top_context["context"],
- clip=ViewportOptions(
+ clip=BoxOptions(
x=viewport_dimensions["width"],
y=viewport_dimensions["height"],
width=1,