Skip to content

Commit

Permalink
Revert "Make methods take AsRef<Path> instead of &Path"
Browse files Browse the repository at this point in the history
This reverts commit 27b01aa.
  • Loading branch information
grelner committed Nov 4, 2024
1 parent 1c39697 commit f01f95e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions thirtyfour/src/common/capabilities/chromium.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ pub trait ChromiumLikeCapabilities: BrowserCapabilitiesHelper {
}

/// Add Chrome extension file. This will be a file with a .CRX extension.
fn add_extension(&mut self, crx_file: impl AsRef<Path>) -> WebDriverResult<()> {
fn add_extension(&mut self, crx_file: &Path) -> WebDriverResult<()> {
let contents = std::fs::read(crx_file)?;
let b64_contents = BASE64_STANDARD.encode(contents);
self.add_encoded_extension(&b64_contents)
}

/// Remove the specified Chrome extension file if an identical extension had been added
/// previously.
fn remove_extension(&mut self, crx_file: impl AsRef<Path>) -> WebDriverResult<()> {
fn remove_extension(&mut self, crx_file: &Path) -> WebDriverResult<()> {
let contents = std::fs::read(crx_file)?;
let b64_contents = BASE64_STANDARD.encode(contents);
self.remove_encoded_extension(&b64_contents)
Expand Down
2 changes: 1 addition & 1 deletion thirtyfour/src/extensions/addons/firefox/firefoxtools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl FirefoxTools {
}

/// Take a full-page screenshot of the current window and write it to the specified filename.
pub async fn full_screenshot(&self, path: impl AsRef<Path>) -> WebDriverResult<()> {
pub async fn full_screenshot(&self, path: &Path) -> WebDriverResult<()> {
let png = self.full_screenshot_as_png().await?;
support::write_file(path, png).await?;
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion thirtyfour/src/session/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ impl SessionHandle {
}

/// Take a screenshot of the current window and write it to the specified filename.
pub async fn screenshot(&self, path: impl AsRef<Path>) -> WebDriverResult<()> {
pub async fn screenshot(&self, path: &Path) -> WebDriverResult<()> {
let png = self.screenshot_as_png().await?;
support::write_file(path, png).await?;
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion thirtyfour/src/web_element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ impl WebElement {
}

/// Take a screenshot of this WebElement and write it to the specified filename.
pub async fn screenshot(&self, path: impl AsRef<Path>) -> WebDriverResult<()> {
pub async fn screenshot(&self, path: &Path) -> WebDriverResult<()> {
let png = self.screenshot_as_png().await?;
support::write_file(path, png).await?;
Ok(())
Expand Down

0 comments on commit f01f95e

Please sign in to comment.