openatx / uiautomator2

Android Uiautomator2 Python Wrapper
MIT License
6.41k stars 1.38k forks source link

-32001 Jsonrpc error: <java.lang.StackOverflowError> data: java.lang.StackOverflowError: stack size 1039KB #856

Closed winniewang0813 closed 4 months ago

winniewang0813 commented 1 year ago

执行几次就报错 image

def wait_for_exists_by_xpath(self,locator,timeout): """

Wait for the object which has selectors within the given timeout.

        # Return true if the object *appear* in the given timeout. Else return false.
    """
    print("the xpath is",locator)
    #return self.u.xpath(locator).wait(timeout)
    time.sleep(timeout)
    return self.u.xpath(locator).exists

if name=='main': apk = 'com.abb.welcome' test=AndroidAppTool() test.connect_device('300140e3')

for i in range (1,100):
    test.start_application(apk)
    time.sleep(5)
    el = apk+':id/layout_cancel'
    result = test.wait_for_exists_by_resourceId(el,3)
    print (result)
    time.sleep(5)
    result = test.wait_for_exists_by_xpath('//*[@resource-id="com.abb.welcome:id/chk_eula"]',3)
    print (result)
    time.sleep(5)
    #test.stop_application(apk)
    test.stop_all_application()
winniewang0813 commented 1 year ago

ATX版本:0.10.0

winniewang0813 commented 1 year ago

Logcat OnelPlus 9 (Android 12)_logcat_20221215.txt

winniewang0813 commented 1 year ago

c:; cd 'c:\robotframework-androidapp\Library\U2Library'; & 'C:\Users\CNWIWAN14\AppData\Local\Programs\Python\Python37\python.exe' 'c:\Users\CNWIWAN14.vscode\extensions\ms-python.python-2022.20.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '54336' '--' 'c:\robotframework-androidapp\Library\U2Library\app.py' the locator is com.abb.welcome:id/layout_cancel False the xpath is //*[@resource-id="com.abb.welcome:id/chk_eula"] False the locator is com.abb.welcome:id/layout_cancel 执行到这里开始报错: image

12-15 11:50:06.543 22820 24125 W System.err: java.lang.StackOverflowError: stack size 1039KB 12-15 11:50:06.548 22820 24125 W System.err: at android.util.SparseArray.get(SparseArray.java:134) 12-15 11:50:06.548 22820 24125 W System.err: at android.util.SparseArray.get(SparseArray.java:125) 12-15 11:50:06.548 22820 24125 W System.err: at android.view.accessibility.AccessibilityInteractionClient.getConnection(AccessibilityInteractionClient.java:204) 12-15 11:50:06.548 22820 24125 W System.err: at android.view.accessibility.AccessibilityInteractionClient.findAccessibilityNodeInfoByAccessibilityId(AccessibilityInteractionClient.java:465) 12-15 11:50:06.548 22820 24125 W System.err: at android.view.accessibility.AccessibilityNodeInfo.getChild(AccessibilityNodeInfo.java:1121)

Ffmydy commented 6 months ago

uiautomator2.exceptions.JSONRPCError: -32001 Jsonrpc error: data: java.lang.StackOverflowError: stack size 1039KB at java.nio.CharBuffer.limit(CharBuffer.java:876) at java.nio.Buffer.(Buffer.java:213) at java.nio.CharBuffer.(CharBuffer.java:141) at java.nio.HeapCharBuffer.(HeapCharBuffer.java:58) at java.nio.HeapCharBuffer.(HeapCharBuffer.java:54) at java.nio.CharBuffer.wrap(CharBuffer.java:210) at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:265) at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125) at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207) at com.android.org.kxml2.io.KXmlSerializer.flushBuffer(KXmlSerializer.java:80) at com.android.org.kxml2.io.KXmlSerializer.append(KXmlSerializer.java:61) at com.android.org.kxml2.io.KXmlSerializer.append(KXmlSerializer.java:75) at com.android.org.kxml2.io.KXmlSerializer.startTag(KXmlSerializer.java:406) at com.github.uiautomator.stub.AccessibilityNodeInfoDumper.dumpNodeRec(AccessibilityNodeInfoDumper.java:88) at com.github.uiautomator.stub.AccessibilityNodeInfoDumper.dumpNodeRec(AccessibilityNodeInfoDumper.java:117) at com.github.uiautomator.stub.AccessibilityNodeInfoDumper.dumpNodeRec(AccessibilityNodeInfoDumper.java:117) at com.github.uiautomator.stub.AccessibilityNodeInfoDumper.dumpNodeRec(AccessibilityNodeInfoDumper.java:117) at com.github.uiautomator.stub.AccessibilityNodeInfoDumper.dumpNodeRec(AccessibilityNodeInfoDumper.java:117) at com.github.uiautomator.stub.AccessibilityNodeInfoDumper.dumpNodeRec(AccessibilityNodeInfoDumper.java:117) at com.github.uiautomator.stub.AccessibilityNodeInfoDumper.dumpNodeRec(AccessibilityNodeInfoDumper.java:117) at com.github.uiautomator.stub.AccessibilityNodeInfoDumper.dumpNodeRec(AccessibilityNodeInfoDumper.java:117) at com.github.uiautomator.stub.AccessibilityNodeInfoDumper.dumpNodeRec(AccessibilityNodeInfoDumper.java:117) at com.github.uiautomator.stub.AccessibilityNodeInfoDumper.dumpNodeRec(AccessibilityNodeInfoDumper.java:117) 还是有这个问题啊

codeskyblue commented 4 months ago

it should fixed now( I guess)