我试图在Google中运行一部分代码,在Firefox中运行其他代码
public class flip
{
static WebDriver driver = new FirefoxDriver(); // starting firefox
public static void main(String[] args) throws IOException, InterruptedException
{
System.setProperty("webdriver.chrome.driver", "C:/chromedriver.exe");
WebDriver driver1 = new ChromeDriver();
driver1.get("website1");
driver1.findElement(By.id("id_username")).sendKeys("username");
driver1.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver1.findElement(By.id("id_password")).sendKeys("password");
System.out.print("logged in");
driver1.close();
driver.get("website-2"); // in firefox
}
} 我得到了以下错误(当程序需要切换浏览器)。两个浏览器都处于打开状态,但无法驱动。
Exception in thread "main" org.openqa.selenium.WebDriverException:
f.QueryInterface is not a function
Command duration or timeout: 60.03 seconds有人能在我犯错误的地方帮我吗?(firefox must驱动程序必须是静态的。)
发布于 2015-09-14 15:21:44
将http://放在您的firefox驱动程序的web地址的启动上。硒版本是有义务的。
https://stackoverflow.com/questions/32567387
复制相似问题