0
**************** Starting test execution *********************
C:\hostedtoolcache\windows\VsTest\16.4.0\x64\tools\net451\Common7\IDE\Extensions\TestPlatform\vstest.console.exe "@d:\a\_temp\ob3w54ta3i1.tmp"
Microsoft (R) Test Execution Command Line Tool Version 16.4.0
Copyright (c) Microsoft Corporation.  All rights reserved.
vstest.console.exe "d:\a\1\s\site\tests\WebSite.Automacao.Tests\bin\$(BuildConfiguration)\netcoreapp3.1\WebSite.Automacao.Tests.dll"
/Settings:"d:\a\_temp\bvgizjzmqi2.tmp.runsettings"
/Logger:"trx"
/TestAdapterPath:"d:\a\1\s"
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.1 (64-bit .NET Core 3.1.5)
[xUnit.net 00:00:01.73]   Discovering: WebSite.Automacao.Tests
[xUnit.net 00:00:01.89]   Discovered:  WebSite.Automacao.Tests
[xUnit.net 00:00:01.89]   Starting:    WebSite.Automacao.Tests
-> Loading plugin d:\a\1\s\site\tests\WebSite.Automacao.Tests\bin\$(BuildConfiguration)\netcoreapp3.1\TechTalk.SpecFlow.xUnit.SpecFlowPlugin.dll
-> Using default config
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}) on port 50056
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}) on port 50059
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}) on port 50058
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}) on port 50057
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
ChromeDriver was started successfully.
ChromeDriver was started successfully.
ChromeDriver was started successfully.
##[error][xUnit.net 00:05:23.38]     
Register a new address [FAIL]
[xUnit.net 00:05:23.38]       OpenQA.Selenium.WebDriverTimeoutException : Timed out after 300 seconds: Timeout expired on selector By.LinkText: Register
[xUnit.net 00:05:23.38]       Stack Trace:
[xUnit.net 00:05:23.38]            at OpenQA.Selenium.Support.UI.DefaultWait`1.ThrowTimeoutException(String exceptionMessage, Exception lastException)
[xUnit.net 00:05:23.38]            at OpenQA.Selenium.Support.UI.DefaultWait`1.Until[TResult](Func`2 condition)
[xUnit.net 00:05:23.38]         d:\a\1\s\site\tests\WebSite.Automacao.Tests\Config\WebDriverExtensions.cs(22,0): at WebSite.Automacao.Tests.Config.WebDriverExtensions.FindDelay(IWebDriver driver, By by, Int32 timeoutInSeconds, Int32 waitTimeInMilliseconds)
[xUnit.net 00:05:23.39]         d:\a\1\s\site\tests\WebSite.Automacao.Tests\Config\WebDriverExtensions.cs(45,0): at WebSite.Automacao.Tests.Config.WebDriverExtensions.DelayClick(IWebDriver driver, By by, Int32 timeoutInSeconds, Int32 waitTimeInMilliseconds)
[xUnit.net 00:05:23.39]         d:\a\1\s\site\tests\WebSite.Automacao.Tests\Config\SeleniumHelper.cs(44,0): at WebSite.Automacao.Tests.Config.SeleniumHelper.ClickLinkByText(String linkText)

Project: .NET Core 3.1

References:

    <PackageReference Include="bogus" Version="29.0.2" />
    <PackageReference Include="DotNetSeleniumExtras.WaitHelpers" Version="3.11.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.3" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
    <PackageReference Include="Selenium.Support" Version="3.141.0" />
    <PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
    <PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="83.0.4103.3910" />
    <PackageReference Include="Selenium.WebDriver.GeckoDriver" Version="0.26.0.3" />
    <PackageReference Include="SpecFlow" Version="3.3.30" />
    <PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.3.30" />
    <PackageReference Include="SpecFlow.xUnit" Version="3.3.30" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.2">

Browsers and webdrivers
Google Chrome 83.0.4103.106
Chrome Driver 83.0.4103.39

https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md

The tests access an externally published url. For example: https://stackoverflow.com/

I increased the timeout to 300 seconds but was unsuccessful.

All tests run successfully in Visual Studio 2019.

Edited

Checking the test prints, it was found that the problem is in the resolution that opens the browser.

IWebDriver webDriver = null;
var options = new ChromeOptions();
options.SetLoggingPreference(LogType.Browser, LogLevel.All);
options.AddArgument("--disable-infobars");
options.AddArgument("--disable-gpu");
options.AddArgument("--window-size=1920,1080");
options.AddArgument("--disable-extensions");
options.AddArgument("--start-maximized");
options.AddArgument("--no-first-run");
options.AddArgument("--no-default-browser-check");
options.AddArgument("--ignore-certificate-errors");
options.AddArgument("--no-sandbox");
options.AddArgument("--disable-dev-shm-usage");
webDriver = new ChromeDriver(options);
webDriver.Manage().Window.Maximize();
webDriver.Manage().Window.FullScreen();

Retrieving the screen size

webDriver.Manage().Window.Size

window-size: {Width=1024, Height=768}

How to change the screen resolution in AzureDevOps?

  • Could you translate the error message to English? We cannot help you unless we know the error message, and unfortunately we are mostly English speakers on StackOverflow. – Greg Burghardt Jul 01 '20 at 20:16
  • @GregBurghardt sorry... edited – Fernando A A Hortencio Machado Jul 01 '20 at 22:40
  • From the error log, this issue is on the `driver.findElement(By.linkText("Register"))` calls. Check if [this ticket](https://stackoverflow.com/questions/53190909/random-selenium-e2e-tests-fail-because-of-timeouts-on-azure-devops-but-work-loca) could give you some ideas. – Kevin Lu-MSFT Jul 02 '20 at 09:25
  • Please [edit] your question and include the C# code, as well as the relevant HTML. – Greg Burghardt Jul 03 '20 at 13:29
  • @GregBurghardt I made the edit after checking the problem with the screen resolution – Fernando A A Hortencio Machado Jul 16 '20 at 16:57
  • I'm confused. The error in the test output is "OpenQA.Selenium.WebDriverTimeoutException : Timed out after 300 seconds: Timeout expired on selector By.LinkText: Register" which implies it failed to find an element by link text. What does this have to do with resizing the browser window? – Greg Burghardt Jul 16 '20 at 18:45
  • 1
    @GregBurghardt I included this task in my build definition and apparently I solved the problem. https://marketplace.visualstudio.com/items?itemName=ms-autotest.screen-resolution-utility-task – Fernando A A Hortencio Machado Jul 20 '20 at 12:21
  • That's really good to know. Running SpecFlow tests with Selenium in DevOps has been on my to-do list for a while. It would be worth while to post an answer to your own question explaining the root cause of the problem, and including a link to the build task. – Greg Burghardt Jul 20 '20 at 12:27

0 Answers0