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

dump is not showing correct X,Y in Power Options #29

Closed
levrado opened this issue Jun 11, 2013 · 3 comments
Closed

dump is not showing correct X,Y in Power Options #29

levrado opened this issue Jun 11, 2013 · 3 comments
Assignees

Comments

@levrado
Copy link

levrado commented Jun 11, 2013

Hi,

i'm trying to toggle airplane mode so i simulate a long press on power button to enter the device options menu.
then i search for the "airplane mode" query to press it but it pressing the wrong x,y

i did a dump -c on the window and saw that there is offset of 200px in the y axis
i tried it on galaxy s2 & s3 version 4.1.2

@ghost ghost assigned dtmilano Jun 12, 2013
dtmilano added a commit that referenced this issue Jun 12, 2013
- - Version 2.3.22
- Fixed window ID regex for system windows for pre API 16 (no
uiautomator)
- Improved debug messages
- Added optional debug argument to getXY()
- setAlarm() refactored
@dtmilano
Copy link
Owner

Please, re-test and close if appropriate

@levrado
Copy link
Author

levrado commented Jun 13, 2013

It's closer now but still not the correct coordiantes, the offset in the y axis is now 100px
BTW it works if i do it like this:

    device.press("KEYCODE_POWER", 'down')
    vc = ViewClient(device, serialno)
    x = int(vc.findViewWithText("Flight mode").getX())
    y = int(vc.findViewWithText("Flight mode").getY())
    device.touch(x,y,"DOWN_AND_UP")
    vc.dump()
    x = int(vc.findViewWithText("OK").getX())
    y = int(vc.findViewWithText("OK").getY())
    device.touch(x,y,"DOWN_AND_UP")

@dtmilano
Copy link
Owner

I have tested the patch on the emulator and 4.2.2 devices and worked. Unfortunately, the problem is due to a bug in uiautomator in version 4.1.2. I haven't had time yet to analyze it deeply, but these screenshots clearly shows the issue:
device-2013-06-13-175632
device-2013-06-13-173733
They have been obtained running the same script autogenerated by culebra and slightly modified after:

#! /usr/local/bin/shebang monkeyrunner -plugin $AVC_HOME/bin/androidviewclient-$AVC_VERSION.jar @!
# -*- coding: utf-8 -*-
'''
Copyright (C) 2013  Diego Torres Milano
Created on 2013-06-13 by Culebra v0.9.11

                      __    __    __    __
                     /  \  /  \  /  \  /  \ 
____________________/  __\/  __\/  __\/  __\_____________________________
___________________/  /__/  /__/  /__/  /________________________________
                   | / \   / \   / \   / \   \___
                   |/   \_/   \_/   \_/   \    o \ 
                                           \_____/--<
@author: Diego Torres Milano
@author: Jennifer E. Swofford (ascii art snake)
'''


import re
import sys
import os

from com.dtmilano.android.viewclient import ViewClient

from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice

kwargs1 = {'verbose': True, 'ignoresecuredevice': False}
device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1)
kwargs2 = {'startviewserver': True, 'forceviewserveruse': False, 'autodump': False, 'ignoreuiautomatorkilled': True}
vc = ViewClient(device, serialno, **kwargs2)
vc.dump(window='-1')

# class=android.widget.TextView text="Airplane mode"
v = vc.findViewWithTextOrRaise('Airplane mode')
print "center=", v.getCenter()

@levrado levrado closed this as completed Jun 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants