2016-07-25 6 views
0

ローカルマシンのVisual StudioでC#でSeleniumテストを実行すると、テストは正常に実行され、すべてが正常に実行されます。しかし、私がジェンキンズでそれらを実行しようとすると失敗します。 FireFoxを使用すると、Jenkinsはうまく動作します。しかし、私の上司はIEを使用したいと思っています。というのも、それは私たちの会社が最も使っているものだからです。ここセレンテストはローカルマシンで実行されますが、ゲンキーでは実行されません

が実行に失敗しているコードである。

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:操作がタイムアウトしました。

と最後ではなく、少なくともスタックトレース:System.Net.HttpWebRequest.GetResponseで

() OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequestクラスリクエスト) で---終了内部例外スタックトレースの--- OpenQA.Selenium.Remote.DriverServiceCommandExecutor.ExecuteでOpenQA.Selenium.Remote.HttpCommandExecutor.Execute(コマンドcommandToExecute) (でOpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponseで (WebRequestクラスリクエスト) コマンドcommandToExecute)OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutorでOpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)でOpenQA.Selenium.Remote.RemoteWebDriver.Execute(文字列driverCommandToExecute、Dictionary`2パラメータ)で Selenium \ Selenium \ UnitTest1.csにあるSelenium.Tests.openBrowser()の をOpenQA.Selenium.IE.InternetExplorerDriver..ctor(文字列internetExplorerDriverServerDirectory、InternetExplorerOptionsオプション) に設定してください。c:\ Users \ eedward7 \ Desktop \ Selenium \ Selenium \ UnitTest1.cs:行50

私は今何をすべきかに迷っているので誰にでも驚くべき提案があります。

答えて

0

これらのオプションでchromeDriverを試してみてください

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

NB:デフォルトのインストールでは、あなたがアカウントで実行されているジェンキンスサービスを試すことができるように、実行するための十分な権限がありようには見えない「ローカルシステム」アカウントでWindowsサービスを実行します良いpriviligeと – user6735199

関連する問題