0

우리는 Selenium 테스트를 실행하기 위해 Team Services (Visual Studio Online) 빌드와 함께 MSTest을 사용하고 있습니다. FirefoxDriverInternetExplorerDriver이 올바르게 실행되고 있지만 브라우저를 열지 않아도 ChromeDriverOperaDriver은 항상 실패합니다. 그들은 다음과 같은 스택 추적과 함께 매번 실패 : 나는 드라이버 시작하는 데 사용하고 무엇Visual Studio Team Services (VS Online)에서 테스트를 실행하면 ChromeDriver와 OperaDriver가 실패합니다.

Initialization method WebUnitTests.Tests.DatacenterTests.TestInitialize threw exception. OpenQA.Selenium.WebDriverException: 
OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:1410/session timed out after 60 seconds. ---> 
System.Net.WebException: The operation has timed out. 

at System.Net.HttpWebRequest.GetResponse() 
at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request) 
--- End of inner exception stack trace --- 
at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request) 
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute) 
at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute) 
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) 
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) 
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) 
at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options) 
at WebUnitTests.Framework.Utilities.Driver.StartBrowser(BrowserTypes browserType, Int32 defaultTimeOut) in C:\agent2\_work\1\s\WebUnitTests\Framework\Utilities\Driver.cs:line 37 
at WebUnitTests.Framework.Utilities.BaseTests.InitializeBrowser(TestContext testContext) in C:\agent2\_work\1\s\WebUnitTests\Framework\Utilities\BaseTests.cs:line 328 
at WebUnitTests.Framework.Utilities.BaseTests.TestInitialize() in C:\agent2\_work\1\s\WebUnitTests\Framework\Utilities\BaseTests.cs:line 147 

: 언급

var chromeOptions = new ChromeOptions(); 
chromeOptions.AddArgument("--ignore-certificate-errors"); 
var chromeBrowser = new ChromeDriver(chromeOptions); 

하나 개 매우 중요한 것은이를 그 난에 대한 테스트를 실행 해요 경우 내 로컬 컴퓨터가 제대로 작동하면 CI에서 실행될 때만 문제가 발생합니다.

루트 문제를 찾을 수있는 방법에 대한 아이디어가 있습니까? 이 문제를 해결할 수있는 해결 방법은 무엇입니까?

+0

대화식 모드에서 실행되도록 빌드/테스트 에이전트를 구성 했습니까? 빌드/테스트 에이전트에서 수동으로 테스트를 실행하면 성공적으로 실행됩니까? –

답변

1

좋아, 문제는 좀 더 복잡해 보이지만 다른 사람이 같은 상황에있는 경우에 대비해 게시하고 있습니다.

기본적으로 테스트 에이전트는 서비스로 설치되며 Windows (NT) 서비스에서 시작된 모든 프로세스는 세션 0에서 실행되며 로그온 한 사용자에게는 보이지 않습니다.

크롬은 세션 0에서 벗어나려고 노력하고 여기이 더 참조를 찾을 수 있습니다 (아래 링크 (21)를 언급하지만, 실제로 전체 스레드는이 주제에 관하여 좋은 읽기입니다) : https://bugs.chromium.org/p/chromium/issues/detail?id=615396#c21

이제이 문제를 해결하기 위해 몇 가지 옵션을 사용할 수 있습니다. Chrome에서 Canary 빌드를 다운로드하십시오. 그러나 임시 수정 사항이므로 권장하지 않습니다. Chrome 개발자는 가까운 시일 내에 Chrome (및 ChromeDriver)에서 더 이상 세션 0을 사용할 수 없다고 말합니다.

최상의 솔루션은 MS 테스트 에이전트를 프로세스로 설치하여 모든 응용 프로그램이 로그인 한 사용자에게 표시되도록하는 것입니다. 자세한 내용은 여기에서 찾을 수 있습니다 : https://msdn.microsoft.com/en-us/library/ee291332.aspx

이 또 다른 옵션은 그러나 나는 Windows 서비스로 테스트 에이전트를 사용하여 그와 함께 테스트하지 않은, 크롬 인수로 추가 아래의 설정을하는 것입니다, 그래서 난 몰라 작동하는지 여부는 알지만 테스트 에이전트와 함께 작동하는지 확인할 수 있습니다.

var chromeOptions = new ChromeOptions(); 
chromeOptions.AddArguments("test-type"); 
chromeOptions.AddArguments("--disable-extensions"); 
chromeOptions.AddArguments("no-sandbox"); 
var driver = new ChromeDriver(chromeOptions); 
관련 문제