chromiumoxide icon indicating copy to clipboard operation
chromiumoxide copied to clipboard

Cookies Issue

Open narkreeta opened this issue 11 months ago • 1 comments

It seems cookies are not saving into provided user_data_dir

use chromiumoxide::browser::HeadlessMode;
use chromiumoxide::handler::viewport::Viewport;
use chromiumoxide::BrowserConfig;
use std::env;
use std::path::{Path, PathBuf};

pub async fn config(user_dir:PathBuf) -> Result<BrowserConfig, String> {
    let bin_path = env::var("BIN_PATH");
    match bin_path {
        Ok(bpath) => {
            println!("Using Bin path: {}", bpath);
            let chrome_bin: &Path =
                Path::new(bpath.as_str());

            let config = BrowserConfig::builder().arg("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36").headless_mode(HeadlessMode::False).no_sandbox().viewport(Viewport{
                height : 1080,
                width : 1920,
                emulating_mobile : false,
                device_scale_factor : Option::from(1.0),
                has_touch : false,
                is_landscape : true,
            }).user_data_dir(user_dir).chrome_executable(chrome_bin).build()?;
            Ok(config)
        }
        Err(_) => {
            Err(String::from("Browser doesn't know which to use"))
        }
    }
}

here is the config code

narkreeta avatar Jan 19 '25 05:01 narkreeta

It is unclear to me what the issue is, please provide a repo with a full working example that I can use to reproduce the bug.

Sytten avatar Nov 24 '25 18:11 Sytten