Jitu1888 / ios-device-lab

This repo is created for Ios stf project
Other
3 stars 0 forks source link

The screen control is not working #1

Open BastienTLC opened 2 months ago

BastienTLC commented 2 months ago

When i try to tap or swipe on the screen nothing is happening when i consult the logs after tap on screen : ./view_log -proc wdaproxy

time="2024-05-06T10:39:50+02:00" level=info msg="req start" body_in="{\"actions\":[{\"action\":\"tap\",\"options\":{\"x\":223.69976341724396,\"y\":459.04386925697327}}]}" type=req.start uri=/session/229BDA73-8799-446E-A988-07E5011762EB/wda/touch/perform
Error:%!s(<nil>)
[10:39:50] 404 POST /session/229BDA73-8799-446E-A988-07E5011762EB/wda/touch/perform ([) 7.24ms
time="2024-05-06T10:39:50+02:00" level=info msg="req done" body_out= type=req.done uri=/session/229BDA73-8799-446E-A988-07E5011762EB/wda/touch/perform

./view_log -proc wda

Req URI: /session/229BDA73-8799-446E-A988-07E5011762EB/wda/touch/perform
{
  "actions": [
    {
      "action": "tap",
      "options": {
        "x": 223.69976341724396,
        "y": 459.04386925697327
      }
    }
  ]
}

./view_log -proc stf_ios_device

2024-05-06T08:39:50.027Z INF/device-ios:plugins:wdaCommands 4149 [b4ab88414479f4a65d75df74e997235082a689ef] click at x: 223.69976341724396 y: 459.04386925697327
2024-05-06T08:39:50.037Z WRN/device-ios:plugins:wdaCommands 4149 [b4ab88414479f4a65d75df74e997235082a689ef] posting {"actions":[{"action":"tap","options":{"x":223.69976341724396,"y":459.04386925697327}}]} to: http://localhost:8100/session/229BDA73-8799-446E-A988-07E5011762EB/wda/touch/perform status code: 404

These errors seem to show that the endpoint does not exist When i check in WDA documentation : https://w3c.github.io/webdriver/ i can't find somethings related to /touch/perform endpoint. So to ensure me that working i forked this repository : https://github.com/BastienTLC/stf-ios-provider to adapt the endpoints

Did you manage to get control working without forking this repository ?

NguyenHoangDuy2406 commented 3 weeks ago

@BastienTLC @Jitu1888 The "tap & swipe" won't work because now with the WebDriverAgent version over 7.0.0, the old actions are removed: https://github.com/appium/appium-xcuitest-driver/releases/tag/v7.0.0

We must update the script in coordinator/wda.go > function swipe to:

func ( self *WDAType ) swipe( sid string, x1 int, y1 int, x2 int, y2 int ) ( string ) {
  log.Info( "Swiping:", x1, y1, x2, y2 )
  json := fmt.Sprintf( `{
    "actions": [
      {
        "type": "pointer",
        "id": "finger1",
        "parameters": {"pointerType": "touch"},
        "actions": [
          {"type": "pointerMove", "duration": 0, "x": %d, "y": %d},
          {"type": "pointerDown", "button": 0},
          {"type": "pause", "duration": 500},
          {"type": "pointerMove", "duration": 0, "origin": "pointer", "x": %d, "y": %d},
          {"type": "pointerUp", "button": 0}
        ]
      }
    ]
  }`, x1, y1, x2, y2 )
  resp, _ := http.Post( self.base + "/session/" + sid + "/actions", "application/json", strings.NewReader( json ) )
  res := resp_to_str( resp )
  log.Info( "response " + res )
  return res
}