Giter VIP home page Giter VIP logo

Comments (16)

Jonahss avatar Jonahss commented on July 21, 2024

It might be that the points you have chosen are off the screen. I'm working on better error handling.

You can use the following to get the size of the emulator screen:

driver.manage().window().size()

from java-client.

ansonliao avatar ansonliao commented on July 21, 2024

Hello Jonahss,
no method "size()" under "driver.manage().window()"
could you advise?

from java-client.

ansonliao avatar ansonliao commented on July 21, 2024

Hello Jonahss,
I got the method, it should be
driver.manage().window().getSize();

from java-client.

ansonliao avatar ansonliao commented on July 21, 2024

Hello Jonahss,
My swipe code as below, but it doesn't swipe the screen in iOS 7.x simulator (iPhone),
could you advise how to correct it?

int Y = driver.manage().window().getSize().getHeight(); // Y = 568
int X = driver.manage().window().getSize().getWidth(); // X = 320

int sX = (int) (X * 0.8); // sX = 256
int sY = (int) (Y * 0.5); // sY = 284
int eX = (int) (X * 0.2); // eX = 64
int eY = sY; // eY = 284
int duration = 1200;

driver.swipe(sX, sY, eX, eY, duration);

from java-client.

Jonahss avatar Jonahss commented on July 21, 2024

What happens when you lower the duration? Maybe duration is being interpreted as seconds rather than ms.
What error do you experience?
Can you provide a copy of the Appium server logs?

from java-client.

ansonliao avatar ansonliao commented on July 21, 2024

Dear Jonah,
it is no error when perform swipe gesture and the appium log below (I set
duration to "800"), please help to check it.

info: [INSTSERVER] Got result from instruments:
{"status":0,"value":{"width":320,"height":568}}

info: Responding to client with success:
{"status":0,"value":{"width":320,"height":568},"sessionId":"ce20d066-18a1-43ba-af16-529f87097879"}

GET
/wd/hub/session/ce20d066-18a1-43ba-af16-529f87097879/window/current/size 200
116ms - 126b

debug: Appium request initiated at
/wd/hub/session/ce20d066-18a1-43ba-af16-529f87097879/touch/perform

debug: Request received with params:
{"actions":[{"action":"press","options":{"y":284,"x":256}},{"action":"wait","options":{"ms":800}},{"action":"moveTo","options":{"y":284,"x":64}},{"action":"release","options":{}}]}

info: Pushing command to appium work queue: "au.dragApp(256,284,64,284,0.8)"

debug: Sending command to instruments: au.dragApp(256,284,64,284,0.8)

info: [INSTSERVER] Sending command to instruments:
au.dragApp(256,284,64,284,0.8)

info: [INST] 2014-05-10 13:44:50 +0000 Debug:
target.dragFromToForDuration({x:"256", y:"284"}, {x:"64", y:"284"}, "0.8")

info: [INSTSERVER] Socket data received (50 bytes)

info: [INSTSERVER] Socket data being routed for 'cmd' event

info: [INSTSERVER] Got result from instruments: {"status":0,"value":null}

info: Responding to client with success:
{"status":0,"value":null,"sessionId":"ce20d066-18a1-43ba-af16-529f87097879"}

POST /wd/hub/session/ce20d066-18a1-43ba-af16-529f87097879/touch/perform
200 1768ms

  • 89b

debug: Appium request initiated at
/wd/hub/session/ce20d066-18a1-43ba-af16-529f87097879

debug: Request received with params: {}

2014-05-10 2:14 GMT+08:00 Jonah [email protected]:

What happens when you lower the duration? Maybe duration is being
interpreted as seconds rather than ms.
What error do you experience?
Can you provide a copy of the Appium server logs?


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-42696715
.

from java-client.

jlipps avatar jlipps commented on July 21, 2024

Try a duration of "0.8" and see if that does it

On May 10, 2014, at 2:50 PM, ansonliao [email protected] wrote:

Dear Jonah,
it is no error when perform swipe gesture and the appium log below (I set
duration to "800"), please help to check it.

info: [INSTSERVER] Got result from instruments:
{"status":0,"value":{"width":320,"height":568}}

info: Responding to client with success:
{"status":0,"value":{"width":320,"height":568},"sessionId":"ce20d066-18a1-43ba-af16-529f87097879"}

GET
/wd/hub/session/ce20d066-18a1-43ba-af16-529f87097879/window/current/size 200
116ms - 126b

debug: Appium request initiated at
/wd/hub/session/ce20d066-18a1-43ba-af16-529f87097879/touch/perform

debug: Request received with params:
{"actions":[{"action":"press","options":{"y":284,"x":256}},{"action":"wait","options":{"ms":800}},{"action":"moveTo","options":{"y":284,"x":64}},{"action":"release","options":{}}]}

info: Pushing command to appium work queue: "au.dragApp(256,284,64,284,0.8)"

debug: Sending command to instruments: au.dragApp(256,284,64,284,0.8)

info: [INSTSERVER] Sending command to instruments:
au.dragApp(256,284,64,284,0.8)

info: [INST] 2014-05-10 13:44:50 +0000 Debug:
target.dragFromToForDuration({x:"256", y:"284"}, {x:"64", y:"284"}, "0.8")

info: [INSTSERVER] Socket data received (50 bytes)

info: [INSTSERVER] Socket data being routed for 'cmd' event

info: [INSTSERVER] Got result from instruments: {"status":0,"value":null}

info: Responding to client with success:
{"status":0,"value":null,"sessionId":"ce20d066-18a1-43ba-af16-529f87097879"}

POST /wd/hub/session/ce20d066-18a1-43ba-af16-529f87097879/touch/perform
200 1768ms

  • 89b

debug: Appium request initiated at
/wd/hub/session/ce20d066-18a1-43ba-af16-529f87097879

debug: Request received with params: {}

2014-05-10 2:14 GMT+08:00 Jonah [email protected]:

What happens when you lower the duration? Maybe duration is being
interpreted as seconds rather than ms.
What error do you experience?
Can you provide a copy of the Appium server logs?


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-42696715
.


Reply to this email directly or view it on GitHub.

from java-client.

ansonliao avatar ansonliao commented on July 21, 2024

Hello Jonathan,
I will try it this night.
But I would like to know that duration it is not in ms?
Thanks for your reply.

Jonathan Lipps [email protected]于2014年5月12日星期一写道:

Try a duration of "0.8" and see if that does it

On May 10, 2014, at 2:50 PM, ansonliao <[email protected]javascript:_e(%7B%7D,'cvml','[email protected]');>
wrote:

Dear Jonah,
it is no error when perform swipe gesture and the appium log below (I
set
duration to "800"), please help to check it.

info: [INSTSERVER] Got result from instruments:
{"status":0,"value":{"width":320,"height":568}}

info: Responding to client with success:

{"status":0,"value":{"width":320,"height":568},"sessionId":"ce20d066-18a1-43ba-af16-529f87097879"}

GET
/wd/hub/session/ce20d066-18a1-43ba-af16-529f87097879/window/current/size
200
116ms - 126b

debug: Appium request initiated at
/wd/hub/session/ce20d066-18a1-43ba-af16-529f87097879/touch/perform

debug: Request received with params:

{"actions":[{"action":"press","options":{"y":284,"x":256}},{"action":"wait","options":{"ms":800}},{"action":"moveTo","options":{"y":284,"x":64}},{"action":"release","options":{}}]}

info: Pushing command to appium work queue:
"au.dragApp(256,284,64,284,0.8)"

debug: Sending command to instruments: au.dragApp(256,284,64,284,0.8)

info: [INSTSERVER] Sending command to instruments:
au.dragApp(256,284,64,284,0.8)

info: [INST] 2014-05-10 13:44:50 +0000 Debug:
target.dragFromToForDuration({x:"256", y:"284"}, {x:"64", y:"284"},
"0.8")

info: [INSTSERVER] Socket data received (50 bytes)

info: [INSTSERVER] Socket data being routed for 'cmd' event

info: [INSTSERVER] Got result from instruments:
{"status":0,"value":null}

info: Responding to client with success:

{"status":0,"value":null,"sessionId":"ce20d066-18a1-43ba-af16-529f87097879"}

POST /wd/hub/session/ce20d066-18a1-43ba-af16-529f87097879/touch/perform
200 1768ms

  • 89b

debug: Appium request initiated at
/wd/hub/session/ce20d066-18a1-43ba-af16-529f87097879

debug: Request received with params: {}

2014-05-10 2:14 GMT+08:00 Jonah <[email protected]javascript:_e(%7B%7D,'cvml','[email protected]');>:

What happens when you lower the duration? Maybe duration is being
interpreted as seconds rather than ms.
What error do you experience?
Can you provide a copy of the Appium server logs?


Reply to this email directly or view it on GitHub<
https://github.com/appium/java-client/issues/21#issuecomment-42696715>
.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-42813508
.

from java-client.

ansonliao avatar ansonliao commented on July 21, 2024

Hello Jonathan,
can't set duration of "0.8" as duration default to "int" as agrument.

from java-client.

vikas2453 avatar vikas2453 commented on July 21, 2024

It is not working for me either. Using AppiumDriver.
calling simply by driver.swipe(185, 130, 185, 445, 800)// 800 is ms., Coordinates are there in app.

appium sends the commands to the instruments with 0.8 s, and in response receives status 0 and value null.

from java-client.

Jonahss avatar Jonahss commented on July 21, 2024

@vikas2453 Can you open a new issue, this one is old.

Are you using the newest version of java-client?
In the new issue, please post the full Appium logs.

from java-client.

kaelumania avatar kaelumania commented on July 21, 2024

there is also a scale factor between screen size (returned by appium) and size of a screenshot. Does that correlate with the problem? What is the correct coordinate system making taps etc.?

from java-client.

rahulLiving avatar rahulLiving commented on July 21, 2024

is there any way to check whether swipe() has happened or not ?
Actually i have to swipe pages , but i don'y know how many pages i'll be having . So , i was wondering is there any way to check when to stop swiping or in my case when we have reached at the end of page such that no more swipe needed ?
Thanks

from java-client.

Jonahss avatar Jonahss commented on July 21, 2024

@rahulLiving You can definitely check the title, or some other defining characteristic of each page (like a label or page number) until you get to the end.

from java-client.

rahulLiving avatar rahulLiving commented on July 21, 2024

Yeah but that is not the case in my scenario, i was wondering something like if swipe() returns something on the swipe of page happened or not. I guess there is no such thing to detect it , swipe return type looks void. It would have been great to catch exception or anything like that which says something like no more swipe() can be done.
Thanks for your quick response Jonashss :)

from java-client.

Jonahss avatar Jonahss commented on July 21, 2024

Hmmm, yeah most Selenium commands don't really return anything, since it's up to you to detect whether the swipe happened the way you wanted it to.

from java-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.