-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty logs for Selenium 4 alpha 5 when using RemoteWebdriver #8229
Comments
Issue reproducible also on standalone-chrome:4.0.0-alpha-5-20200409 |
Issue reproducible also on version 4.0.0-alpha6-20200609. Are there any plans to look at this? |
Works for me with docker image selenium/standalone-chrome:4.0.0-alpha6-20200609 and java binding 4.0.0-alpha6, so it must be something .Net specific. |
Yes, reproduced with .Net binding 4.0.0-alpha05 and the abovementioned docker image |
Hey @barancev we are running into this problem as well in our test environment. In fact, with Chrome 85, we had to update to a newer version of Selenium and ended up running into this bug. Is there any plans on addressing this soon? |
this is also affecting us - would just like to chime in |
Seleniunm currently does not return log messages (See SeleniumHQ/selenium#8229). This making figuring out blazor WASM test failures a lot harder. This change adds some JS to the test apps to read the console output.
* Attempt to read the logs from the browser Seleniunm currently does not return log messages (See SeleniumHQ/selenium#8229). This making figuring out blazor WASM test failures a lot harder. This change adds some JS to the test apps to read the console output. * WIP
Problem is that RemoteWebDriver does not implement marker interface Currently we use the following workaround: private static ConcurrentDictionary<IWebDriver, ICommandExecutor> _commandExecutors = new ConcurrentDictionary<IWebDriver, ICommandExecutor>();
private static List<LogEntry> GetLogs(IWebDriver webDriver)
{
// Workaround for bug https://github.com/SeleniumHQ/selenium/issues/8229 .
if (!_commandExecutors.TryGetValue(webDriver, out var commandExecutor))
{
commandExecutor = (ICommandExecutor)typeof(RemoteWebDriver)
.GetProperty("CommandExecutor", BindingFlags.NonPublic | BindingFlags.Instance)
.GetValue(webDriver);
commandExecutor.CommandInfoRepository.TryAddCommand(DriverCommand.GetAvailableLogTypes, new CommandInfo(CommandInfo.GetCommand, "/session/{sessionId}/se/log/types"));
commandExecutor.CommandInfoRepository.TryAddCommand(DriverCommand.GetLog, new CommandInfo(CommandInfo.PostCommand, "/session/{sessionId}/se/log"));
_commandExecutors[webDriver] = commandExecutor;
}
var response = commandExecutor.Execute(new Command(((IHasSessionId)webDriver).SessionId, DriverCommand.GetLog, new Dictionary<string, object> { ["type"] = "browser" }));
var fromDictionaryMethod = typeof(LogEntry).GetMethod("FromDictionary", BindingFlags.Static | BindingFlags.NonPublic);
var logEntries = ((IEnumerable<object>)response.Value)
.Select(v => fromDictionaryMethod.Invoke(null, new[] { v }))
.OfType<LogEntry>()
.ToList();
return logEntries;
} |
Thanks @Dreamescaper your workaround works perfectly |
What seems like a simpler workaround to me is the following. Subclass private class RemoteWebDriverWithLogs : RemoteWebDriver, ISupportsLogs
{
// Also pass through any constructors you want to use
} It makes our tests work again. |
Workaround for version 4 RC1
|
Any chance to fix that? |
You should be able to directly subclass this and just add public class RemoteChromeDriver : RemoteWebDriver, ISupportsLogs That said, this should be easier. Jim created the Custom Driver Command Executor class for adding browser-specific functionality like this (https://titusfortner.com/2022/03/10/custom-executor.html) Except just adding the commands isn't enough because there is no way to allow the RemoteDriver to implement I'll PR something and see if it is the least hacky way to support it. |
This will work with Selenium 4.2:
|
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🐛 Bug Report
A clear and concise description of what the bug is.
When using latest Selenium 4 image with RemoteWebdriver and chrome standalone 4.0.0-alpha-5-20200326 docker image all kind of logs are empty. Problem does not exists in case of using local chrome browser (ver 80.0.3987.149 ).
To Reproduce
AvailableLogTypes count returns 0
Detailed steps to reproduce the behavior:
Expected behavior
There should be 5 types of logs, and at least 2 of them shouldn't be empty (Browser and Driver) - like in case of running this against regular Chrome browser.
Test script or set of commands reproducing this issue
Environment
OS: Windows 10
Browser: Chrome
Browser version: 80.0.3987.149
Docker image version: 4.0.0-alpha-5-20200326
Browser Driver version: 80.0.3987.10600
Language Bindings version: .net core 3.1
Selenium Grid version : 4.0.0-alpha-5
The text was updated successfully, but these errors were encountered: