我們的QA分析師使用這些的NuGet包硒UI測試失敗當運行VS測試,但運行在Visual Studio局部精細
- 寫的UI測試NUnit的3.8.1
- NUnit的控制檯亞軍3.7.0
- NUnit的3測試適配器3.8.0
- NUnit的橙色2.1.0
- 硒支持3.5.2
- 硒網絡驅動器3.5.2
- 硒網絡驅動IEDriver 3.5.1
- 硒網絡驅動程序等待擴展1.0.0
當我們打開Visual Studio中的解決方案,並選擇測試類別跑,每個測試打開Firefox瀏覽器,登錄,導航到頁面,檢測元素並基本通過。
然而,當我們使用Visual Studio的腳本生成,在Visual Studio的測試V2過程中,所有的測試失敗,此錯誤:
失敗測試A 2017-09-06T19:09:01.3495462Z錯誤信息: 2017-09-06T19:09:01.3495462Z OpenQA.Selenium.ElementNotVisibleException: 2017-09-06T19:09:01.3495462Z堆棧跟蹤: 2017-09-06T19:09:01.3495462Z在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.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
1.ThrowTimeoutException(String exceptionMessage,Exception lastException) 2017-09-06T19:09:01.3495462Z at OpenQA.Selenium.Support.UI.DefaultWait 1.Until[TResult](Func
2 condition) 2017-09-06T19:09:01.3495462Z at xSelenium.Init.waitUntilElementIsNotVisible(By )在E:\ agent_work \ 1 \ s \ UI Tests \ AutomatedTests(FF)\ xSelenium \ Init \ Init.cs:line 596 2017-09-06T19:09:01.3495462Z無法找到元素:// span [text ()='OK'] 2017-09-06T19:09:01.3495462Z 錯誤堆棧跟蹤開始 2017-09-06T19:09:01.3495462Z at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) 2017-09-06T19:09:01.3495462Z在OpenQA.Selenium.Remote.RemoteWebDriver.Execute(字符串driverCommandToExecute,Dictionary`2參數) 2017-0在OpenQA.Semiconductor.RemoteWebDriver.FindElementByXPath(String xpath)中的OpenQA.Semiconductor.RemoteWebDriver.FindElement(字符串機制,字符串值)09-06T19:09:01.3495462Z 2017-09-06T19:09:01.3495462Z在OpenQA.Selenium.Remote.RemoteWebDriver.FindElementByXPath在OpenQA.Selenium.By上發佈2017-04-06T19:09:01.3495462Z。在OpenQA.Selenium.Remote處的OpenQA.Selenium.By.FindElement(ISearchContext上下文) 2017-09-06T19:09:01.3495462Z上顯示c__DisplayClasse.b__c(ISearchContext上下文) 2017-09-06T19:09:01.3495462Z。 RemoteWebDriver.FindElement(通過用) 2017-09-06T19:09:01.3495462Z在xSelenium.Init.isElementPresent(通過用)在E:\ agent_work \ 1 \ S \ UI測試\ AutomatedTests(FF)\ xSelenium \初始化\ Init.cs:412行 2017-09-06T19:09:01。3495462Z 結束錯誤的堆棧跟蹤
構建機上運行Windows 10的(另一構建機器運行Server 2012中,並拋出同樣的錯誤)
- 火狐55
- 的Chrome版本60.0.3112.113
這些Visual Studio測試選項已啓用: - 測試組合包含UI測試
服務器上的代理程序處於交互模式並已註冊爲Windows服務 - 它具有「允許服務與桌面交互」功能。
已將SetPageLoadTimeout和SetScriptTimeout超時增加到120秒,但問題仍然存在。
在OneDrive上共享詳細信息日誌。另一方面,嘗試直接使用交互模式設置構建代理(而不是具有允許服務與桌面交互選項的服務)。 https://www.visualstudio.com/en-us/docs/build/actions/agents/v2-windows#choose-interactive-or-service-mode –