0

AndroidViewClientを実行していて、完全な階層をダンプできますが、getXY()またはtouch()しようとすると失敗します。 Get Current Focused Window Name using AndroidViewClientからの解決法でさえ私に誤りを与える。AndroidViewClient - getXY()座標を取得できません

印刷widget.getXY()

ファイル「/usr/local/lib/python2.7/dist-packages/androidviewclient-11.5.3:

kwargs1 = {'verbose': True, 'ignoresecuredevice': True} 
    kwargs2 = {'startviewserver': True, 'forceviewserveruse': True, 
      'autodump': False, 'ignoreuiautomatorkilled': True} 
    device, serialno = ViewClient.connectToDeviceOrExit(**kwargs1) 
    vc = ViewClient(device, serialno, **kwargs2) 
    view = vc.dump(window='-1') 
    widget = vc.findViewByIdOrRaise("id/no_id/5") 
    widget.useUiAutomator = False 
    print widget 
    # Up until here runs no problem. 
    print widget.getXY() # fails. 
    widget.touch() # also fails. 

私のスタックトレースは次のようになります-py2.7.egg/COM/dtmilanoは/ usr/local/libの "getXY (WVX、wvy)=自己.__ dumpWindowsInformation(デバッグ=デバッグ)

ファイルでは、ライン680、" /アンドロイド/ viewclient.py /python2.7/dist-packages/androidviewclient-11.5.3-py2.7.egg/com/dtmilano/android/viewclient.py "、__dumpWindの798行目owsInformation

dww = self.device.shell('dumpsys window windows') 

ファイル "/usr/local/lib/python2.7/dist-packages/androidviewclient-11.5.3-py2.7.egg/com/dtmilano/android/adb/adbclient.py"、シェルでライン377、

self.__send('shell:%s' % cmd, checkok=True, reconnect=False) 

ファイル「/usr/local/lib/python2.7/dist-packages/androidviewclient-11.5.3-py2.7.egg/com/dtmilano/android/adb/adbclient .py "行243、__sendで

self.__checkOk() 

ファイル" /usr/local/lib/python2.7/dist-packages/androidviewclient- 11.5.3-py2.7.egg/COM/dtmilano /アンドロイド/ ADB/adbclient.py」、行286、__checkOk

raise RuntimeError("ERROR: %s %s" % (repr(recv), error)) 

はRuntimeError:ERROR:

任意の考えを ''?上記のコード

+0

以下を参照したい場合は、デバイスとそれのAPIレベルは何ですか? –

+0

Nexus 5Xエミュレータ、APIレベル23 –

+0

ViewServerの使用を強要しているのはなぜですか( ''forceviewserveruse':True')? API 23は 'uiautomator'を使うべきです。 –

答えて

0
widget = vc.findViewByIdOrRaise("id/no_id/5") 
widget.useUiAutomator = False 
widget.getXY() 
x = (str)widget.windows[widget.currentFocus] 
print x 

画面の表示アクティビティ名と高さと幅を取得します、uは唯一の高さと幅が1

h = device._AdbClient__getDisplayHeight("") 
w = device._AdbClient__getDisplayWidth("") 
print (str)(h) 
print (str)(w) 
関連する問題