2013-05-22 68 views
1

我只是想在本地進行測試。隨着Internet Explorer的工作。與Firefox,我得到線driver.FindElement超時:Selenium Firefox配置文件路徑沒有考慮到

var capabilitiesInternet = new OpenQA.Selenium.Remote.DesiredCapabilities(); 
capabilitiesInternet.SetCapability("ignoreProtectedModeSettings", true); 
IWebDriver driver = new FirefoxDriver();   
driver.Navigate().GoToUrl(url); 

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); 
IWebElement category = wait.Until<IWebElement>((d) => 
{ 
    return d.FindElement(By.Name("login")); 
}); 

// Login 
driver.FindElement(By.Name("login")).SendKeys("test"); 

錯誤消息的HttpRequest到remotedriver超時。

Upate:我認爲這是因爲我有一個便攜版本的Firefox 21和一箇舊版本的FF,它不能與Selenium一起使用,而Selenium則推出舊版本。於是,我就指示便攜式路徑:

var capabilitiesInternet = new OpenQA.Selenium.Remote.DesiredCapabilities(); 
capabilitiesInternet.SetCapability("ignoreProtectedModeSettings", true); 
string path = @"C:\Portable"; 
FirefoxProfile ffprofile = new FirefoxProfile(path); 
IWebDriver driver = new FirefoxDriver(ffprofile); 

不幸的是它會繼續運行老版本(我不能改變,因爲企業環境中的舊版本)。

無論如何要讓這個配置文件工作?

+0

那麼什麼是完整的堆棧跟蹤?什麼版本的Selenium?什麼版本的Firefox?它引發了什麼? – Arran

+0

@Arran我想我知道爲什麼看到我的更新,但我不能使工作firefox配置文件路徑來解決這個問題。 –

+0

你有沒有得到這個修復? – TWilly

回答

1

不知道這是你的問題,但爲了「點」硒到火狐的位置,你正在尋找FirefoxBinary類:

var binary = new FirefoxBinary("pathtofirefox"); 
string path = @"C:\Portable"; 
FirefoxProfile ffprofile = new FirefoxProfile(path); 
var driver = new FirefoxDriver(binary, profile); 
+0

謝謝,但我有編譯錯誤:無法從Firefox.FirefoxBinary轉換爲Firefox.FirefoxProfile –

+0

請參閱我的編輯,我的不好! – Arran

+0

這應該工作,但不幸的是我收到另一個錯誤消息:配置文件無法加載。我在下載目錄中有firefox portable,我可以在沒有任何問題的情況下使用命令行運行,但不能形成Selenium,這真是一場噩夢。 –

相關問題