diff --git a/src/page.rs b/src/page.rs index e3f339c9..44e87195 100644 --- a/src/page.rs +++ b/src/page.rs @@ -7,7 +7,8 @@ use futures::{stream, SinkExt, StreamExt}; use chromiumoxide_cdp::cdp::browser_protocol::dom::*; use chromiumoxide_cdp::cdp::browser_protocol::emulation::{ - MediaFeature, SetEmulatedMediaParams, SetTimezoneOverrideParams, SetLocaleOverrideParams, + MediaFeature, SetEmulatedMediaParams, SetGeolocationOverrideParams, SetLocaleOverrideParams, + SetTimezoneOverrideParams, }; use chromiumoxide_cdp::cdp::browser_protocol::network::{ Cookie, CookieParam, DeleteCookiesParams, GetCookiesParams, SetCookiesParams, @@ -640,6 +641,15 @@ impl Page { Ok(self) } + /// Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable. + pub async fn emulate_geolocation( + &self, + geolocation: impl Into, + ) -> Result<&Self> { + self.execute(geolocation.into()).await?; + Ok(self) + } + /// Reloads given page /// /// To reload ignoring cache run: