Windows application automation using QAF - selenium

I'm looking support for automate windows application like notepad using Qmetry automation framework with BDD steps. is there any link or solution to implement. I tried with Appium driver but didn't work.
Step1: open Notepad
Step2: enter "Some text"[enter link description here][1]
Success log:
Windows Application Driver listening for requests at: http://127.0.0.1:4723/
Press ENTER to exit.
==========================================
POST /session HTTP/1.1
Accept-Encoding: gzip,deflate
Connection: Keep-Alive
Content-Length: 258
Content-Type: application/json; charset=utf-8
Host: 127.0.0.1:4723
User-Agent: Apache-HttpClient/4.5.2 (Java/16.0.2)
{"capabilities":[{"desiredCapabilities":{"app":"C:\Windows\System32\notepad.exe","platformName":"Windows"}},{"requiredCapabilities":{}}],"desiredCapabilities":{"app":"C:\Windows\System32\notepad.exe","platformName":"Windows"},"requiredCapabilities":{}}
HTTP/1.1 200 OK
Content-Length: 141
Content-Type: application/json
==========================================
GET /session/3E4610D7-9EBB-4998-921B-94220578D3F1 HTTP/1.1
Accept-Encoding: gzip,deflate
Cache-Control: no-cache
Connection: Keep-Alive
Host: 127.0.0.1:4723
User-Agent: Apache-HttpClient/4.5.2 (Java/16.0.2)
HTTP/1.1 200 OK
Content-Length: 90
Content-Type: application/json
{"status":0,"value":{"app":"C:\Windows\System32\notepad.exe","platformName":"Windows"}}
Failure log:
Windows Application Driver listening for requests at: http://127.0.0.1:4723/
Press ENTER to exit.
==========================================
POST /wd/hub/session HTTP/1.1
Accept-Encoding: gzip
Connection: Keep-Alive
Content-Length: 641
Content-Type: application/json; charset=utf-8
Host: 127.0.0.1:4723
User-Agent: selenium/3.141.59 (java windows)
X-Idempotency-Key: 202d0858-641b-4263-88b9-4b5b1ed0ecc1

You didn't provided what you tried and what is the error you are getting.
In order to automate windows native application you need to use appium windows driver. Windows driver is appium implementation so you can use it like android or ios appium driver.
You can refer
How to run native app on appium
Driver specific documentation for set up and other driver specific requirements
Sample working configuration.
EDIT: Below sample works fine:
Properties for setting capabilities
remote.port=4723
driver.name= appiumDriver
appium.additional.capabilities={"app":"C:\\Windows\\System32\\notepad.exe","driverClass":"io.appium.java_client.windows.WindowsDriver"}
#appium.capabilities.driverClass=io.appium.java_client.windows.WindowsDriver
#appium.capabilities.app=C:\\Windows\\System32\\notepad.exe
It worked well as normal web driver test without issue:
import static com.qmetry.qaf.automation.step.CommonStep.sendKeys;
import static com.qmetry.qaf.automation.util.StringMatcher.exact;
import static com.qmetry.qaf.automation.ui.webdriver.ElementFactory.$;
...
#Test
public void testCanEditInNotpad(){
getDriver().verifyTitle(exact("Untitled - Notepad"));
getDriver().findElementByClassName("Edit").sendKeys("it worked!...")
$("className=Edit").sendKeys(" This also worked!...");
sendKeys(" Common Step worked as well!...", "className=Edit");
}

Related

Creating a user using the SonarQube API returns a 401

I'm trying to create a user using the SaonarQube API (version 6.2 or up).
I have setup a SoapUI project that contains a few test scripts. One of them is login in and creating a user. this one returns a 401 whe the user creation call is done.
The login is used for other calls as well and proves to work. Except for the create user call. The account used to login to SoarQube is member of the System Administror groups.
Below is the raw request.
POST http://localhost:9000/api/users/create HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 47
Host: localhost:9000
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Cookie: JWT-SESSION=eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJBV0ExaGFtX2hnNWdHUWtNNVRHSiIsInN1YiI6ImFkbWluIiwiaWF0IjoxNTEyNzI2NDQwLCJleHAiOjE1MTI5ODU2NDAsImxhc3RSZWZyZXNoVGltZSI6MTUxMjcyNjQ0MDM4MywieHNyZlRva2VuIjoicHRwcXRlYmtzYTR2MTlhaTk3anV0bnVlZW8ifQ.waHqOsMJ9P6FyIOUWuVODl5QcW-IJp10G6oUAvy1DWk; XSRF-TOKEN=ptpqtebksa4v19ai97jutnueeo
Cookie2: $Version=1
login=user01&name=name01&password=%21P%40ssw0rd
Below is the raw resoonse
HTTP/1.1 401 Unauthorized
Server: Apache-Coyote/1.1
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Content-Length: 0
Date: Fri, 08 Dec 2017 09:47:20 GMT
Any suggestions are welcome.
BTW: I can create the user using the same values using the UI so there is no issue with he user information, at least it seams so.
Update 1:
Added raw request with querystring parameters
POST http://localhost:9000/api/users/create?login=user01&name=name01&password=%21P%40ssw0rd HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
Host: localhost:9000
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Cookie: JWT-SESSION=eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJBV0JHZkVGY0h3bW5UZ0V5QklJNyIsInN1YiI6ImFkbWluIiwiaWF0IjoxNTEzMDExMDM2LCJleHAiOjE1MTMyNzAyMzYsImxhc3RSZWZyZXNoVGltZSI6MTUxMzAxMTAzNjQyNCwieHNyZlRva2VuIjoibmIzdmlpcjAyZmZ1ODJnMzNtdW1hYWdkN3QifQ.ur8eZkW1CwNinx4tInFsbkGLQTHQ6yFjheRfup8Z4fQ; XSRF-TOKEN=nb3viir02ffu82g33mumaagd7t
Cookie2: $Version=1
It's not possible to use the generated cookie by a web request in a console request (it could be considered as an attack).
You need either to :
Specify a user token (recommended way)
Specify a login/password

How Shockwave player generates HTTP POST request?

I am intercepting HTTP request/response from an Adobe Shockwave-based web music player application using Chrome Dev tools. When I click the Play button on music player, HTTP request headers like following are raised:
POST /some_url HTTP/1.1
Host: something.com
Connection: keep-alive
Content-Length: 103
Origin: http://something.com
X-Requested-With: ShockwaveFlash/22
User-Agent: Mozilla
Content-Type: application/x-www-form-urlencoded
Accept: */*
Referer: http://something.com/player.swf
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.8
And Form data looks like following:
param1=561a0d9452069h76fhg46h67a599e8gy34nlj=
param2=something
Now, is there any way to know from where this param1=561a0d9452069h76fhg46h67a599e8gy34nlj= form data came from and how it is generated? If it's some kind of encrypted string or a token, how this is done?
Thank you for your answers
The HTTP request would have come from a URLRequest in ActionScript, which passes the data in key/value pairs. You could have a look at using SWFWire Inspector to decompile the code.

Configuring Burp Suite to intercept data between web browser and proxy server

I need to configure Burp Suite to intercept data between web browser and proxy server. The proxy server requires a basic authentication (Username & Password) while connecting for the first time in each session. I have tried the 'Redirect to host' option in Burp Suite(Entered the proxy server address and port in the fields):
Proxy >> Options >> Proxy Listeners >> Request Handling
But I can't see an option to use the authentication that is required while connecting to this proxy server.
While accessing google.com, the request headers are:
GET / HTTP/1.1
Host: google.com
User-Agent: Mozilla/5.0 (X11; Linux i686) KHTML/4.13.3 (like Gecko) Konqueror/4.13
Accept: text/html, text/*;q=0.9, image/jpeg;q=0.9, image/png;q=0.9, image/*;q=0.9, */*;q=0.8
Accept-Encoding: gzip, deflate, x-gzip, x-deflate
Accept-Charset: utf-8,*;q=0.5
Accept-Language: en-US,en;q=0.9
Connection: close
And the response is:
HTTP/1.1 400 Bad Request
Server: squid/3.3.8
Mime-Version: 1.0
Date: Thu, 10 Mar 2016 15:14:12 GMT
Content-Type: text/html
Content-Length: 3163
X-Squid-Error: ERR_INVALID_URL 0
Vary: Accept-Language
Content-Language: en
X-Cache: MISS from proxy.abc.in
X-Cache-Lookup: NONE from proxy.abc.in:3343
Via: 1.1 proxy.abc.in (squid/3.3.8)
Connection: close
you were on the right track, just at the wrong place. You need to setup an upstream proxy at:
Options>>Connections>>Upstream proxy
There you can also setup the authentication
Options>>Connections>>Platform authentication
Here you can create different auth configurations, which will be done if the server requests it.

How to test user registration api with paw?

What do I set in Paw to allow for a login? I have tried to use the allow cookies with to no avail.
I am working through this tutorial on Github to learn the MEAN stack. Sign up seems to be working but sign in is not.
Sign up request is:
GET /auth/success HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Cookie: connect.sid=s%3A6q22s9GpNRDITB3wKBoxS1emnKCcIR3B.pI3dzqqtSBSBVgkzl7Uib4aqNAf%2Bh5iszoWDMzWPpR8
Host: localhost:3000
Connection: close
User-Agent: Paw/2.2.2 (Macintosh; OS X/10.10.3) GCDHTTPRequest
and the result is:
HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: application/json; charset=utf-8
Content-Length: 121
ETag: W/"79-56130229"
Date: Thu, 18 Jun 2015 19:52:43 GMT
Connection: close
{"state":"success","user":{"username":"admin","password":"$2a$10$AD5NBc6c6iZ09/eXuYd9oOfTEZ6MnRNYWneLy.SNPFAWf/HX1V0.6"}}
The user is created. But the login request fails every time; the request is:
GET /auth/failure HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Cookie: connect.sid=s%3A6q22s9GpNRDITB3wKBoxS1emnKCcIR3B.pI3dzqqtSBSBVgkzl7Uib4aqNAf%2Bh5iszoWDMzWPpR8
Host: localhost:3000
Connection: close
User-Agent: Paw/2.2.2 (Macintosh; OS X/10.10.3) GCDHTTPRequest
the response is:
HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: application/json; charset=utf-8
Content-Length: 72
ETag: W/"48-ed4f121"
Date: Thu, 18 Jun 2015 19:53:03 GMT
Connection: close
{"state":"failure","user":null,"message":"Invalid username or password"}
What it comes down to is: Is there something in paw that needs to be enabled to allow sign in testing or is my code more likely to be the problem? My code is almost verbatim from the module three part of that Github repo linked above. Any and all help would be appreciated.
Note: I did not post code on purpose as to not clutter the question. If you need to see something I can add it just let me know.
While I was not sure of my exact error I had with more trouble shooting i saw that you need to make sure that you have follow redirects on and cookies being saved.

Connection issues from certain devices

Can't connect from device using custom authenticator and ChallengeHandler.
This is from Worklight 6.1.0.2 from an iPod Touch device. On the worklight server, we see this in the Stack Trace.
klight.console.controllers.UsersController from Application javax.ws.rs.core.Application
[10/8/14 15:20:04:170 CDT] 0000001c com.worklight.core.auth.impl.LoginContext E FWLSE0059E: Login into realm 'NullLoginModule' failed. Invalid gadget request format: /WorkExecution/iphone/my_custom_auth_request_urlnull. Unknown handler path: my_custom_auth_request_url. [project AnywhereWorkManagement]
com.worklight.gadgets.GadgetRuntimeException: Invalid gadget request format: /WorkExecution/iphone/my_custom_auth_request_urlnull. Unknown handler path: my_custom_auth_request_url
at com.worklight.gadgets.api.GadgetAP
Our challenge handler submits our Authentication information using this Javascript call:
challengeHandler.submitLoginForm(challengeHandler.getAuthURL(), loginOptions, l
Where getAuthURL returns the string "/my_custom_auth_request."
Strangely, other devices using the same application and worklight server are allowed to login successfully. Another weird datapoint is that if we popup the Worklight Settings panel on this iPod Touch device, and update the Worklight server information, the worklight login then seems to succeed.
Wireshark log from the failed connection:
POST /AnywhereWorkManagement/apps/services/api/WorkExecution/iphone/login HTTP/1.1
Host: mobilenext1.tivlab.austin.ibm.com
Accept-Language: en_US
User-Agent: Mozilla/5.0 (iPod touch; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D257 (367413328)/Worklight/6.1.0.02.20141006-1624
Content-Length: 71
x-wl-platform-version: 6.1.0.02.20141006-1624
X-Requested-With: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
x-wl-app-version: 7.5.1.1
Accept: text/javascript, text/html, application/xml, text/xml, */*
Connection: keep-alive
x-wl-native-version: 1475155033
x-wl-device-id: 36CDA8F2-F4E9-49D8-8CBB-A250FDC3B8FA
Cookie: WL_PERSISTENT_COOKIE=ac72a920-b614-423d-8347-e4b5c96a4a1b
Origin: file://
Accept-Encoding: gzip, deflate
realm=CustomAuthenticationRealm&isAjaxRequest=true&x=0.7606244247872382HTTP/1.1 503 Service Unavailable
X-Powered-By: Servlet/3.0
P3P: policyref="/w3c/p3p.xml", CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"
Content-Language: en-US
Content-Length: 0
Connection: Close
Date: Fri, 10 Oct 2014 14:32:15 GMT
Then after updating the Custom URL to remove the trailing slash, and relogging in, here's the wireshark log from the successful login:
POST /AnywhereWorkManagement/apps/services/api/WorkExecution/iphone/query HTTP/1.1
Host: mobilenext1.tivlab.austin.ibm.com
Accept-Language: en_US
User-Agent: Mozilla/5.0 (iPod touch; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D257 (384405120)/Worklight/6.1.0.02.20141006-1624
Accept-Encoding: gzip, deflate
Content-Length: 210
x-wl-platform-version: 6.1.0.02.20141006-1624
X-Requested-With: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
x-wl-app-version: 7.5.1.1
Accept: text/javascript, text/html, application/xml, text/xml, */*
Connection: keep-alive
x-wl-native-version: 1475155033
x-wl-device-id: 36CDA8F2-F4E9-49D8-8CBB-A250FDC3B8FA
Cookie: WL_PERSISTENT_COOKIE=0983cfc8-8526-48c9-99cb-72659cb934b4; JSESSIONID=0000wSxsNgF79M62_UJTNmXKKYC:2e8ee48e-dec4-4c69-b8b4-ad37f839f1be
Origin: file://
WL-Instance-Id: okur33g93p35c9j7rvpk1r9g5j
adapter=OSLCGenericAdapter&procedure=getProperties&compressResponse&parameters=%5B%7B%22propertyNames%22%3A%5B%22si.auth.type%22%5D%7D%5D&__wl_deviceCtx=Ar1Cjm4_mo9jpBAA&isAjaxRequest=true&x=0.33572526928037405HTTP/1.1 200 OK
X-Powered-By: Servlet/3.0
P3P: policyref="/w3c/p3p.xml", CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"
Content-Type: application/json; charset=UTF-8
Cache-Control: no-cache, no-store, must-revalidate
Expires: Sat, 26 Jul 1997 05:00:00 GMT
Content-Length: 93
Date: Fri, 10 Oct 2014 14:43:15 GMT
/*-secure-
{"isSuccessful":true,"responseID":"1516","properties":{"si.auth.type":"maximo"}}*/POST /AnywhereWorkManagement/apps/services/api/WorkExecution/iphone/my_custom_auth_request_url HTTP/1.1
Host: mobilenext1.tivlab.austin.ibm.com
Accept-Language: en_US
User-Agent: Mozilla/5.0 (iPod touch; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D257 (384405120)/Worklight/6.1.0.02.20141006-1624
X-Requested-With: XMLHttpRequest
Accept: text/javascript, text/html, application/xml, text/xml, */*
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
x-wl-app-version: 7.5.1.1
Connection: keep-alive
Cookie: WL_PERSISTENT_COOKIE=0983cfc8-8526-48c9-99cb-72659cb934b4; JSESSIONID=0000wSxsNgF79M62_UJTNmXKKYC:2e8ee48e-dec4-4c69-b8b4-ad37f839f1be
x-wl-device-id: 36CDA8F2-F4E9-49D8-8CBB-A250FDC3B8FA
Content-Length: 62
Origin: file://
Accept-Encoding: gzip, deflate
username=wilson&password=wilson&authType=maximo&langcode=en-USHTTP/1.1 200 OK
X-Powered-By: Servlet/3.0
P3P: policyref="/w3c/p3p.xml", CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"
Content-Type: application/json; charset=UTF-8
Cache-Control: no-cache, must-revalidate
Content-Language: en-US
Transfer-Encoding: chunked
Date: Fri, 10 Oct 2014 14:43:15 GMT
19
{"authStatus":"complete"}
0
I found this in the server logs to correspond with that 503 error from worklight server (I can reproduce by POSTing the same login URL). However in our Worklight Console, there is only one version of each application listed for iphone.
[10/10/14 10:37:54:063 CDT] 00000485 com.worklight.gadgets.serving.GadgetAPIServlet E FWLSE0020E: Ajax request exception: The environment 'iphone' supports multiple versions, therefore you must request it with a version parameter. [project AnywhereWorkManagement]
[10/10/14 10:37:54:066 CDT] 00000485 com.worklight.gadgets.serving.GadgetAPIServlet E FWLSE0117E: Error code: 1, error description: INTERNAL_ERROR, error message: FWLSE0069E: An internal error occurred during gadget request [project AnywhereWorkManagement]The environment 'iphone' supports multiple versions, therefore you must request it with a version parameter., User Identity {wl_authenticityRealm=null, CustomAuthenticationRealm=null, wl_remoteDisableRealm=null, wl_antiXSRFRealm=null, wl_deviceAutoProvisioningRealm=null, wl_deviceNoProvisioningRealm=null, wl_anonymousUserRealm=null}. [project AnywhereWorkManagement]
Scott,
The workaround is to remove the trailing slash from the Server URL.
For a permanent fix I suggest that you will open a PMR so that the development team could investigate the issue closely.
When doing so, please provide a reproducible test case because the flow does work fine, but seems to not work in yours, so need to better understand where exactly it fails. Be sure to provide this question in the description.
It could be that you are altering the URL somewhere in your challenge handler?