MicrosoftEdge / EdgeWebDriver

Feedback and discussions about WebDriver for Microsoft Edge
MIT License
58 stars 7 forks source link

Trouble launching Edge when running Edgedriver in Administrator mode #80

Closed Danp2 closed 1 year ago

Danp2 commented 1 year ago

Edge fails to launch successfully when executed with elevated access (run as administrator). This is the webdriver console output --

Starting Microsoft Edge WebDriver 112.0.1722.39 (e40a520f851f31c19c0c93c4278f5b408ec37d7c) on port 9515
To submit feedback, report a bug, or suggest new features, please visit https://github.com/MicrosoftEdge/EdgeWebDriver

Only local connections are allowed.
Please see https://aka.ms/WebDriverSecurity for suggestions on keeping Microsoft Edge WebDriver safe.

Microsoft Edge WebDriver was started successfully.
[1681413801.874][INFO]: [7f6f642662b19524301da07006a00242] COMMAND InitSession {
   "capabilities": {
      "alwaysMatch": {
         "ms:edgeOptions": {
            "excludeSwitches": [ "enable-automation" ]
         }
      }
   }
}
[1681413801.887][INFO]: Populating Preferences file: {
   "alternate_error_pages": {
      "enabled": false
   },
   "autofill": {
      "enabled": false
   },
   "browser": {
      "check_default_browser": false
   },
   "distribution": {
      "import_bookmarks": false,
      "import_history": false,
      "import_search_engine": false,
      "make_chrome_default_for_user": false,
      "skip_first_run_ui": true
   },
   "dns_prefetching": {
      "enabled": false
   },
   "profile": {
      "content_settings": {
         "pattern_pairs": {
            "https://*,*": {
               "media-stream": {
                  "audio": "Default",
                  "video": "Default"
               }
            }
         }
      },
      "default_content_setting_values": {
         "geolocation": 1
      },
      "default_content_settings": {
         "geolocation": 1,
         "mouselock": 1,
         "notifications": 1,
         "popups": 1,
         "ppapi-broker": 1
      },
      "password_manager_enabled": false
   },
   "safebrowsing": {
      "enabled": false
   },
   "search": {
      "suggest_enabled": false
   },
   "translate": {
      "enabled": false
   }
}
[1681413801.908][INFO]: Populating Local State file: {
   "background_mode": {
      "enabled": false
   },
   "ssl": {
      "rev_checking": {
         "enabled": false
      }
   }
}
[1681413801.922][INFO]: Launching Microsoft Edge: "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --allow-pre-commit-input --disable-background-networking --disable-backgrounding-occluded-windows --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --enable-blink-features=ShadowDOMV0 --enable-logging --log-level=0 --no-first-run --no-service-autorun --password-store=basic --remote-debugging-port=0 --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Program Files\scoped_dir4128_1801713731" data:,
[31704:41668:0413/152322.117:ERROR:chrome_browser_cloud_management_controller.cc(162)] Cloud management controller initialization aborted as CBCM is not enabled.
[1681413802.260][INFO]: [7f6f642662b19524301da07006a00242] RESPONSE InitSession ERROR unknown error: Microsoft Edge failed to start: exited normally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from msedge location C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe is no longer running, so msedgedriver is assuming that msedge has crashed.)
[1681413802.260][DEBUG]: Log type 'driver' lost 0 entries on destruction
[1681413802.260][DEBUG]: Log type 'browser' lost 0 entries on destruction

Notice that it tries to set the user directory to "C:\Program Files\scoped_dir4128_1801713731", which I believe is the reason for the subsequent errors because Windows is going to deny write access to files under C:\Program FIles.

Performing the exact same process with non-elevate access and the user directory is created in the expected location (C:\Users\\AppData\Local\Temp).

Note that this issue only occurs with MS Edge; Chrome and Firefox don't exhibit this behavior.

Danp2 commented 1 year ago

Some additional details --

bwalderman commented 1 year ago

Hi @Danp2, Edge will not launch in administrator mode. This was an explicit decision where Edge diverges from Chrome for security reasons. The test will need to run unelevated for Edge to launch successfully.

clackwell commented 7 months ago

Hi @Danp2, Edge will not launch in administrator mode. This was an explicit decision where Edge diverges from Chrome for security reasons. The test will need to run unelevated for Edge to launch successfully.

Hi @bwalderman, can you provide a source for this? Because a customer is running into this and we'd like something more official. :) Thanks!