Selenium webdriver 如何将自定义Firefox设置传递到WebDriver.dart

Selenium webdriver 如何将自定义Firefox设置传递到WebDriver.dart,selenium-webdriver,dart,Selenium Webdriver,Dart,我遇到了,但答案中提供的解决方案不能用于Dart中。 创建Firefox配置文件或使用现有配置文件 在profile目录中创建一个user.js文件,内容如下所示 创建包含配置文件目录中所有文件的zip存档文件(zip存档文件不得有根目录,所用配置文件的文件和目录必须是zip存档中的顶级文件和目录) 将zip存档文件传递到所需的参数 对我来说,当我刚刚将prefs.js和user.js文件添加到zip归档文件时,它也起到了作用 import 'package:crypto/crypto.dar

我遇到了,但答案中提供的解决方案不能用于Dart中。

  • 创建Firefox配置文件或使用现有配置文件
  • 在profile目录中创建一个
    user.js
    文件,内容如下所示
  • 创建包含配置文件目录中所有文件的zip存档文件(zip存档文件不得有根目录,所用配置文件的文件和目录必须是zip存档中的顶级文件和目录)
  • 将zip存档文件传递到所需的
    参数
对我来说,当我刚刚将
prefs.js
user.js
文件添加到zip归档文件时,它也起到了作用

import 'package:crypto/crypto.dart';
...
var firefoxProfile = CryptoUtils.bytesToBase64(
    new io.File('/home/myuser/.mozilla/firefox/webdriver_profile.zip').readAsBytesSync());
var driver = createDriver(uri: uri, 
    desired: {'browserName': Browser.firefox, 'firefox_profile': firefoxProfile});
user.js

// turn off reader view message
user_pref("reader.parse-on-load.enabled", false);