Skip to content

Commit

Permalink
feat(page): add override locale emulation
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Dec 29, 2023
1 parent 479ff67 commit 00df550
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use futures::{stream, SinkExt, StreamExt};

use chromiumoxide_cdp::cdp::browser_protocol::dom::*;
use chromiumoxide_cdp::cdp::browser_protocol::emulation::{
MediaFeature, SetEmulatedMediaParams, SetTimezoneOverrideParams,
MediaFeature, SetEmulatedMediaParams, SetTimezoneOverrideParams, SetLocaleOverrideParams,
};
use chromiumoxide_cdp::cdp::browser_protocol::network::{
Cookie, CookieParam, DeleteCookiesParams, GetCookiesParams, SetCookiesParams,
Expand Down Expand Up @@ -631,6 +631,15 @@ impl Page {
Ok(self)
}

/// Overrides default host system locale with the specified one
pub async fn emulate_locale(
&self,
locale: impl Into<SetLocaleOverrideParams>,
) -> Result<&Self> {
self.execute(locale.into()).await?;
Ok(self)
}

/// Reloads given page
///
/// To reload ignoring cache run:
Expand Down

0 comments on commit 00df550

Please sign in to comment.