Closed akshattambe closed 11 months ago
Use vanilla WebElement
i updated the issue, highlighting the foundational problem. I'm not sure what I am missing in a simple POC.
I have made the following change-
WindowsDriver driver = new WindowsDriver(new URI("http://127.0.0.1:4723/wd/hub").toURL(), capabilities);
and get the following exception message in my IDE console-
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Unable to parse remote response:
Host info: host: '3NLYFL3', ip: '10.69.211.5'
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at io.appium.java_client.remote.AppiumProtocolHandshake.createSession(AppiumProtocolHandshake.java:133)
at io.appium.java_client.remote.AppiumProtocolHandshake.createSession(AppiumProtocolHandshake.java:102)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:182)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:602)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:274)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:163)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:89)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:101)
at io.appium.java_client.windows.WindowsDriver.<init>(WindowsDriver.java:50)
at WindowsAppTest.test1(WindowsAppTest.java:19)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: org.openqa.selenium.json.JsonException: Unable to parse:
at org.openqa.selenium.json.Json.toType(Json.java:169)
at org.openqa.selenium.json.Json.toType(Json.java:152)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:122)
... 16 more
Caused by: org.openqa.selenium.json.JsonException: Expected to read a START_MAP but instead have: END. Last 0 characters read:
Build info: version: '4.12.1', revision: '8e34639b11'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '20.0.2'
Driver info: driver.version: WindowsDriver
at org.openqa.selenium.json.JsonInput.expect(JsonInput.java:443)
at org.openqa.selenium.json.JsonInput.beginObject(JsonInput.java:331)
at org.openqa.selenium.json.MapCoercer.lambda$apply$1(MapCoercer.java:64)
at org.openqa.selenium.json.JsonTypeCoercer.lambda$buildCoercer$6(JsonTypeCoercer.java:174)
at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:149)
at org.openqa.selenium.json.Json.toType(Json.java:206)
at org.openqa.selenium.json.Json.toType(Json.java:167)
... 18 more
Exception in Win App Driver session -
POST /session HTTP/1.1
Accept: */*
Content-Length: 226
Content-Type: application/json; charset=utf-8
Host: 127.0.0.1:4723
User-Agent: appium/8.5.1 (selenium/4.12.1 (java windows))
X-Idempotency-Key: d9d9a3c1-6b9f-4872-bdb0-5b322fe2087f
{
"capabilities": {
"firstMatch": [
{
}
],
"alwaysMatch": {
"appium:app": "C:\\Windows\\System32\\calc.exe",
"appium:automationName": "Windows",
"platformName": "windows"
}
}
}
HTTP/1.1 400 Bad Request
Content-Length: 141
Content-Type: application/json
Description
I'm trying a POC for Windows app GUI test automation using WinAppDriver.
My Code snippet fails to start a new session with the message -
Response code 400. Message: Bad capabilities. Specify either app or appTopLevelWindow to create a session
Can you please point me in the right direction?
Environment
Code To Reproduce Issue [ Good To Have ]
Exception
Exception in Win App Driver session -
Exception in IDE -
Thanks for your help in advance