2016-07-25 3 views
0

로컬 컴퓨터의 Visual Studio에서 C#으로 Selenium 테스트를 실행하면 테스트가 정상적으로 실행되고 모두 통과됩니다. 그러나 나는 젠킨스에서 그들을 실행하려고하면 실패합니다. FireFox를 사용하면 Jenkins가 올바르게 실행됩니다. 그러나 문제는 상사가 IE를 사용하기를 원한다는 것입니다. 왜냐하면 그것이 우리 회사가 가장 많이 사용하는 것이기 때문입니다.Selenium 테스트는 로컬 컴퓨터에서 실행되지만 jenkins에서는 실행되지 않습니다.

초기화 방법 Selenium.Tests.openBrowser 예외 던져 :

여기
[TestInitialize] 
public void openBrowser() 
{ 
    //Start Opening browser 

    var options = new InternetExplorerOptions() 
    { 
     InitialBrowserUrl = baseURL, 
     IntroduceInstabilityByIgnoringProtectedModeSettings = true, 
     IgnoreZoomLevel = true, 
     EnableNativeEvents = false 
    }; 

    string IE_DRIVER_PATH = @"C:\Users\eedward7\Desktop\Selenium"; 

    driver = new InternetExplorerDriver(IE_DRIVER_PATH, options);  
    driver.Manage().Window.Maximize(); 
    driver.Navigate().GoToUrl(this.baseURL); 

    WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(15)); 
    wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.Id("ctl00_ContentPlaceHolder1_Login1_UserName"))); 
    driver.FindElementById("ctl00_ContentPlaceHolder1_Login1_UserName").SendKeys(userID); 
    driver.FindElementById("ctl00_ContentPlaceHolder1_Login1_Password").SendKeys(password); 

    wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.Id("ctl00_ContentPlaceHolder1_Login1_LoginButton"))); 
    driver.FindElementById("ctl00_ContentPlaceHolder1_Login1_LoginButton").Click(); 
    wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.Id("ctl00_TreeView1t6"))); 
} 

젠킨스가 에러 메시지이다 : 여기

실행하는 데 실패하는 코드이다. OpenQA.Selenium.WebDriverException : OpenQA.Selenium.WebDriverException : URL http://localhost:61076/session에 대한 원격 WebDriver 서버에 대한 HTTP 요청이 60 초 후에 시간 초과되었습니다. ---> System.Net.WebException : 작업 시간이 초과되었습니다.

그리고 마지막으로 스택 트레이스 :

OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse에서 System.Net.HttpWebRequest.GetResponse() (WebRequest를 요청) 에서

--- 끝 OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute에서 OpenQA.Selenium.Remote.HttpCommandExecutor.Execute (명령 commandToExecute) (AT OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse (WebRequest를 요청) 에서 내부 예외 스택 추적 --- 의 명령 commandToExecute)OpenQA.Selenium.Remote.RemoteWebDriver.Execute (문자열 driverCommandToExecute, Dictionary`2 매개 변수) OpenQA.Selenium.Remote.RemoteWebDriver..ctor에서 OpenQA.Selenium.Remote.RemoteWebDriver.StartSession (ICapabilities desiredCapabilities) 에서 (ICommandExecutor commandExecutor에서, ICapabilities desiredCapabilities) OpenQA.Selenium.IE.InternetExplorerDriver..ctor (문자열 internetExplorerDriverServerDirectory, InternetExplorerOptions 옵션) at Selenium.Tests.openBrowser() (c : \ Users \ eedward7 \ Desktop \ Selenium \ Selenium \ UnitTest1.cs에 있음) line 50

내가 뭘 해야할지에 대해 지금 막 잃어 버렸기 때문에 누구에게나 놀라운 제안이 있습니다.

답변

0

이 옵션 chromeDriver을 시도

ChromeOptions chromeOptions = new ChromeOptions(); 
chromeOptions.AddArguments("test-type"); 
chromeOptions.AddArguments("no-sandbox"); 
new ChromeDriver(chromeOptions); 
+0

NB : 기본 설치 당신은 계정으로 실행 젠킨스 서비스를 시도 할 수 있도록 실행하기에 충분한 특별인가를하지 않는 것 "로컬 시스템"계정으로 Windows 서비스를 실행 좋은 특권을 가지고 – user6735199

관련 문제