Skip to content
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

C#. A GetLog(LogType.Browser); throw an error 'object reference not set to an instance of an object' #7900

Closed
manbadalyan opened this issue Dec 30, 2019 · 8 comments
Labels
C-dotnet I-stale Applied to issues that become stale, and eventually closed.

Comments

@manbadalyan
Copy link

🐛 Bug Report

A GetLog(LogType.Browser); throw an error 'object reference not set to an instance of an object'

-->

To Reproduce

ChromeOptions copts = new ChromeOptions();
copts.SetLoggingPreference(LogType.Browser, LogLevel.All);
var service = ChromeDriverService.CreateDefaultService(browserpath);
service.LogPath = browserpath+"\chromedriver.log";
service.EnableVerboseLogging = true;
WebDriver = new ChromeDriver(service, copts)

var logEntry = WebDriver.Manage().Logs.GetLog(LogType.Browser);
ChromeDriver version 79.0.3945.3600
Please help

Environment

OS:
Browser:
Browser version:
Browser Driver version:
Language Bindings version:
Selenium Grid version (if applicable):

@ghost ghost added the needs-triaging label Dec 30, 2019
@manbadalyan manbadalyan changed the title A GetLog(LogType.Browser); throw an error 'object reference not set to an instance of an object' C#. A GetLog(LogType.Browser); throw an error 'object reference not set to an instance of an object' Jan 8, 2020
@cath3r0
Copy link

cath3r0 commented Jan 9, 2020

what version of selenium are you using?

looks like it was resolved in #7390 for alpha-version, but stable is still suffering from this

@manbadalyan
Copy link
Author

manbadalyan commented Jan 9, 2020 via email

@manbadalyan
Copy link
Author

I've upgraded Selenium Webdriver/Support version to 4.0.0-alpha04, but now there are new errors

Severity Code Description Project File Line Suppression State
Error CS0012 The type 'ISearchContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'WebDriver, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'. PageObjects ...\PageObjects\PageObject.cs 20 N/A

Severity Code Description Project File Line Suppression State
Error CS0012 The type 'IWebDriver' is defined in an assembly that is not referenced. You must add a reference to assembly 'WebDriver, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'. PageObjects ...\PageObjects\PageObject.cs 20 N/A

Severity Code Description Project File Line Suppression State
Error CS1503 Argument 2: cannot convert from 'PageObjects.PageObject' to 'SeleniumExtras.PageObjects.IElementLocator' PageObjects ...\PageObjects\PageObject.cs 20 N/A

Severity Code Description Project File Line Suppression State
Error CS0012 The type 'IWebDriver' is defined in an assembly that is not referenced. You must add a reference to assembly 'WebDriver, Version=3.10.0.0, Culture=neutral, PublicKeyToken=null'. PageObjects ...\PageObjects\PageObject.cs 101 N/A

@Bakanych
Copy link

Any updates on this?

@pujagani
Copy link
Contributor

Thank you for providing the details and the updates. I attempted to re-create the issue as follows.

Reproduced using the code sample below:

namespace SeleniumClient
{
    public class LogTypeError
    {
        private ChromeDriver driver;

        [SetUp]
        public void Setup()
        {
            ChromeOptions options = new ChromeOptions();
            options.SetLoggingPreference(LogType.Browser, LogLevel.All);

            ChromeDriverService service = ChromeDriverService.CreateDefaultService("path", "chromedriver");
            service.LogPath =  "path/chromedriver.log";
            service.EnableVerboseLogging = true;

            driver = new ChromeDriver(service, options);

        }

        [Test]
        public void logTypeErrorTest()
        {
            driver.Url = "http://www.yahoo.com";
            var logEntry = driver.Manage().Logs.GetLog(LogType.Browser);
            Assert.NotZero(logEntry.Count);
            driver.Quit();
        }
    }
}

Result
The test passes

Environment
OS: MacOS High Sierra
Browser: Chrome
Browser version: 89.0.4389.114
Browser Driver version: ChromeDriver 89.0.4389.23
Language Bindings version: 4.0.0-beta2

I would recommend upgrading to the latest version 4.0.0-beta2 and check if the problem still persists. Thank you!

@github-actions
Copy link

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the I-stale Applied to issues that become stale, and eventually closed. label Jan 30, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 14 days with no activity.

@github-actions
Copy link

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.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C-dotnet I-stale Applied to issues that become stale, and eventually closed.
Projects
None yet
Development

No branches or pull requests

5 participants