Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to perform many times press and maveTo on IOS Native application using XCUITest (Appium) #8734

Closed
yefankongge opened this issue Jun 26, 2017 · 7 comments
Labels
Question XCUITest regarding xcuitest driver

Comments

@yefankongge
Copy link

The problem

Briefly describe the issue you are experiencing (or the feature you want to see added to Appium). Tell us what you were trying to do and what happened instead. Remember, this is not a place to ask questions. For that, go to http://discuss.appium.io!

Environment

  • Appium version:1.6.5
  • java-client:5.0.0-BETA8
  • mac os:10.12
  • simulator:iphone6s 10.3

Details

iosTouchAction.press(startX,startY).waitAction(1000).moveTo(endX,endY).release().perform();
first time everything is ok,but the second time app is interrupted

Link to Appium logs

[HTTP] --> POST /wd/hub/session/df78aa2e-ae33-4a2f-9d24-82887a041b05/touch/perform {"actions":[{"action":"press","options":{"x":100,"y":600}},{"action":"wait","options":{"ms":1000}},{"action":"moveTo","options":{"x":0,"y":-500}},{"action":"release","options":{}}]}
[debug] [MJSONWP] Calling AppiumDriver.performTouch() with args: [[{"action":"press","options":{"x":100,"y":600}},{"action":"wait","options":{"ms":1000}},{"action":"moveTo","options":{"x":0,"y":-500}},{"action":"release","options":{}}],"df78aa2e-ae33-4a2f-9d24-82887a041b05"]
[debug] [XCUITest] Executing command 'performTouch'
[debug] [XCUITest] Received the following touch action: press(options={"x":100,"y":600})-wait(options={"ms":1000})-moveTo(options={"x":0,"y":-500})-release(options={})
[debug] [XCUITest] Found matching gesture: drag
[debug] [JSONWP Proxy] Proxying [POST /wda/dragfromtoforduration] to [POST http://localhost:8100/session/B4B41FBF-79FD-4343-AE46-17DFBE584DE3/wda/dragfromtoforduration] with body: {"fromX":100,"fromY":600,"toX":100,"toY":100,"duration":1}
[debug] [JSONWP Proxy] Got response with status 200: {"value":{},"sessionId":"B4B41FBF-79FD-4343-AE46-17DFBE584DE3","status":0}
[debug] [MJSONWP] Responding to client with driver.performTouch() result: null
[HTTP] <-- POST /wd/hub/session/df78aa2e-ae33-4a2f-9d24-82887a041b05/touch/perform 200 9448 ms - 76
[HTTP] --> POST /wd/hub/session/df78aa2e-ae33-4a2f-9d24-82887a041b05/touch/perform {"actions":[{"action":"press","options":{"x":100,"y":600}},{"action":"wait","options":{"ms":1000}},{"action":"moveTo","options":{"x":0,"y":-500}},{"action":"release","options":{}},{"action":"press","options":{"x":100,"y":600}},{"action":"wait","options":{"ms":1000}},{"action":"moveTo","options":{"x":0,"y":-500}},{"action":"release","options":{}}]}
[debug] [MJSONWP] Calling AppiumDriver.performTouch() with args: [[{"action":"press","options":{"x":100,"y":600}},{"action":"wait","options":{"ms":1000}},{"action":"moveTo","options":{"x":0,"y":-500}},{"action":"release","options":{}},{"action":"press","options":{"x":100,"y":600}},{"action":"wait","options":{"ms":1000}},{"action":"moveTo","options":{"x":0,"y":-500}},{"action":"release","options":{}}],"df78aa2e-ae33-4a2f-9d24-82887a041b05"]
[debug] [XCUITest] Executing command 'performTouch'
[debug] [XCUITest] Received the following touch action: press(options={"x":100,"y":600})-wait(options={"ms":1000})-moveTo(options={"x":0,"y":-500})-release(options={})-press(options={"x":100,"y":600})-wait(options={"ms":1000})-moveTo(options={"x":0,"y":-500})-release(options={})
[HTTP] <-- POST /wd/hub/session/df78aa2e-ae33-4a2f-9d24-82887a041b05/touch/perform 501 12 ms - 759
[HTTP] --> DELETE /wd/hub/session/df78aa2e-ae33-4a2f-9d24-82887a041b05 {}
[debug] [MJSONWP] Calling AppiumDriver.deleteSession() with args: ["df78aa2e-ae33-4a2f-9d24-82887a041b05"]
[debug] [BaseDriver] Event 'quitSessionRequested' logged at 1498469269578 (17:27:49 GMT+0800 (CST))
[debug] [JSONWP Proxy] Proxying [DELETE /session/df78aa2e-ae33-4a2f-9d24-82887a041b05] to [DELETE http://localhost:8100/session/B4B41FBF-79FD-4343-AE46-17DFBE584DE3] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\n "value" : {\n\n },\n "sessionId" : "CA09BB7D-A8AC-43C7-A215-BDFE83E81AEE",\n "status" : 0\n}"
[debug] [XCUITest] Found WDA derived data folder: '/Users/yefan/Library/Developer/Xcode/DerivedData/WebDriverAgent-gbqaphewpezlskbdiruxlskdukra'
[XCUITest] Setting '755' permissions to '/Users/yefan/Library/Developer/Xcode/DerivedData/WebDriverAgent-gbqaphewpezlskbdiruxlskdukra/Logs/Test/Attachments' folder
[debug] [XCUITest] Found WDA derived data folder: '/Users/yefan/Library/Developer/Xcode/DerivedData/WebDriverAgent-gjeeslpzryfzaigbwlfeozhffztb'
[XCUITest] Setting '755' permissions to '/Users/yefan/Library/Developer/Xcode/DerivedData/WebDriverAgent-gjeeslpzryfzaigbwlfeozhffztb/Logs/Test/Attachments' folder
[debug] [XCUITest] Not clearing log files. Use clearSystemFiles capability to turn on.
[debug] [iOSLog] Stopping iOS log capture
[Appium] Removing session df78aa2e-ae33-4a2f-9d24-82887a041b05 from our master session list
[debug] [BaseDriver] Event 'quitSessionFinished' logged at 1498469270117 (17:27:50 GMT+0800 (CST))
[debug] [MJSONWP] Received response: null
[debug] [MJSONWP] But deleting session, so not returning
[debug] [MJSONWP] Responding to client with driver.deleteSession() result: null

Code To Reproduce Issue [ Good To Have ]

@Test
public void testBuyBuy() throws  InterruptedException {
    Thread.sleep(3000);
    driver.findElementByName("买买买").click();
    Thread.sleep(5000);
    IOSTouchAction iosTouchAction = new IOSTouchAction(driver);
    Thread.sleep(3000);
    for(int i = 0; i < 10; i++){
        int startX = 100;
        int startY = 600;
        int endX = 0;
        int endY = -500;

iosTouchAction.press(startX,startY).waitAction(1000).moveTo(endX,endY).release().perform();
Thread.sleep(2000);
}
}

@mykola-mokhnach
Copy link
Collaborator

I assume this code is not exactly doing what it is supposed to do, but try to move IOSTouchAction instance creation into the loop.

@vjmaiky
Copy link

vjmaiky commented Jun 26, 2017

i would do it like this:

public void swipeUntillElement (String subject) {
	int retry = 0;
	while (retry < 20) {
		try {
			WebElement we = null;
			we = AppiumDriverInstance.getInstance().findElementById(subject);
			if (we.isDisplayed()) {
				break;
			}
		} catch (Throwable e) {
			swipe_DownWithTouch(); Here put your swipe
		}
		retry++;
	}
	}
}

@mykola-mokhnach
Copy link
Collaborator

mykola-mokhnach commented Jun 26, 2017

@vjmaiky this code might be less ineffective from performance point of view in comparison to a native call.

There is mobile: scroll endpoint with name/predicate/toVisible arguments, which does the same task natively.

BTW, I would not ever recommend catching Throwable explicitly.

@vjmaiky
Copy link

vjmaiky commented Jun 26, 2017

it can be use NosuchelementException with getting text and compare with desired catch expression, etc. Regarding mobile:scroll i will give it a try even if i like more touch actions.

@mykola-mokhnach
Copy link
Collaborator

Catch WebDriverException and you'll never miss anything ;)
https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/package-tree.html

@yefankongge
Copy link
Author

@mykola-mokhnach I do it what you said,create IOSTouchAction instance into loop,everything looks all right

@lock
Copy link

lock bot commented Apr 27, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Apr 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question XCUITest regarding xcuitest driver
Projects
None yet
Development

No branches or pull requests

3 participants