我正在尝试使用Custom Profile通过Selenium启动Firefox浏览器。我下载了最新的geckodriver并将其包含在以下内容中:

java -Dwebdriver.firefox.driver="C:\\xampp\\htdocs\\project\\geckodriver.exe" -jar selenium-server.jar


注意:我正在使用Selenium Standalone Server 3.5.0。

然后,在我的节点脚本中使用:

const options = {
    desiredCapabilities: {
        browserName: 'firefox',
        firefox_profile:"C:/Users/Administrator/AppData/Local/Mozilla/Firefox/Profiles/Prnlx0rh6w.bookmarks_player"
    }
}

const client = webdriverio.remote(options).init();


当我查看Selenium日志时,它似乎起作用了。因为不会在Windows temp文件夹中创建临时配置文件(就像在新会话中那样),所以您可以从上方看到该配置文件。但这不起作用!

生成的Firefox实例未加载Cookie,附加组件或其他任何内容。每次都像一个新版本。我也尝试使用firefox_profileprofile"moz:profile"代替。我什至尝试使用base64将配置文件作为fs字符串导入。没什么真正起作用的。也许我只是写错了?

如何使用WebdriverIO包含Firefox自定义配置文件?

!!!编辑:还尝试了以下C:\Users\Administrator\AppData\Local\Mozilla\Firefox\Profiles\Prnlx0rh6w.bookmarks_player

我也尝试使用双反斜杠,但最终得到了相同的结果。我尝试安装Firefox插件,但是每个新的启动都消失了。也找不到cookie。

最佳答案

尝试使用firefox_profile
“ C:\ Users \ Administrator \ AppData \ Local \ Mozilla \ Firefox \ Profiles \ greerg.profile”

09-26 11:00