Info:
C#, Windows 10/Windows Server
Node 20.17.0
appium@2.11.4
appium-windows-driver@2.12.32
NuGet package Appium.WebDriver Version="4.4.5"
Hey guys, trying to understand did someone face something like this before
When Im doing simple
element.Click()
Everyting looks not bad
But when Im doing driver.Execute for click for some very specific casses I have problem that server doesn't return correct information and click just clicking somewhere.
I can reproduce this very easy when my application is not maximized. Everything looks not bad when it is maximized.
Code
Framework level:
public string Id => typeof(RemoteWebElement).GetField("elementId", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Element as RemoteWebElement).ToString();
public void SingleClick()
{
object result = Driver.ExecuteScript($"{GetMethodPlatform()}: click", new Dictionary<string, object>() {
{"elementId", $"{Id}"},
{"durationMs", $"250"}});
Sleep(sleep);
}
Test Layer:
FindElement(ElementId).SingleClick();
Appium server logs from console for Driver execution
{"using":"accessibility id","value":"SelectApplicationModeDialog.SSModeRadioButton"}
[d7900cbe][WindowsDriver@c989] HTTP/1.1 200 OK
Content-Length: 102
Content-Type: application/json
{"sessionId":"907AB41C-0C60-4BB3-8D10-54FCB87600F0","status":0,"value":{"ELEMENT":"7.13760.25392316"}}
[d7900cbe][WindowsDriver@c989] Got response with status 200: {"sessionId":"907AB41C-0C60-4BB3-8D10-54FCB87600F0","status":0,"value":{"ELEMENT":"7.13760.25392316"}}
[d7900cbe][WindowsDriver@c989] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"7.13760.25392316","ELEMENT":"7.13760.25392316"}
[d7900cbe][HTTP] <-- POST /session/d7900cbe-5631-450d-b858-ed1657e2fb90/element 200 38 ms - 97
[d7900cbe][HTTP] Request idempotency key: ebe86264-92bd-4172-a799-00ada539e9c5
[d7900cbe][HTTP] --> POST /session/d7900cbe-5631-450d-b858-ed1657e2fb90/execute/sync {"script":"windows: click","args":[{"elementId":"7.13760.25392316","durationMs":"250"}]}
[d7900cbe][WindowsDriver@c989] Calling AppiumDriver.execute() with args: ["windows: click",[{"elementId":"7.13760.25392316","durationMs":"250"}],"d7900cbe-5631-450d-b858-ed1657e2fb90"]
[d7900cbe][WindowsDriver@c989] Executing extension command 'windows: click'
[d7900cbe][WindowsDriver@c989] Matched '/element/7.13760.25392316/location' to command name 'getLocation'
[d7900cbe][WindowsDriver@c989] Proxying [GET /element/7.13760.25392316/location] to [GET http://127.0.0.1:4725/wd/hub/session/907AB41C-0C60-4BB3-8D10-54FCB87600F0/element/7.13760.25392316/location] with no body
[d7900cbe][WindowsDriver@c989] ==========================================
GET /wd/hub/session/907AB41C-0C60-4BB3-8D10-54FCB87600F0/element/7.13760.25392316/location HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, compress, deflate, br
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Host: 127.0.0.1:4725
User-Agent: appium
[d7900cbe][WindowsDriver@c989] Got response with status 200: {"sessionId":"907AB41C-0C60-4BB3-8D10-54FCB87600F0","status":0,"value":{"x":-129,"y":-81}}
[d7900cbe][WindowsDriver@c989] Matched '/element/7.13760.25392316/size' to command name 'getSize'
[d7900cbe][WindowsDriver@c989] Proxying [GET /element/7.13760.25392316/size] to [GET http://127.0.0.1:4725/wd/hub/session/907AB41C-0C60-4BB3-8D10-54FCB87600F0/element/7.13760.25392316/size] with no body
[d7900cbe][WindowsDriver@c989] HTTP/1.1 200 OK
Content-Length: 90
Content-Type: application/json
{"sessionId":"907AB41C-0C60-4BB3-8D10-54FCB87600F0","status":0,"value":{"x":-129,"y":-81}}
[d7900cbe][WindowsDriver@c989] ==========================================
GET /wd/hub/session/907AB41C-0C60-4BB3-8D10-54FCB87600F0/element/7.13760.25392316/size HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, compress, deflate, br
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Host: 127.0.0.1:4725
User-Agent: appium
[d7900cbe][WindowsDriver@c989] HTTP/1.1 200 OK
Content-Length: 97
Content-Type: application/json
{"sessionId":"907AB41C-0C60-4BB3-8D10-54FCB87600F0","status":0,"value":{"height":24,"width":516}}
[d7900cbe][WindowsDriver@c989] Got response with status 200: {"sessionId":"907AB41C-0C60-4BB3-8D10-54FCB87600F0","status":0,"value":{"height":24,"width":516}}
[d7900cbe][WindowsDriver@c989] Absolute coordinates: (129, -69)
[d7900cbe][WindowsDriver@c989] Responding to client with driver.execute() result: null
[d7900cbe][HTTP] <-- POST /session/d7900cbe-5631-450d-b858-ed1657e2fb90/execute/sync 200 264 ms - 14
Logs for element.Click() same element (it is working, keep in mind)
{"using":"accessibility id","value":"SelectApplicationModeDialog.SSModeRadioButton"}
[d7900cbe][WindowsDriver@c989] HTTP/1.1 200 OK
Content-Length: 102
Content-Type: application/json
{"sessionId":"907AB41C-0C60-4BB3-8D10-54FCB87600F0","status":0,"value":{"ELEMENT":"7.13760.25392316"}}
[d7900cbe][WindowsDriver@c989] Got response with status 200: {"sessionId":"907AB41C-0C60-4BB3-8D10-54FCB87600F0","status":0,"value":{"ELEMENT":"7.13760.25392316"}}
[d7900cbe][WindowsDriver@c989] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"7.13760.25392316","ELEMENT":"7.13760.25392316"}
[d7900cbe][HTTP] <-- POST /session/d7900cbe-5631-450d-b858-ed1657e2fb90/element 200 35 ms - 97
[d7900cbe][HTTP] Request idempotency key: 382ecb1d-1193-4ffc-a19b-74467bb2d5a8
[d7900cbe][HTTP] --> POST /session/d7900cbe-5631-450d-b858-ed1657e2fb90/element/7.13760.25392316/click {}
[d7900cbe][WindowsDriver@c989] Driver proxy active, passing request on via HTTP proxy
[d7900cbe][WindowsDriver@c989] Matched '/session/d7900cbe-5631-450d-b858-ed1657e2fb90/element/7.13760.25392316/click' to command name 'click'
[d7900cbe][WindowsDriver@c989] Proxying [POST /session/d7900cbe-5631-450d-b858-ed1657e2fb90/element/7.13760.25392316/click] to [POST http://127.0.0.1:4725/wd/hub/session/907AB41C-0C60-4BB3-8D10-54FCB87600F0/element/7.13760.25392316/click] with body: {}
[d7900cbe][WindowsDriver@c989] ==========================================
POST /wd/hub/session/907AB41C-0C60-4BB3-8D10-54FCB87600F0/element/7.13760.25392316/click HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, compress, deflate, br
Connection: keep-alive
Content-Length: 2
Content-Type: application/json; charset=utf-8
Host: 127.0.0.1:4725
User-Agent: appium
[d7900cbe][WindowsDriver@c989] Got response with status 200: {"sessionId":"907AB41C-0C60-4BB3-8D10-54FCB87600F0","status":0}
[d7900cbe][WindowsDriver@c989] Replacing sessionId 907AB41C-0C60-4BB3-8D10-54FCB87600F0 with d7900cbe-5631-450d-b858-ed1657e2fb90
[d7900cbe][HTTP] <-- POST /session/d7900cbe-5631-450d-b858-ed1657e2fb90/element/7.13760.25392316/click 200 814 ms - 65
[d7900cbe][WindowsDriver@c989] HTTP/1.1 200 OK
Content-Length: 63
Content-Type: application/json
{"sessionId":"907AB41C-0C60-4BB3-8D10-54FCB87600F0","status":0}
So, problem is pretty simple
On both situations server return same ID, but for DriverExecuteClick it is returning wrong coordinates.
Any advises? Thinking about creation my own REST API client and send /click, /doubleclick etc commands instead of using driver execution, as just doesn't work properly for some casses.
But I don't understand why Appium works so strange for this case...
Info: C#, Windows 10/Windows Server Node 20.17.0 appium@2.11.4 appium-windows-driver@2.12.32 NuGet package Appium.WebDriver Version="4.4.5"
Hey guys, trying to understand did someone face something like this before
When Im doing simple
element.Click()
Everyting looks not badBut when Im doing driver.Execute for click for some very specific casses I have problem that server doesn't return correct information and click just clicking somewhere. I can reproduce this very easy when my application is not maximized. Everything looks not bad when it is maximized.
Code
Framework level:
Test Layer:
FindElement(ElementId).SingleClick();
Appium server logs from console for Driver execution
Logs for element.Click() same element (it is working, keep in mind)
So, problem is pretty simple On both situations server return same ID, but for DriverExecuteClick it is returning wrong coordinates. Any advises? Thinking about creation my own REST API client and send /click, /doubleclick etc commands instead of using driver execution, as just doesn't work properly for some casses.
But I don't understand why Appium works so strange for this case...