Skip to content

[🐛 Bug]: WebDriver hanging in case of DevTools opened and tests are executed in multiple thread #11703

@fenben5754

Description

@fenben5754

What happened?

Create at least 2 test in different classes
Set the collection behavior to CollectionPerClass, and the MaxParallelThreads to 2
Create a simple webdriver and get the devtools session
Try to Run the tests in the same time from Test Explorer

result: tests are hanging

expected result: page should opened on all created browser

hint: works fine if I set the MaxPrallelThreads to 3

How can we reproduce the issue?

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.DevTools;
using System.Threading;
using Xunit;

[assembly: CollectionBehavior(CollectionBehavior.CollectionPerClass, MaxParallelThreads = 2)]
namespace SeleniumDevtoolMultiThread
{
    public class TestClass1
    {
        [Fact]
        public void Test()
        {
            TestClassHelper.OpenDevToolsAndNavigate();
        }
    }

    public class TestClass2
    {
        [Fact]
        public void Test()
        {
            TestClassHelper.OpenDevToolsAndNavigate();
        }
    }

    public static class TestClassHelper
    {
        public static void OpenDevToolsAndNavigate()
        {
            IWebDriver webDriver = new ChromeDriver();
            IDevTools devTools = webDriver as IDevTools;
            devTools.GetDevToolsSession();
            webDriver.Navigate().GoToUrl("https://www.google.com");
            webDriver.Quit();
        }
    }
}

Relevant log output

there is no log, the test just hanging

Operating System

Windows 10

Selenium version

.NET 4.8.1

What are the browser(s) and version(s) where you see this issue?

Chrome 110.0.5481.177

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 110.0.5481.7700

Are you using Selenium Grid?

not used

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-devtoolsIncludes everything BiDi or Chrome DevTools relatedC-dotnet.NET BindingsI-defectSomething is not working as intendedJ-awaiting answerQuestion asked of user; a reply moves it to triage again

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions