Skip to content

[🐛 Bug]: Failed to connect to a chrome session using the debug port #15720

@fparreirinha

Description

@fparreirinha

Description

Getting timeout error when try to connect in a chrome session started with specific port.

I guess the ChromeDriver constructor is not correctly using the port sent in the DebuggerAddress option.

Image

Reproducible Code

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System.Diagnostics;

namespace My.GettingStarted;

public static class FirstScript
{
    public static void Main()
    {
        var startInfo = new ProcessStartInfo
        {
            FileName = @"C:\Program Files\Google\Chrome\Application\chrome.exe",
            //Arguments = $"/incognito {url} --remote-debugging-port={debuggingPort} --start-maximized",
            Arguments = @"https://google.com --remote-debugging-port=9510 --start-maximized",

            UseShellExecute = true,

        };

        Process.Start(startInfo);

        ChromeOptions options = new();
        string hostDriver = "localhost";
        options.DebuggerAddress = @$"{hostDriver}:9520";
        // The error occurs on the next line.
        IWebDriver driver = new ChromeDriver(options);

        driver.FindElement(By.XPath(@"//textarea[@aria-label='Pesquisar']")).SendKeys("Felipe Sant Ana Parreira");
    }
}

ℹ️ Last known working version: 4.25.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!C-dotnet.NET BindingsD-chromeI-defectSomething is not working as intendedI-regressionSomething was working but we "fixed" itOS-windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions