简体   繁体   English

使用配置文件路径打开 firefox [selenium webdriver NodeJS]

[英]open firefox with a profile path [selenium webdriver NodeJS]

I'm trying to open the default profile in firefox.我正在尝试在 firefox 中打开默认配置文件。 I have tried using:我试过使用:

options.setProfile(path);

but it didn't work但它没有用

I have managed to open the profile using options.addArguments() but I couldn't control it.我已经设法使用options.addArguments()打开了配置文件,但我无法控制它。 it gives "permission denied" or "connection closed"它给出“权限被拒绝”或“连接关闭”

I'm using "selenium-webdriver 4.0.0-alpha.5" and "firefox 78.0.1 (64-bit)" on windows 10我在 windows 10 上使用“selenium-webdriver 4.0.0-alpha.5”和“firefox 78.0.1(64 位)”

I use this:我用这个:

const {Builder} = require('selenium-webdriver');
const firefox = require('selenium-webdriver/firefox');

let options = new firefox.Options();
let profile = '/home/me/.mozilla/firefox/4p90s4py.oss';
options.setProfile(profile);


let driver = new Builder()
        .forBrowser('firefox')
        .setFirefoxOptions(options)
        .build();

hopefully it helps希望它有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM