无法从天青管道运行硒测试用例吗?

问题描述 投票:0回答:1

我已经使用Selenium IDE记录了一些测试用例。我已经以c#(nunit)语言导出了这些测试用例。由于必须将测试用例编译成.dll文件,因此我使用Visual Studio社区创建了一个库项目并粘贴我的测试用例进入该项目。然后我构建了该项目以生成从azure运行该测试用例所需的所有必需.dll文件。此后,我将整个库项目文件夹推入了azure仓库(连同DLL文件)。不幸的是,当我运行我的管道,它总是在“ VsTest-testAssemblies”任务上失败。

来自天蓝色日志的错误消息-

Running all tests in d:\a\1\s\chrometest\chrometest\bin\Debug\chrometest.dll
   NUnit3TestExecutor converted 1 of 1 NUnit test cases
  X createnewfolderonly [18s 200ms]
  Error Message:
   OpenQA.Selenium.NoSuchElementException : no such element: Unable to locate element: {"method":"css selector","selector":".butt > span"}
  (Session info: chrome=80.0.3987.132)
  Stack Trace:
     at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)
   at OpenQA.Selenium.Remote.RemoteWebDriver.FindElementByCssSelector(String cssSelector)
   at OpenQA.Selenium.By.<>c__DisplayClass23_0.<CssSelector>b__0(ISearchContext context)
   at OpenQA.Selenium.By.FindElement(ISearchContext context)
   at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by)
   at DefaultSuiteTest.createnewfolderonly() in C:\Users\Admin\source\repos\chrometest\chrometest\chrometestpage.cs:line 33

注意:我可以使用命令提示符直接通过本地计算机上的vstest.console.exe直接运行dll,没有任何问题,而且我也没有收到任何这些错误。在此之后,我还可以看到自动化的发生。为什么我无法从Azure管道中执行相同操作?

[我已经使用Selenium IDE记录了一些测试用例。我已经以c#(nunit)语言导出了这些测试用例。由于必须将测试用例编译成.dll文件,所以我使用...创建了一个库项目。

selenium-webdriver azure-devops selenium-ide
1个回答
0
投票

有时在本地运行UI测试比在服务器上运行更快,并且在调用该方法时,所需元素未完全加载。因此,您会看到上述错误Unable to locate element...

© www.soinside.com 2019 - 2024. All rights reserved.