Run WebDriver in noninteractive session (Service/Task Scadualer/PSSession)

By design Issue #7290550

Details

Author
illy M.
Created
Apr 21, 2016
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
10
Reports
Reported by 3 people

Sign in to watch or report this issue.

Steps to reproduce

Hi
If I try to run MicrosoftWebDriver.exe in the following ways:

  1. As a windows Service.
  2. From “Task Scheduler” with the option “Run whether user is logged on or not”
  3. From Powershell remotely (With “Enter-PSSession” or “Invoke-Command -ComputerName $Server”)
    The driver executable is started but is unable to open an edge session:
PS > $Obj = [PsCustomObject]@{desiredCapabilities = [PsCustomObject]@{}; requiredCapabilities = [PsCustomObject]@{}} | ConvertTo-Json
PS > Invoke-RestMethod -Uri "http://localhost:17556/session" -Method Post -Body $Obj
sessionId status value
--------- ------ -----
              13 @{message=Unknown error}

Is this a bug?
Is this a feature that you will add in the future?
Or is it by design?
Thank you

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Ibrahim O.”

    • Thank you for your feedback. Could you please let us know your OS build and Webdriver version (insider or public build) that causing this issue.

      Best regards,
      The MS Edge Team 

    • Hi
      Tested on Driver 10.0.14316.1000 and OS 14328
      Also on older versions.

      This is with Powershell remote:

      $ScriptBlock = {
          'Driver Version:'
          (Get-ItemProperty -Path 'C:\Program Files (x86)\Microsoft Web Driver\MicrosoftWebDriver.exe').VersionInfo.ProductVersion
          'OS Version:'
          [environment]::OSVersion.Version
          
          Start-Process -FilePath 'C:\Program Files (x86)\Microsoft Web Driver\MicrosoftWebDriver.exe'
          Start-Sleep 3
          'Output:'
          $Obj = [PsCustomObject]@{desiredCapabilities = [PsCustomObject]@{}; requiredCapabilities = [PsCustomObject]@{}} | ConvertTo-Json
          Invoke-RestMethod -Uri "http://localhost:17556/session" -Method Post -Body $Obj
      }
      Invoke-Command -ScriptBlock $ScriptBlock -ComputerName 'Win10'
      

      Output

      Driver Version:
      10.0.14316.1000
      OS Version:
      
      Major  Minor  Build  Revision PSComputerName                                                                                                                       
      -----  -----  -----  -------- --------------                                                                                                                       
      10     0      14328  0        Win10                                                                                                                                
      Output:
      Unknown error
          + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
          + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
          + PSComputerName        : Win10
      

      And this is locally in the interactive RDP session where it works

      $ScriptBlock = {
          'Driver Version:'
          (Get-ItemProperty -Path 'C:\Program Files (x86)\Microsoft Web Driver\MicrosoftWebDriver.exe').VersionInfo.ProductVersion
          'OS Version:'
          [environment]::OSVersion.Version
          
          Start-Process -FilePath 'C:\Program Files (x86)\Microsoft Web Driver\MicrosoftWebDriver.exe'
          Start-Sleep 3
          'Output:'
          $Obj = [PsCustomObject]@{desiredCapabilities = [PsCustomObject]@{}; requiredCapabilities = [PsCustomObject]@{}} | ConvertTo-Json
          Invoke-RestMethod -Uri "http://localhost:17556/session" -Method Post -Body $Obj
      }
      Invoke-Command -ScriptBlock $ScriptBlock
      

      Output

      Driver Version:
      10.0.14316.1000
      OS Version:
      
      Major  Minor  Build  Revision
      -----  -----  -----  --------
      10     0      14328  0       
      Output:
      
      sessionId : 3934F8BC-A3B9-4B8E-91BB-98B57AB9B2F2
      status    : 0
      value     : @{browserName=MicrosoftEdge; browserVersion=37.14328.1000.0; platformName=windows; platformVersion=10; takesElementScreenshot=True; 
                  takesScreenshot=True; acceptSslCerts=True; applicationCacheEnabled=True; locationContextEnabled=True; webStorageEnabled=True; pageLoadStrategy=normal}
      
    • Microsoft Edge Team

      Changed Title from “Run WebDriver in noninteractive session (Service/Task Scadualer/PSSession)” to “Run WebDriver in noninteractive session (Service/Task Scadualer/PSSession)”

    • Thank you for the update. I have not tested on 14328 specifically, but I couldn’t reproduce this issue on 14372 with both local and remote sessions. This issue may have been specific to that build that you got repro. Could you please confirm this issue whether is still repro or not in latest insider preview with the insider webdriver (https://www.microsoft.com/en-us/download/details.aspx?id=48740)

      All the best,
      The MS Edge Team

    • Microsoft Edge Team

      Changed Status to “Not reproducible”

    • As we have not received further information on how to repro
      this item of feedback - we will resolve it as not repro. Should you have the
      details needed in order for us to reproduce this problem in our test
      environments please feel free to reactivate this issue at your earliest
      convenience.

      All the best,

      The MS Edge Team

    • this is happening for me on 14393 when trying to use the MicrosoftWebDriver.exe as part of a Selenium Grid node where the node is started as a service under the Windows System account. When run not as a service, but as a logged in user the WebDriver is able to launch the browser successfully, but when run as a service it cannot start the MicrosoftWebDriver.exe which then causes a 500 error in the selenium node’s response to the hub with “Unknown error” listed as the reason (changing the user account that the service is running within doesn’t fix this issue):

      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 >> "POST /session HTTP/1.1[\r][\n]"
      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 >> "Content-Type: application/json; charset=utf-8[\r][\n]"
      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 >> "Content-Length: 135[\r][\n]"
      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 >> "Host: localhost:12990[\r][\n]"
      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]"
      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 >> "User-Agent: Apache-HttpClient/4.5.1 (Java/1.8.0_102)[\r][\n]"
      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 >> "Accept-Encoding: gzip,deflate[\r][\n]"
      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 >> "[\r][\n]"
      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 >> "{"desiredCapabilities":{"browserName":"MicrosoftEdge","nativeEvents":false,"javascriptEnabled":true,"version":"","platform":"WINDOWS"}}"
      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 << "HTTP/1.1 500 Internal Server Error[\r][\n]"
      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 << "Content-Type: text/plain[\r][\n]"
      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 << "Server: Microsoft-HTTPAPI/2.0[\r][\n]"
      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 << "Date: Thu, 13 Oct 2016 11:11:15 GMT[\r][\n]"
      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 << "Content-Length: 13[\r][\n]"
      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 << "[\r][\n]"
      12:11:15.280 DEBUG [24] org.apache.http.wire - http-outgoing-1 << "Unknown error"
      12:11:15.280 DEBUG [24] org.apache.http.headers - http-outgoing-1 << HTTP/1.1 500 Internal Server Error
      12:11:15.280 DEBUG [24] org.apache.http.headers - http-outgoing-1 << Content-Type: text/plain
      12:11:15.280 DEBUG [24] org.apache.http.headers - http-outgoing-1 << Server: Microsoft-HTTPAPI/2.0
      12:11:15.280 DEBUG [24] org.apache.http.headers - http-outgoing-1 << Date: Thu, 13 Oct 2016 11:11:15 GMT
      12:11:15.280 DEBUG [24] org.apache.http.headers - http-outgoing-1 << Content-Length: 13
      

      my firewall is off and I’ve read through many of the other similar errors, but this one exactly matches the situation I’m seeing where it seems that the MicrosoftWebDriver.exe cannot startup when run as a service as part of a Selenium Grid

    • Microsoft Edge Team

      Changed Status from “Not reproducible”

      Changed Assigned To to “Mara P.”

      Changed Assigned To from “Mara P.” to “Clay M.”

      Changed Status to “Confirmed”

      Changed Status from “Confirmed” to “By design”

    • Hey illy,
      Edge and WebDriver require a user session to function. This is a requirement for UWP Apps. we currently do not have plans to invest in making this work outside of this regard as it would be a very unsupported method of running WebDriver with Edge.
      Thanks,
      Clay

    • Hi Clay,

      Thanks for the response, but possibly there is a misunderstanding. How would one be expected to run using Edge browser as part of a Selenium Grid configuration if this isn’t supported? The Grid Node would expect to run Selenium from within a Service so the machine need not have an open user session (which would break the ability to run as part of a automated build, deploy, test pipeline) and this is supported by other browsers such as IE 11, Chrome and Firefox. Is there a recommended workaround?

    • Hey illy,

      Running Selenium Grid as a system service isn’t supported. It requires a logged in user session. Microsoft Edge on top of that also requires an active user session to function as well as WebDriver. Trying to get either to run as a system service is currently not something we want to support.

      Thanks,
      Clay

    • Hi Clay,

      Again, I think there must be some kind of disconnect as I currently run all Selenium Grid instances as a service. This is the expected manner in which they would be run as part of an automated build and test pipeline. For Firefox, Chrome, and IE11 this works just fine, but for Edge it does not due to the requirement that Edge has in being run under a user session.

      This problem isn’t just in Selenium Grids either. If running Jenkins as a service and not using a Selenium Grid, Chrome, Firefox and IE11 will all launch successfully using a direct instantiation of their WebDrivers, but for Edge it would not. This, to me, is broken. Possibly when you say that running Selenium Grid as a system service isn’t supported you mean something other than what I understand, but as I understand your statement, it is wrong. Selenium Grid is easily run as a system service and works as expected when run as such; with the exception of running Edge.

      Hopefully you can help with this issue. Thanks in advance…

      also, this isn’t Illy (the original poster) as they seem to have disappeared.

    • just as an additional note, if you search for run Selenium Grid as a Windows Service you’ll find loads of results instructing you how to do it. This is a standard process with a proven record of working.

    • Didn’t disappear (: Just switched to Firefox and Chrome
      Thank you for keeping this thread open, If it will be fixed I will give Edge another try…
      illy

    • Hi. I have same problem with Edge driver with version 14393 on Windows 10. I my tests using TFS build server and i have build agent on my machine. I think that if I run build agent in interactive mode Edge driver will work fine. What do you think about it?

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

    Sign in