Skip to content

Instantly share code, notes, and snippets.

@kinuasa
Last active April 9, 2024 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kinuasa/d3871ba4161324bd7e3a27927ab5fb82 to your computer and use it in GitHub Desktop.
Save kinuasa/d3871ba4161324bd7e3a27927ab5fb82 to your computer and use it in GitHub Desktop.
SET WindowsApplicationDriverPath TO $'''\"C:\\Program Files (x86)\\Windows Application Driver\\WinAppDriver.exe\"'''
SET AppId TO $'''mspaint.exe'''
SET WindowsApplicationDriverUrl TO $'''http://127.0.0.1:4723'''
SET ImageFilePath TO $'''\"C:\\Test\\Image\\TEST.png\"'''
System.RunApplication.RunApplication ApplicationPath: $'''cmd''' CommandLineArguments: $'''/k %WindowsApplicationDriverPath%''' WorkingDirectory: $'''C:\\''' WindowStyle: System.ProcessWindowStyle.Normal ProcessId=> AppProcessId
Web.InvokeWebService.InvokeWebService Url: $'''%WindowsApplicationDriverUrl%/session''' Method: Web.Method.Post Accept: $'''application/json''' ContentType: $'''application/json''' RequestBody: $'''{\"desiredCapabilities\":{\"app\":\"%AppId%\",\"deviceName\":\"WindowsPC\",\"platformName\":\"Windows\"}}''' ConnectionTimeout: 30 FollowRedirection: True ClearCookies: False FailOnErrorStatus: False EncodeRequestBody: False UserAgent: $'''Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6''' Encoding: Web.Encoding.AutoDetect AcceptUntrustedCertificates: False ResponseHeaders=> WebServiceResponseHeaders Response=> WebServiceResponse StatusCode=> StatusCode
Variables.ConvertJsonToCustomObject Json: WebServiceResponse CustomObject=> JsonAsCustomObject
Web.InvokeWebService.InvokeWebService Url: $'''%WindowsApplicationDriverUrl%/session/%JsonAsCustomObject['sessionId']%/element''' Method: Web.Method.Post Accept: $'''application/json''' ContentType: $'''application/json''' RequestBody: $'''{\"using\":\"xpath\",\"value\":\"/Window[@ClassName=\\\"MSPaintApp\\\"]/Pane[@ClassName=\\\"Windows.UI.Input.InputSite.WindowClass\\\"]/MenuBar/MenuItem[@AccessKey=\\\"Alt, F\\\"]\"}''' ConnectionTimeout: 30 FollowRedirection: True ClearCookies: False FailOnErrorStatus: False EncodeRequestBody: False UserAgent: $'''Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6''' Encoding: Web.Encoding.AutoDetect AcceptUntrustedCertificates: False ResponseHeaders=> WebServiceResponseHeaders Response=> WebServiceResponse StatusCode=> StatusCode
Variables.ConvertJsonToCustomObject Json: WebServiceResponse CustomObject=> JsonAsCustomObject
Web.InvokeWebService.InvokeWebService Url: $'''%WindowsApplicationDriverUrl%/session/%JsonAsCustomObject['sessionId']%/element/%JsonAsCustomObject['value']['ELEMENT']%/click''' Method: Web.Method.Post Accept: $'''application/json''' ContentType: $'''application/json''' RequestBody: $'''{}''' ConnectionTimeout: 30 FollowRedirection: True ClearCookies: False FailOnErrorStatus: False EncodeRequestBody: False UserAgent: $'''Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6''' Encoding: Web.Encoding.AutoDetect AcceptUntrustedCertificates: False ResponseHeaders=> WebServiceResponseHeaders Response=> WebServiceResponse StatusCode=> StatusCode
Web.InvokeWebService.InvokeWebService Url: $'''%WindowsApplicationDriverUrl%/session/%JsonAsCustomObject['sessionId']%/element''' Method: Web.Method.Post Accept: $'''application/json''' ContentType: $'''application/json''' RequestBody: $'''{\"using\":\"xpath\",\"value\":\"/Window[@ClassName=\\\"MSPaintApp\\\"]/Pane[@Name=\\\"PopupHost\\\"]/Window[@ClassName=\\\"Popup\\\"]/Menu[@ClassName=\\\"MenuFlyout\\\"]/MenuItem[@AutomationId=\\\"FileOpen\\\"]\"}''' ConnectionTimeout: 30 FollowRedirection: True ClearCookies: False FailOnErrorStatus: False EncodeRequestBody: False UserAgent: $'''Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6''' Encoding: Web.Encoding.AutoDetect AcceptUntrustedCertificates: False ResponseHeaders=> WebServiceResponseHeaders Response=> WebServiceResponse StatusCode=> StatusCode
Variables.ConvertJsonToCustomObject Json: WebServiceResponse CustomObject=> JsonAsCustomObject
Web.InvokeWebService.InvokeWebService Url: $'''%WindowsApplicationDriverUrl%/session/%JsonAsCustomObject['sessionId']%/element/%JsonAsCustomObject['value']['ELEMENT']%/click''' Method: Web.Method.Post Accept: $'''application/json''' ContentType: $'''application/json''' RequestBody: $'''{}''' ConnectionTimeout: 30 FollowRedirection: True ClearCookies: False FailOnErrorStatus: False EncodeRequestBody: False UserAgent: $'''Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6''' Encoding: Web.Encoding.AutoDetect AcceptUntrustedCertificates: False ResponseHeaders=> WebServiceResponseHeaders Response=> WebServiceResponse StatusCode=> StatusCode
Web.InvokeWebService.InvokeWebService Url: $'''%WindowsApplicationDriverUrl%/session/%JsonAsCustomObject['sessionId']%/element''' Method: Web.Method.Post Accept: $'''application/json''' ContentType: $'''application/json''' RequestBody: $'''{\"using\":\"xpath\",\"value\":\"/Window[@ClassName=\\\"MSPaintApp\\\"]/Window[@ClassName=\\\"#32770\\\"]/ComboBox[@ClassName=\\\"ComboBox\\\"]/Edit[@ClassName=\\\"Edit\\\"]\"}''' ConnectionTimeout: 30 FollowRedirection: True ClearCookies: False FailOnErrorStatus: False EncodeRequestBody: False UserAgent: $'''Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6''' Encoding: Web.Encoding.AutoDetect AcceptUntrustedCertificates: False ResponseHeaders=> WebServiceResponseHeaders Response=> WebServiceResponse StatusCode=> StatusCode
Variables.ConvertJsonToCustomObject Json: WebServiceResponse CustomObject=> JsonAsCustomObject
Clipboard.SetText Text: ImageFilePath
Web.InvokeWebService.InvokeWebService Url: $'''%WindowsApplicationDriverUrl%/session/%JsonAsCustomObject['sessionId']%/element/%JsonAsCustomObject['value']['ELEMENT']%/value''' Method: Web.Method.Post Accept: $'''application/json''' ContentType: $'''application/json''' RequestBody: $'''{\"value\":[\"\\uE009v\\uE009\"]}''' ConnectionTimeout: 30 FollowRedirection: True ClearCookies: False FailOnErrorStatus: False EncodeRequestBody: False UserAgent: $'''Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6''' Encoding: Web.Encoding.AutoDetect AcceptUntrustedCertificates: False ResponseHeaders=> WebServiceResponseHeaders Response=> WebServiceResponse StatusCode=> StatusCode
Web.InvokeWebService.InvokeWebService Url: $'''%WindowsApplicationDriverUrl%/session/%JsonAsCustomObject['sessionId']%/element''' Method: Web.Method.Post Accept: $'''application/json''' ContentType: $'''application/json''' RequestBody: $'''{\"using\":\"xpath\",\"value\":\"/Window[@ClassName=\\\"MSPaintApp\\\"]/Window[@ClassName=\\\"#32770\\\"]/Button[@AccessKey=\\\"Alt+o\\\"]\"}''' ConnectionTimeout: 30 FollowRedirection: True ClearCookies: False FailOnErrorStatus: False EncodeRequestBody: False UserAgent: $'''Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6''' Encoding: Web.Encoding.AutoDetect AcceptUntrustedCertificates: False ResponseHeaders=> WebServiceResponseHeaders Response=> WebServiceResponse StatusCode=> StatusCode
Variables.ConvertJsonToCustomObject Json: WebServiceResponse CustomObject=> JsonAsCustomObject
Web.InvokeWebService.InvokeWebService Url: $'''%WindowsApplicationDriverUrl%/session/%JsonAsCustomObject['sessionId']%/element/%JsonAsCustomObject['value']['ELEMENT']%/click''' Method: Web.Method.Post Accept: $'''application/json''' ContentType: $'''application/json''' RequestBody: $'''{}''' ConnectionTimeout: 30 FollowRedirection: True ClearCookies: False FailOnErrorStatus: False EncodeRequestBody: False UserAgent: $'''Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6''' Encoding: Web.Encoding.AutoDetect AcceptUntrustedCertificates: False ResponseHeaders=> WebServiceResponseHeaders Response=> WebServiceResponse StatusCode=> StatusCode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment