testing - 测试时在哪里可以看到 firefoxdriver selenium 启动的内容?

标签 testing webdriver selenium-firefoxdriver

我已经为 FF 安装了 firebug。但是当我启动 firefox 时,它总是启动一些默认的 ff 版本,我不知道 selenium 在哪里找到它。

我已经用谷歌搜索了很多,尝试使用不同的 firefoxbinary:

System.setProperty("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");

  final File firefoxPath = new File(System.getProperty("webdriver.firefox.bin")) ;
  FirefoxBinary firefoxBinary=  new FirefoxBinary(firefoxPath);
  firefox = new FirefoxDriver(firefoxBinary,null);

我尝试使用不同的 ff 配置文件:

FirefoxProfile firefoxProfile = new FirefoxProfile();
   firefoxProfile.addExtension(file);
   firefoxProfile.setPreference("extensions.firebug.currentVersion", "1.9.1");

唉,不行啊! 1.不知道去哪里改/找webdriver.firefox.bin 2.我已经尝试将路径更改为环境变量,仍然没有进展 也许我做错了什么?

最佳答案

默认情况下,Selenium 将打开“vanilla”Firefox 配置文件。如果你想让它与你的个人资料一起启动,你可以这样做,但你必须选择你想要使用的个人资料。我会警告您,您通常不希望使用您的常规配置文件,因为您想要一个干净、一致的工作环境。

但你当然可以:

  1. 设置一个配置文件(例如,使用selenium-profile Firefox 的配置文件管理器
  2. 运行 Firefox 选择该配置文件——来自 Windows 的运行对话框运行“c:\Program Files(x86)\Mozilla Firefox\firefox.exe"- P"或者 FF 的等效路径,如果你是 32-但是。
  3. 使用该配置文件安装 Firebug。
  4. 然后在启动测试时选择该配置文件。

有关如何执行所有这些操作的信息,请查看 this article .

然后,在您的代码中,您可以调用该配置文件。上面链接的文章中的步骤 3 显示了如何执行此操作。

关于testing - 测试时在哪里可以看到 firefoxdriver selenium 启动的内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28629307/

相关文章:

django - 无法在 Django 测试类中加载对象

Java 测试(公共(public)、私有(private))

testing - 如何在 Golang 中将数据发送到 channel 以进行测试?

Selenium:该元素无法滚动到 View 中

java - 使用 Selenium 2 将本地镜像注入(inject)/加载到当前网页

c# - Selenium FirefoxDriver : Share Session/Cookies between different instances

testing - Tensorflow LSTM 模型测试

java - 如何为@FindBy 注解实现用户类型?

java - 如何在 Selenium 中禁用保存密码弹出窗口?

python - Linux 上缺少 Selenium Firefox 配置文件