WebDriverException - Unexcepted error. Unknown error. When running test with Selenium

Not reproducible Issue #9613662

Details

Author
Richard D.
Created
Nov 1, 2016
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
15.14955
Reports
Reported by 3 people

Sign in to watch or report this issue.

Steps to reproduce

Download Insider webdriver from https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

In Visual Studio:

IWebDriver edgeDriver = new EdgeDriver();

Run tests

Attachments

1 attachment

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “Ibrahim O.”

  • Hi I am getting the same issue as well using the latest stable webdriver. I tried the insiders build but still no resolve.

    DesiredCapabilities capabilities = DesiredCapabilities.edge();
    EdgeDriverService service = new EdgeDriverService.Builder().usingDriverExecutable(edgeDriverPath)
                    .usingAnyFreePort().build();
    WebDriver result = new EdgeDriver(service, capabilities);
    result.navigate().refresh;
    

    ,

    Unknown error (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 16 milliseconds Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40' System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0' Driver info: org.openqa.selenium.edge.EdgeDriver Capabilities [{applicationCacheEnabled=true, acceptSslCerts=true, browserVersion=38.14393.0.0, platformVersion=10, locationContextEnabled=true, webStorageEnabled=true, browserName=MicrosoftEdge, takesScreenshot=true, pageLoadStrategy=normal, takesElementScreenshot=true, platformName=windows, platform=ANY}] Session ID: 5491A1B1-36EC-4BDB-919F-60EE580D127C
    
    org.openqa.selenium.WebDriverException: Unknown error (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 16 milliseconds
    Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40'
    System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0'
    Driver info: org.openqa.selenium.edge.EdgeDriver
    Capabilities [{applicationCacheEnabled=true, acceptSslCerts=true, browserVersion=38.14393.0.0, platformVersion=10, locationContextEnabled=true, webStorageEnabled=true, browserName=MicrosoftEdge, takesScreenshot=true, pageLoadStrategy=normal, takesElementScreenshot=true, platformName=windows, platform=ANY}]
    Session ID: 5491A1B1-36EC-4BDB-919F-60EE580D127C
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:88)
        at .(Unknown Source)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:701)
        at org.openqa.selenium.remote.RemoteWebDriver$RemoteNavigation.refresh(RemoteWebDriver.java:977)
  • Thank you for your feedback. I am having difficulties reproducing this issue on Windows Insider 14959 with Webdriver 10.0.14959.1000 (You can check this by right clicking your webdriver executable then select properties and details)

    Here is the C# binding that successfully run :

    string serverPath = "Microsoft Web Driver";
                 
                try
                {
                    if (System.Environment.Is64BitOperatingSystem)
                    {
                        serverPath = Path.Combine(System.Environment.ExpandEnvironmentVariables(“%ProgramFiles(x86)%”), serverPath);
                    }
                    else
                    {
                        serverPath = Path.Combine(System.Environment.ExpandEnvironmentVariables(“%ProgramFiles%”), serverPath);
                    }
                    EdgeOptions options = new EdgeOptions();
                    options.PageLoadStrategy = EdgePageLoadStrategy.Eager;
                    IWebDriver driver = new EdgeDriver(serverPath, options);              
                    driver.Url = "www.bing.com";
                    driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(5));
                    driver.Navigate();

                }

                catch (Exception e)
                {

                    Console.WriteLine(“Exception” + e.ToString());

                }

    Could you please verify that you are running matched OS and Webdriver builds during your tests? If yes could you also please provide us your reduced repro code or sample. That will help us investigate the issue.

    All the best,
    The MS Edge Team

  • Microsoft Edge Team

    Changed Assigned To from “Ibrahim O.” to “James M.”

    Changed Status to “Not reproducible”

  • Hello,

    Thank you for providing this information about the issue. After thorough testing, we are unable to reproduce this problem in Edge with the information at hand. Please update this case when you can provide more details, such as your WebDriver version and also a sample script for our investigation.

    Best Wishes,
    The MS Edge Team
     

  • Hello,

    I have reproduced the same issue on Windows 1709, with appropriate MicrosoftWebDriver.exe version.

    Web dirver used with Python 2.7.14.

    Stack trace:
    "
    Traceback (most recent call last):
    File "web.py", line 3, in
    wd = webdriver.Edge(executable_path=’f:\MicrosoftWebDriver.exe’)
    File "C:\Python27\lib\site-packages\selenium\webdriver\edge\webdriver.py", line 48, in init
    desired_capabilities=capabilities)
    File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 156, in init
    self.start_session(capabilities, browser_profile)
    File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 251, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
    File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute
    self.error_handler.check_response(response)
    File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 208, in check_response
    raise exception_class(value)
    selenium.common.exceptions.WebDriverException: Message: Unknown error
    "

    =========
    Solution
    =========
    gpedit.msc -> Computer config -> Windows settings -> Security settings -> Local policies -> Security options

    1. Set “User account control: Run all administrators in Admin approval mode” = Enabled
    2. Reboot

    After that, webdriver succeeds to start Edge.

    Unfortunately, the same error happens again if I execute my script twice (without closing Edge window), but that looks like another story :)
    If I close Edge window and start script after, webdirver opens Edge successfully.

  • OS Name Microsoft Windows 10 Pro
    Version 10.0.17134 Build 17134
    Other OS Description Not Available
    OS Manufacturer Microsoft Corporation
    System Name PSTOIKO
    System Manufacturer Dell Inc.
    System Model XPS 8700
    System Type x64-based PC
    System SKU 0x05B7
    Processor Intel® Core™ i7-4790 CPU @ 3.60GHz, 3601 Mhz, 4 Core(s), 8 Logical Processor(s)
    BIOS Version/Date Dell Inc. A13, 13-Jun-18
    SMBIOS Version 2.7
    Embedded Controller Version 255.255
    BIOS Mode UEFI
    BaseBoard Manufacturer Dell Inc.
    BaseBoard Model Not Available
    BaseBoard Name Base Board
    Platform Role Desktop
    Secure Boot State On
    PCR7 Configuration Binding Not Possible
    Windows Directory C:\WINDOWS
    System Directory C:\WINDOWS\system32
    Boot Device \Device\HarddiskVolume3
    Locale United States
    Hardware Abstraction Layer Version = “10.0.17134.471”
    User Name pstoiko\Pierre
    Time Zone Eastern Standard Time
    Installed Physical Memory (RAM) 32.0 GB
    Total Physical Memory 32.0 GB
    Available Physical Memory 14.8 GB
    Total Virtual Memory 51.0 GB
    Available Virtual Memory 23.5 GB
    Page File Space 19.0 GB
    Page File C:\pagefile.sys
    Kernel DMA Protection Off
    Virtualization-based security Running
    Virtualization-based security Required Security Properties
    Virtualization-based security Available Security Properties Base Virtualization Support, Secure Boot, DMA Protection
    Virtualization-based security Services Configured
    Virtualization-based security Services Running
    Device Encryption Support Reasons for failed automatic device encryption: TPM is not usable, PCR7 binding is not supported, Hardware Security Test Interface failed and device is not InstantGo, Un-allowed DMA capable bus/device(s) detected, Disabled by policy, TPM is not usable
    A hypervisor has been detected. Features required for Hyper-V will not be displayed.

    Microsoft WebDriver
    Release 17134
    Version: 6.17134 | Edge version supported: 17.17134

    Microsoft Edge 42.17134.1.0
    Microsoft EdgeHTML 17.17134

    I run the test from:
    PyCharm 2018.2.4 (Community Edition)
    Build #PC-182.4505.26, built on September 19, 2018
    JRE: 1.8.0_152-release-1248-b8 amd64
    JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
    Windows 10 10.0

    Selenium: 3.141.0

    Test that fails:
    import pytest
    from selenium import webdriver
    from selenium.webdriver.support.wait import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC

    @pytest.fixture
    def driver(request):
    wd = webdriver.Edge()
    request.addfinalizer(wd.quit)
    return wd

    def test_example(driver):
    driver.get(“http://google.com/”)
    driver.find_element_by_name(“q”).send_keys(‘webdriver’)
    driver.implicitly_wait(30)
    driver.find_element_by_name(“btnK”).click()
    WebDriverWait(driver, 10).until(EC.title_is(‘webdriver - Google Search’))

    Error that is displayed:
    Testing started at 11:27 …
    D:\Selenium_Webdriver_Training\env\Scripts\python.exe “C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pycharm_jb_pytest_runner.py” --target test_examle.py::test_example
    Launching pytest with arguments test_examle.py::test_example in D:\Selenium_Webdriver_Training

    ============================= test session starts =============================
    platform win32 – Python 3.7.1, pytest-4.2.0, py-1.7.0, pluggy-0.8.1
    rootdir: D:\Selenium_Webdriver_Training, inifile:collected 1 item

    test_examle.py F
    test_examle.py:13 (test_example)
    driver =

    def test_example(driver):
        driver.get("http://google.com/")
        driver.find_element_by_name("q").send_keys('webdriver')
        driver.implicitly_wait(30)
    
      driver.find_element_by_name("btnK").click()
    

    test_examle.py:18:


    env\lib\site-packages\selenium\webdriver\remote\webelement.py:80: in click
    self._execute(Command.CLICK_ELEMENT)
    env\lib\site-packages\selenium\webdriver\remote\webelement.py:633: in _execute
    return self._parent.execute(command, params)
    env\lib\site-packages\selenium\webdriver\remote\webdriver.py:321: in execute
    self.error_handler.check_response(response)


    self =
    response = {’sessionId’: '6E994F51-B91E-4F2A-A592-1A14021EC8A6’, 'status’: 13, 'value’: {’message’: 'Unknown error’}}

    def check_response(self, response):
        """
        Checks that a JSON response from the WebDriver does not have an error.
    
        :Args:
         - response - The JSON response from the WebDriver server as a dictionary
           object.
    
        :Raises: If the response contains an error message.
        """
        status = response.get('status', None)
        if status is None or status == ErrorCode.SUCCESS:
            return
        value = None
        message = response.get("message", "")
        screen = response.get("screen", "")
        stacktrace = None
        if isinstance(status, int):
            value_json = response.get('value', None)
            if value_json and isinstance(value_json, basestring):
                import json
                try:
                    value = json.loads(value_json)
                    if len(value.keys()) == 1:
                        value = value['value']
                    status = value.get('error', None)
                    if status is None:
                        status = value["status"]
                        message = value["value"]
                        if not isinstance(message, basestring):
                            value = message
                            message = message.get('message')
                    else:
                        message = value.get('message', None)
                except ValueError:
                    pass
    
        exception_class = ErrorInResponseException
        if status in ErrorCode.NO_SUCH_ELEMENT:
            exception_class = NoSuchElementException
        elif status in ErrorCode.NO_SUCH_FRAME:
            exception_class = NoSuchFrameException
        elif status in ErrorCode.NO_SUCH_WINDOW:
            exception_class = NoSuchWindowException
        elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
            exception_class = StaleElementReferenceException
        elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
            exception_class = ElementNotVisibleException
        elif status in ErrorCode.INVALID_ELEMENT_STATE:
            exception_class = InvalidElementStateException
        elif status in ErrorCode.INVALID_SELECTOR \
                or status in ErrorCode.INVALID_XPATH_SELECTOR \
                or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
            exception_class = InvalidSelectorException
        elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
            exception_class = ElementNotSelectableException
        elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
            exception_class = ElementNotInteractableException
        elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
            exception_class = InvalidCookieDomainException
        elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
            exception_class = UnableToSetCookieException
        elif status in ErrorCode.TIMEOUT:
            exception_class = TimeoutException
        elif status in ErrorCode.SCRIPT_TIMEOUT:
            exception_class = TimeoutException
        elif status in ErrorCode.UNKNOWN_ERROR:
            exception_class = WebDriverException
        elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
            exception_class = UnexpectedAlertPresentException
        elif status in ErrorCode.NO_ALERT_OPEN:
            exception_class = NoAlertPresentException
        elif status in ErrorCode.IME_NOT_AVAILABLE:
            exception_class = ImeNotAvailableException
        elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
            exception_class = ImeActivationFailedException
        elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
            exception_class = MoveTargetOutOfBoundsException
        elif status in ErrorCode.JAVASCRIPT_ERROR:
            exception_class = JavascriptException
        elif status in ErrorCode.SESSION_NOT_CREATED:
            exception_class = SessionNotCreatedException
        elif status in ErrorCode.INVALID_ARGUMENT:
            exception_class = InvalidArgumentException
        elif status in ErrorCode.NO_SUCH_COOKIE:
            exception_class = NoSuchCookieException
        elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
            exception_class = ScreenshotException
        elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
            exception_class = ElementClickInterceptedException
        elif status in ErrorCode.INSECURE_CERTIFICATE:
            exception_class = InsecureCertificateException
        elif status in ErrorCode.INVALID_COORDINATES:
            exception_class = InvalidCoordinatesException
        elif status in ErrorCode.INVALID_SESSION_ID:
            exception_class = InvalidSessionIdException
        elif status in ErrorCode.UNKNOWN_METHOD:
            exception_class = UnknownMethodException
        else:
            exception_class = WebDriverException
        if value == '' or value is None:
            value = response['value']
        if isinstance(value, basestring):
            if exception_class == ErrorInResponseException:
                raise exception_class(response, value)
            raise exception_class(value)
        if message == "" and 'message' in value:
            message = value['message']
    
        screen = None
        if 'screen' in value:
            screen = value['screen']
    
        stacktrace = None
        if 'stackTrace' in value and value['stackTrace']:
            stacktrace = []
            try:
                for frame in value['stackTrace']:
                    line = self._value_or_default(frame, 'lineNumber', '')
                    file = self._value_or_default(frame, 'fileName', '')
                    if line:
                        file = "%s:%s" % (file, line)
                    meth = self._value_or_default(frame, 'methodName', '')
                    if 'className' in frame:
                        meth = "%s.%s" % (frame['className'], meth)
                    msg = "    at %s (%s)"
                    msg = msg % (meth, file)
                    stacktrace.append(msg)
            except TypeError:
                pass
        if exception_class == ErrorInResponseException:
            raise exception_class(response, message)
        elif exception_class == UnexpectedAlertPresentException:
            alert_text = None
            if 'data' in value:
                alert_text = value['data'].get('text')
            elif 'alert' in value:
                alert_text = value['alert'].get('text')
            raise exception_class(message, screen, stacktrace, alert_text)
    
      raise exception_class(message, screen, stacktrace)
    

    E selenium.common.exceptions.WebDriverException: Message: Unknown error

    env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: WebDriverException
    [100%]

    ================================== FAILURES ===================================
    ________________________________ test_example _________________________________

    driver =

    def test_example(driver):
        driver.get("http://google.com/")
        driver.find_element_by_name("q").send_keys('webdriver')
        driver.implicitly_wait(30)
    
      driver.find_element_by_name("btnK").click()
    

    test_examle.py:18:


    env\lib\site-packages\selenium\webdriver\remote\webelement.py:80: in click
    self._execute(Command.CLICK_ELEMENT)
    env\lib\site-packages\selenium\webdriver\remote\webelement.py:633: in _execute
    return self._parent.execute(command, params)
    env\lib\site-packages\selenium\webdriver\remote\webdriver.py:321: in execute
    self.error_handler.check_response(response)


    self =
    response = {’sessionId’: '6E994F51-B91E-4F2A-A592-1A14021EC8A6’, 'status’: 13, 'value’: {’message’: 'Unknown error’}}

    def check_response(self, response):
        """
        Checks that a JSON response from the WebDriver does not have an error.
    
        :Args:
         - response - The JSON response from the WebDriver server as a dictionary
           object.
    
        :Raises: If the response contains an error message.
        """
        status = response.get('status', None)
        if status is None or status == ErrorCode.SUCCESS:
            return
        value = None
        message = response.get("message", "")
        screen = response.get("screen", "")
        stacktrace = None
        if isinstance(status, int):
            value_json = response.get('value', None)
            if value_json and isinstance(value_json, basestring):
                import json
                try:
                    value = json.loads(value_json)
                    if len(value.keys()) == 1:
                        value = value['value']
                    status = value.get('error', None)
                    if status is None:
                        status = value["status"]
                        message = value["value"]
                        if not isinstance(message, basestring):
                            value = message
                            message = message.get('message')
                    else:
                        message = value.get('message', None)
                except ValueError:
                    pass
    
        exception_class = ErrorInResponseException
        if status in ErrorCode.NO_SUCH_ELEMENT:
            exception_class = NoSuchElementException
        elif status in ErrorCode.NO_SUCH_FRAME:
            exception_class = NoSuchFrameException
        elif status in ErrorCode.NO_SUCH_WINDOW:
            exception_class = NoSuchWindowException
        elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
            exception_class = StaleElementReferenceException
        elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
            exception_class = ElementNotVisibleException
        elif status in ErrorCode.INVALID_ELEMENT_STATE:
            exception_class = InvalidElementStateException
        elif status in ErrorCode.INVALID_SELECTOR \
                or status in ErrorCode.INVALID_XPATH_SELECTOR \
                or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
            exception_class = InvalidSelectorException
        elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
            exception_class = ElementNotSelectableException
        elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
            exception_class = ElementNotInteractableException
        elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
            exception_class = InvalidCookieDomainException
        elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
            exception_class = UnableToSetCookieException
        elif status in ErrorCode.TIMEOUT:
            exception_class = TimeoutException
        elif status in ErrorCode.SCRIPT_TIMEOUT:
            exception_class = TimeoutException
        elif status in ErrorCode.UNKNOWN_ERROR:
            exception_class = WebDriverException
        elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
            exception_class = UnexpectedAlertPresentException
        elif status in ErrorCode.NO_ALERT_OPEN:
            exception_class = NoAlertPresentException
        elif status in ErrorCode.IME_NOT_AVAILABLE:
            exception_class = ImeNotAvailableException
        elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
            exception_class = ImeActivationFailedException
        elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
            exception_class = MoveTargetOutOfBoundsException
        elif status in ErrorCode.JAVASCRIPT_ERROR:
            exception_class = JavascriptException
        elif status in ErrorCode.SESSION_NOT_CREATED:
            exception_class = SessionNotCreatedException
        elif status in ErrorCode.INVALID_ARGUMENT:
            exception_class = InvalidArgumentException
        elif status in ErrorCode.NO_SUCH_COOKIE:
            exception_class = NoSuchCookieException
        elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
            exception_class = ScreenshotException
        elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
            exception_class = ElementClickInterceptedException
        elif status in ErrorCode.INSECURE_CERTIFICATE:
            exception_class = InsecureCertificateException
        elif status in ErrorCode.INVALID_COORDINATES:
            exception_class = InvalidCoordinatesException
        elif status in ErrorCode.INVALID_SESSION_ID:
            exception_class = InvalidSessionIdException
        elif status in ErrorCode.UNKNOWN_METHOD:
            exception_class = UnknownMethodException
        else:
            exception_class = WebDriverException
        if value == '' or value is None:
            value = response['value']
        if isinstance(value, basestring):
            if exception_class == ErrorInResponseException:
                raise exception_class(response, value)
            raise exception_class(value)
        if message == "" and 'message' in value:
            message = value['message']
    
        screen = None
        if 'screen' in value:
            screen = value['screen']
    
        stacktrace = None
        if 'stackTrace' in value and value['stackTrace']:
            stacktrace = []
            try:
                for frame in value['stackTrace']:
                    line = self._value_or_default(frame, 'lineNumber', '')
                    file = self._value_or_default(frame, 'fileName', '')
                    if line:
                        file = "%s:%s" % (file, line)
                    meth = self._value_or_default(frame, 'methodName', '')
                    if 'className' in frame:
                        meth = "%s.%s" % (frame['className'], meth)
                    msg = "    at %s (%s)"
                    msg = msg % (meth, file)
                    stacktrace.append(msg)
            except TypeError:
                pass
        if exception_class == ErrorInResponseException:
            raise exception_class(response, message)
        elif exception_class == UnexpectedAlertPresentException:
            alert_text = None
            if 'data' in value:
                alert_text = value['data'].get('text')
            elif 'alert' in value:
                alert_text = value['alert'].get('text')
            raise exception_class(message, screen, stacktrace, alert_text)
    
      raise exception_class(message, screen, stacktrace)
    

    E selenium.common.exceptions.WebDriverException: Message: Unknown error

    env\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: WebDriverException
    ========================== 1 failed in 4.70 seconds ===========================
    Process finished with exit code 0

    Note:
    I have downloaded webrdriver and put it in two directories:
    C:\Windows\SysWOW64
    C:\Windows\System32
    Run the test and it worked.
    Then I decided to find out which of the directories is used and removed file from SysWOW64. Test failed.
    I have put back the file to SysWOW64 but test still fails.

You need to sign in to your Microsoft account to add a comment.

Sign in