我有一個超級簡單的測試腳本(下面)開始使用WebDriver。當我運行測試(C# - Visual Studio 2015)時,它會打開Firefox瀏覽器,然後不執行任何操作。Selenium Webdriver打開Firefox,然後死亡
有幾個職位在那裏,談了以下問題,這我也越來越:
OpenQA.Selenium.WebDriverException: Failed to start up socket within 45000 milliseconds. Attempted to connect to the following addresses: 127.0.0.1:7055.
但對於這個問題這些職位是很老,也有一個主要的difference-他們的FF瀏覽器沒有打開;我的確。
代碼:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
namespace seleniumDemo
{
[TestClass]
public class UnitTest1
{
static IWebDriver driverFF;
[AssemblyInitialize]
public static void SetUp(TestContext context)
{
driverFF = new FirefoxDriver();
}
[TestMethod]
public void TestFirefoxDriver()
{
driverFF.Navigate().GoToUrl("http://www.google.com");
driverFF.FindElement(By.Id("lst-ib")).SendKeys("Selenium");
driverFF.FindElement(By.Id("lst-ib")).SendKeys(Keys.Enter);
}
}
}
這個問題是從什麼被認爲是重複的,因爲FireFox瀏覽器實際上在這種情況下打開不同。在其他問題中,它根本沒有迴應。
最有可能的版本不兼容性。檢查您使用的硒版本是否支持Firefox的版本 –
有看這裏http://stackoverflow.com/questions/38676719/fail-to-launch-mozilla-with-selenium –
可能重複[無法打開瀏覽器與Firefox更新後的Selenium](http://stackoverflow.com/questions/37761668/cant-open-browser-with-selenium-after-firefox-update) – Mobrockers