当我使用默认配置文件启动没有问题.但是当我开始使用自定义配置文件时,firefox会启动但仍会"阻止".该过程保持活动消耗31MB的RAM,但永远不会启动.只有在我杀死这个过程后才开始,然后开始并与硒一起正常工作.
我使用Windows 7,Firefox 25.0.1和selenium-server-standalone-2.38.0.jar¿可能是版本兼容性问题?
这是打开配置文件的代码:
FirefoxProfile profile = new FirefoxProfile(new File("C:/Users/UserTest/AppData/Roaming/Mozilla/Firefox/Profiles/tydtn9km.testprofile")); WebDriver driver = new FirefoxDriver(profile);
编辑:这是我的实际代码
package org.openqa.selenium.example; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxProfile; import org.openqa.selenium.firefox.internal.ProfilesIni; public class Main { public static void main(String[] args) { ProfilesIni profile = new ProfilesIni(); FirefoxProfile ffprofile = profile.getProfile("Other"); WebDriver driver = new FirefoxDriver(ffprofile); driver.get("http://google.com"); } }
编辑2:已解决 问题是由于我的Firefox配置文件位于另一个分区,而Firefox位于另一个分区中.