selenium.webdriver.common.bidi.emulation¶
Classes
|
BiDi implementation of the emulation module. |
|
Represents geolocation coordinates. |
|
Represents a geolocation position error. |
- class selenium.webdriver.common.bidi.emulation.GeolocationCoordinates(latitude: float, longitude: float, accuracy: float = 1.0, altitude: float | None = None, altitude_accuracy: float | None = None, heading: float | None = None, speed: float | None = None)[source]¶
Represents geolocation coordinates.
Initialize GeolocationCoordinates.
Parameters:¶
latitude: Latitude coordinate (-90.0 to 90.0). longitude: Longitude coordinate (-180.0 to 180.0). accuracy: Accuracy in meters (>= 0.0), defaults to 1.0. altitude: Altitude in meters or None, defaults to None. altitude_accuracy: Altitude accuracy in meters (>= 0.0) or None, defaults to None. heading: Heading in degrees (0.0 to 360.0) or None, defaults to None. speed: Speed in meters per second (>= 0.0) or None, defaults to None.
Raises:¶
ValueError: If coordinates are out of valid range or if altitude_accuracy is provided without altitude.
- property latitude¶
- property longitude¶
- property accuracy¶
- property altitude¶
- property altitude_accuracy¶
- property heading¶
- property speed¶
- class selenium.webdriver.common.bidi.emulation.GeolocationPositionError(type: str = 'positionUnavailable')[source]¶
Represents a geolocation position error.
- TYPE_POSITION_UNAVAILABLE = 'positionUnavailable'¶
- class selenium.webdriver.common.bidi.emulation.Emulation(conn)[source]¶
BiDi implementation of the emulation module.
- set_geolocation_override(coordinates: GeolocationCoordinates | None = None, error: GeolocationPositionError | None = None, contexts: list[str] | None = None, user_contexts: list[str] | None = None) None [source]¶
Set geolocation override for the given contexts or user contexts.
Parameters:¶
coordinates: Geolocation coordinates to emulate, or None. error: Geolocation error to emulate, or None. contexts: List of browsing context IDs to apply the override to. user_contexts: List of user context IDs to apply the override to.
Raises:¶
- ValueError: If both coordinates and error are provided, or if both contexts
and user_contexts are provided, or if neither contexts nor user_contexts are provided.