title: Selenium UI Test Fails When Running On VS Test, But Runs In Visual Studio Locally Fine
body: <p>Our QA analyst wrote UI Test using these Nuget Packages</p>
  
  <ul>
  <li>NUnit 3.8.1</li>
  <li>NUnit Console Runner 3.7.0</li>
  <li>Nunit 3 Test Adapter 3.8.0</li>
  <li>Nunit Orange 2.1.0</li>
  <li>Selenium Support 3.5.2</li>
  <li>Selenium Web Driver 3.5.2</li>
  <li>Selenium Web Driver IEDriver 3.5.1</li>
  <li>Selenium Web Driver Wait Extensions 1.0.0</li>
  </ul>
  
  <p>When we open the solution in visual studio and select the test category to run, each test opens a firefox browser, login, navigate to the page, detect the element and basically passes.</p>
  
  <p>However, when we use Visual Studio's scripted builds, on the Visual Studio Test V2 process, all test fails with this error:</p>
  
  <p>Failed   Test A
  2017-09-06T19:09:01.3495462Z Error Message:
  2017-09-06T19:09:01.3495462Z    OpenQA.Selenium.ElementNotVisibleException : 
  2017-09-06T19:09:01.3495462Z Stack Trace:
  2017-09-06T19:09:01.3495462Z    at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
  2017-09-06T19:09:01.3495462Z    at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary<code>2 parameters)
  2017-09-06T19:09:01.3495462Z    at OpenQA.Selenium.Remote.RemoteWebElement.Click()
  2017-09-06T19:09:01.3495462Z    at x.Init.click(By locator) in E:\agent\_work\1\s\UI Tests\AutomatedTests(FF)\x\Init\Init.cs:line 362
  2017-09-06T19:09:01.3495462Z    at x.AbstractPage.expandMenuItem(By menuItemlocator) in E:\agent\_work\1\s\UI Tests\AutomatedTests(FF)\xSelenium\Pages\AbstractPage.cs:line 223
  2017-09-06T19:09:01.3495462Z    at xSelenium.AbstractPage.openAirlinesPage() in E:\agent\_work\1\s\UI Tests\AutomatedTests(FF)\xSelenium\Pages\AbstractPage.cs:line 775
  2017-09-06T19:09:01.3495462Z    at xSelenium.Acceptance.Acceptance_SeniorManager_OpenAndCheckLinksOnAirlinesPage() in E:\agent\_work\1\s\UI Tests\AutomatedTests(FF)\xSelenium\Tests\Acceptance.cs:line 750Standard Output Messages:
  2017-09-06T19:09:01.3495462Z    OpenQA.Selenium.WebDriverTimeoutException: Timed out after 25 seconds
  2017-09-06T19:09:01.3495462Z       at OpenQA.Selenium.Support.UI.DefaultWait</code>1.ThrowTimeoutException(String exceptionMessage, Exception lastException)
  2017-09-06T19:09:01.3495462Z       at OpenQA.Selenium.Support.UI.DefaultWait<code>1.Until[TResult](Func</code>2 condition)
  2017-09-06T19:09:01.3495462Z       at xSelenium.Init.waitUntilElementIsNotVisible(By by) in E:\agent_work\1\s\UI Tests\AutomatedTests(FF)\xSelenium\Init\Init.cs:line 596
  2017-09-06T19:09:01.3495462Z    Unable to locate element: //span[text()='OK']
  2017-09-06T19:09:01.3495462Z    <em>Start of error stack trace</em>
  2017-09-06T19:09:01.3495462Z       at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
  2017-09-06T19:09:01.3495462Z       at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
  2017-09-06T19:09:01.3495462Z       at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)
  2017-09-06T19:09:01.3495462Z       at OpenQA.Selenium.Remote.RemoteWebDriver.FindElementByXPath(String xpath)
  2017-09-06T19:09:01.3495462Z       at OpenQA.Selenium.By.&lt;>c__DisplayClasse.b__c(ISearchContext context)
  2017-09-06T19:09:01.3495462Z       at OpenQA.Selenium.By.FindElement(ISearchContext context)
  2017-09-06T19:09:01.3495462Z       at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by)
  2017-09-06T19:09:01.3495462Z       at xSelenium.Init.isElementPresent(By by) in E:\agent_work\1\s\UI Tests\AutomatedTests(FF)\xSelenium\Init\Init.cs:line 412
  2017-09-06T19:09:01.3495462Z    <em>End of error stack trace</em></p>
  
  <p>The build machine is running Windows 10 (another build machine runs Server 2012, and throws same error)</p>
  
  <ul>
  <li>Firefox 55</li>
  <li>Chrome Version 60.0.3112.113</li>
  </ul>
  
  <p>These Visual Studio Test options have been enabled:
   - Test Mix contains UI tests</p>
  
  <p>The agent on the server is on interactive mode and is registered as a Windows Service - it has 'Allow service to interact with desktop' enabled. </p>
  
  <p>Have increased the SetPageLoadTimeout and SetScriptTimeout timeout to 120s but problem still persist.</p>