Javascript 无法使用Node.js在Selenium中运行特定的Firefox配置文件
我正在尝试使用Node.js在现有Firefox配置文件中运行Selenium。但是,Node一直说它找不到配置文件。我正在运行ArchLinux和Firefox87。我的代码:Javascript 无法使用Node.js在Selenium中运行特定的Firefox配置文件,javascript,node.js,selenium,selenium-firefoxdriver,Javascript,Node.js,Selenium,Selenium Firefoxdriver,我正在尝试使用Node.js在现有Firefox配置文件中运行Selenium。但是,Node一直说它找不到配置文件。我正在运行ArchLinux和Firefox87。我的代码: const webdriver = require("selenium-webdriver"); const firefox = require("selenium-webdriver/firefox"); const geckodriver = require("ge
const webdriver = require("selenium-webdriver");
const firefox = require("selenium-webdriver/firefox");
const geckodriver = require("geckodriver"); //Did this instead of adding geckodriver to Path
const firefoxOptions = new firefox.Options();
const firefoxProfile = '/home/user_name/.mozilla/firefox/l6mcped3.selenium-test/';
firefoxOptions.setProfile(firefoxProfile);
let driver = new webdriver.Builder()
.forBrowser("firefox")
.setFirefoxOptions(firefoxOptions)
.build();
结果(在关闭Firefox配置文件的情况下运行):
但是,ls
显示文件存在。用户权限不应该是个问题,但我还是尝试以sudo
的身份运行,得到了相同的结果。请帮忙。谢谢。尝试删除符号链接。这对我很有效。
Running...
node:internal/process/promises:245
triggerUncaughtException(err, true /* fromPromise */);
^
[Error: ENOENT: no such file or directory, stat '/home/user_name/.mozilla/firefox/l6mcped3.selenium-test/lock'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: '/home/user_name/.mozilla/firefox/l6mcped3.selenium-test/lock'