NodeJS selenium-driver geckodriver 正常 Firefox
NodeJS selenium-driver geckodriver normal Firefox
我在 NodeJS 的硒驱动程序中使用 geckodriver。我希望 geckodriver 启动的 Firefox 是普通的 Firefox(扩展、FF 帐户、历史记录、cookie、地址栏等)。有什么方法可以使用 geckodriver 做到这一点吗?
您无法在 gekodriver 中禁用自动化符号。
但您仍然可以使用 firefox 配置文件:
先创建个人资料,然后选择该个人资料并登录网站。这会将 cookie 存储到该配置文件中。现在使用该配置文件。
键入 about:profiles 并单击创建配置文件,创建后单击启动带有配置文件的浏览器并在新浏览器中登录该网站。现在会话将保存在该配置文件中。
现在您可以在代码中使用此配置文件了:
您可以将此 firefox 配置文件用作:
const {Builder} = require('selenium-webdriver');
const firefox = require('selenium-webdriver/firefox');
let options = new firefox.Options();
let profile = 'path';
options.setProfile(profile);
let driver = new Builder()
.forBrowser('firefox')
.setFirefoxOptions(options)
.build();
我在 NodeJS 的硒驱动程序中使用 geckodriver。我希望 geckodriver 启动的 Firefox 是普通的 Firefox(扩展、FF 帐户、历史记录、cookie、地址栏等)。有什么方法可以使用 geckodriver 做到这一点吗?
您无法在 gekodriver 中禁用自动化符号。
但您仍然可以使用 firefox 配置文件:
先创建个人资料,然后选择该个人资料并登录网站。这会将 cookie 存储到该配置文件中。现在使用该配置文件。
键入 about:profiles 并单击创建配置文件,创建后单击启动带有配置文件的浏览器并在新浏览器中登录该网站。现在会话将保存在该配置文件中。
现在您可以在代码中使用此配置文件了:
您可以将此 firefox 配置文件用作:
const {Builder} = require('selenium-webdriver');
const firefox = require('selenium-webdriver/firefox');
let options = new firefox.Options();
let profile = 'path';
options.setProfile(profile);
let driver = new Builder()
.forBrowser('firefox')
.setFirefoxOptions(options)
.build();