2014-07-23 5 views
1

내 소스 코드가 selenium docs 사이트에서 복사되었습니다. 나는 어떤 변화도하지 않았다. http://docs.seleniumhq.org/docs/03_webdriver.jsp#user-input-filling-in-forms 셀렌 원격 제어 (RC), Selenium WebDriver Mono, Selenium WebDriver 지원 클래스, Selenium WebDriver 및 Selenium WebDriver 지원 Selenium을 포함하여 NuGet을 통해 Selenium 라이브러리를 설치했습니다.Selenium-WebDriver가 새 Firefox 창을 열었지만 URL로 이동하지 않았습니다.

이 코드를 실행하면 새로운 Firefox 창이 열립니다. 그러나 Firefox는 URL로 이동하지 않으며 방금 붙어서 아무것도로드되지 않았습니다. Firefox v27, v29, v30 및 v31을 사용해 보았지만 아무 것도 작동하지 않았습니다.

enter image description here

using OpenQA.Selenium; 
using OpenQA.Selenium.Firefox; 

// Requires reference to WebDriver.Support.dll 
using OpenQA.Selenium.Support.UI; 

class GoogleSuggest 
{ 
static void Main(string[] args) 
{ 
    // Create a new instance of the Firefox driver. 

    // Notice that the remainder of the code relies on the interface, 
    // not the implementation. 

    // Further note that other drivers (InternetExplorerDriver, 
    // ChromeDriver, etc.) will require further configuration 
    // before this example will work. See the wiki pages for the 
    // individual drivers at http://code.google.com/p/selenium/wiki 
    // for further information. 
    IWebDriver driver = new FirefoxDriver(); 

    //Notice navigation is slightly different than the Java version 
    //This is because 'get' is a keyword in C# 
    driver.Navigate().GoToUrl("http://www.google.com/"); 

    // Find the text input element by its name 
    IWebElement query = driver.FindElement(By.Name("q")); 

    // Enter something to search for 
    query.SendKeys("Cheese"); 

    // Now submit the form. WebDriver will find the form for us from the element 
    query.Submit(); 

    // Google's search is rendered dynamically with JavaScript. 
    // Wait for the page to load, timeout after 10 seconds 
    WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); 
    wait.Until((d) => { return d.Title.ToLower().StartsWith("cheese"); }); 

    // Should see: "Cheese - Google Search" 
    System.Console.WriteLine("Page title is: " + driver.Title); 

    //Close the browser 
    driver.Quit(); 
} 
} 
+0

아마 버그 : https://code.google.com/p/selenium/issues/detail?id=7532 현재 NuGet 패키지 v2.42.0이라고 – Stijn

+0

주, 파이어 폭스 (30)에 대한 지원 다음 버전 ([source] (https://code.google.com/p/selenium/issues/detail?id=7488#c1))에서 사용할 수 있습니다. – Stijn

+0

감사합니다. 버그입니다. 다른 버전의 Firefox를 테스트했습니다. 버전 17, 24, 25는 잘 작동합니다. 버전 27 ~ 31이 작동하지 않습니다. – user3026964

답변

0

나는 같은 문제가 있었다. 해결책은 단순히 현재 Firefox 브라우저를 제거하고 이전 버전을 다운로드하는 것입니다. "2010 버전 3.6.10을 사용해 보았습니다." 당신의 코드는 문제가되지 않습니다. 모질라 사람들은 파이어 폭스를 통제 할 타사 응용 프로그램에 대한 권리를주지 않기로 결정했습니다.

행운

관련 문제