我在Eclipse中运行Selenium测试,但无法加载自定义的Firefox配置文件。从Eclipse自定义Firefox配置文件启动Selenium
大多数消息表明我需要启动Selenium服务器是这样的:
java -jar selenium-server.jar -firefoxProfileTemplate </path/to/template/>
但在Eclipse中发动我的测试,当它不使用 - 如果Selenium服务器不是测试运行运行。
这个线程表明,我可以设置在DefaultSelenium构造轮廓:由硒IDE(Firefox插件)对我产生
Selenium RC - disabling browser cookie
但代码不使用该构造:
package com.example.tests;
import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
public class Example extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://www.example.com/", "*firefox");
}
public void testExample() throws Exception {
selenium.open("/");
selenium.click("//body");
}
}
我应该在哪里设置DefaultSelenium配置选项?或者是否有其他一些方法可以用来加载我的自定义Firefox模板?
谢谢! Stu
太棒了 - 这让它工作。谢谢! – stubotnik 2010-03-01 10:19:16
如果要在代码中完成所有操作,还可以实例化并启动org.openqa.selenium.server.SeleniumServer的实例。请参阅.setFirefoxProfileTemplate()。 – dhackner 2010-08-03 06:56:10