[Selenium 4] [C#] RemoteWebDriver doesn't implement IDevTools
See original GitHub issue🐛 Bug Report
Description
When trying to get devtools for RemoteWebdriver as IDevTools, null returned. When instead of RemoteWebdriver using ChromeDriver, everything works fine and able to create dev tools session. Looks that RemoteWebDriver doesn’t implement IDevTools. https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/src/webdriver/Remote/RemoteWebDriver.cs
To Reproduce
Doesn’t work - devTools are null
var driver = new RemoteWebDriver(new Uri(_seleniumHubUrl), options.ToCapabilities(), TimeSpan.FromMinutes(2));
var devTools = driver as IDevTools;
devTools.CreateDevToolsSession()
Works fine - devTools are not null
var driver = new ChromeDriver(Environment.CurrentDirectory, options, TimeSpan.FromMinutes(3));
var devTools = driver as IDevTools;
devTools.CreateDevToolsSession()
Expected behavior
RemoteWebDriver implements IDevTools. Able to set up dev tools and create dev tools session for RemoteWebdriver
Environment
OS: Windows10 Browser: Chrome Browser version: 87 Browser Driver version: 87.0.4280.8800 Language Bindings version: C# 4.0.0-alpha07 Selenium Grid version (if applicable): 4.0.0-beta-1-prerelease-20201208
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:9 (1 by maintainers)
Top GitHub Comments
I managed to have this working with some small workaround. Reviewing chromium driver code I found a method responsible for setting up chrome dev tools session and adjusted it a bit for my purpose.
First we need to set remote debugging address using chromeopitons. What is also important we need to run our driver in headless mode.
Then it can be used for setting up remote WebDriver dev tools session
Of course for our selenium docker image, we need to expose the proper port so chrome dev tools session can be set up, in my case, it was standalone chome
docker run --privileged -d -p 4444:4444 -p 9222:9222 -v /dev/shm:/dev/shm selenium/standalone-chrome
Team,
I have tried to implement the devtools for RemoteWebdriver as IDevTools using C# and it returned null. It seems, the RemoteWebDriver does not implement IDevTools. We are waiting for this devtools support for RemoteWebdriver in Selenium 4. Thanks in advance.