Search code examples
c#selenium-webdriveronexception

Selenium 2 OnException method in c#


Am porting by Java codes to c#. I wanted to re-write the following Java code in c#. Thanks in advance :)

// Called whenever an exception would be thrown.
    public void onException(java.lang.Throwable throwable, WebDriver driver){
        System.out.println("onException' Called whenever an exception would be thrown ...");
    }

Solution

  • A like to like translation is as follow:

    public void OnException(System.Exception exception, IWebDriver driver)
    {
        Console.WriteLine("OnException' Called whenever an exception would be thrown ...");
    }