appium / appium-windows-driver

Appium's interface to WindowsAppDriver provided by Microsoft
Apache License 2.0
133 stars 35 forks source link

Exception thrown when trying to run powerShell "script" command specifically #102

Closed testifyqa closed 3 years ago

testifyqa commented 3 years ago

Language Used: C#

Appium Version: 1.21.0-beta.0

Works driver.ExecuteScript("powerShell", new Dictionary<string, string> {{"command", "echo Hello"}});

Does NOT Work driver.ExecuteScript("powerShell", new Dictionary<string, string> {{"script", "echo Hello\r\n echo World"}});

Error

OpenQA.Selenium.WebDriverException
  HResult=0x80131500
  Message=An unknown server-side error occurred while processing the command. Original error: Command 'powershell.exe -command 'Set-ExecutionPolicy -Execution-Policy Undefined -Scope CurrentUser'' exited with code 1
  Source=WebDriver
ggaller commented 3 years ago

This PR will fix it.