2012-05-04 18 views

回答

6

除非你正在構建從源硒項目進行下載,或者是使用.NET綁定並在InternetExplorerOptions類中設置了特定選項,則不應該看到此消息。當前的源代碼在這個特定的區域是易變的,因爲該項目目前正在爲IE驅動程序使用獨立的可執行服務器,類似於Chrome驅動程序目前的情況。如果您從源代碼構建,或者對使用此新功能感興趣,則應從異常消息中指定的URL下載獨立的IE驅動程序服務器可執行文件。

+0

是的,這是。感謝 –

+0

請參閱http://stackoverflow.com/q/11010317/743瞭解如何使用它的示例 –

0

下載IEDriver.exe指定網址

http://code.google.com/p/selenium/downloads/list

假設的exe文件保存在E:\ IEdriver.exe。

在Selenium中,你必須設置IEDriver的屬性,因爲Selenium只有firefox驅動程序。

設置系統屬性,然後調用IEDriver。

WebDriver driver; 

System.setProperty("webdriver.ie.driver", "E:\\IEdriver.exe"); 

//Selenium will not support single slash, so we are providing double slash in path. 

driver = new InternetExplorerDriver(); 

// By this it will call the IEDriver and execute 

由於

0

一個例子共享:

public static void main(String[] args) { 


     System.setProperty("webdriver.ie.driver", "D:\\selenium\\IEDriverServer.exe"); 
     WebDriver driver = new InternetExplorerDriver(); 
     driver.get("www.google.com"); 
     driver.findElement(By.id("gbqfq")).sendKeys("abc"); 
     driver.close(); 

} 

}