Appium2 uses python to operate the simulator installed in the wechat software automation driver.find_elements(By.CLASS_NAME, “android.widget.Button”)

There is no problem with the automatic operation in front of the program, only here there are always 500 exceptions, and there is no problem with loading.

# 查找所有android.widget.Button的text

      def find_elements_with_retry(driver, by, value, retries=3, delay=5):
          for attempt in range(retries):
              try:
                  elements = driver.find_elements(by, value)
                  if elements:
                      return elements
              except Exception as e:
                  logging.error(f"Error finding elements: {str(e)}")
              time.sleep(delay)
          return []

        elements = find_elements_with_retry(driver, By.CLASS_NAME, "android.widget.Button")

Error reported as follows:

[da50e1b9][HTTP] --> POST /session/da50e1b9-f1d3-43c0-9bca-5d6c52cc333e/elements {"using":"class name","value":"android.widget.Button"}
[da50e1b9][AndroidUiautomator2Driver@5d3b] Calling AppiumDriver.findElements() with args: ["class name","android.widget.Button","da50e1b9-f1d3-43c0-9bca-5d6c52cc333e"]
[da50e1b9][AndroidUiautomator2Driver@5d3b] Valid locator strategies for this request: xpath, id, class name, accessibility id, css selector, -android uiautomator
[da50e1b9][AndroidUiautomator2Driver@5d3b] Waiting up to 60000 ms for condition
[da50e1b9][AndroidUiautomator2Driver@5d3b] Matched '/elements' to command name 'findElements'
[da50e1b9][AndroidUiautomator2Driver@5d3b] Proxying [POST /elements] to [POST http://127.0.0.1:8203/session/f5381813-6ee5-4026-b7d0-e74f1eebd95a/elements] with body: {"strategy":"class name","selector":"android.widget.Button","context":"","multiple":true}
[a5a88ae7][HTTP] --> GET /session/a5a88ae7-dc12-4d55-a66b-bb46f6e36b8c/timeouts {}
[a5a88ae7][AppiumDriver@248e] Encountered internal error running command: NoSuchDriverError: A session is either terminated or not started
    at asyncHandler (D:devnvmv22.2.0node_modulesappiumnode_modules@appiumbase-driverlibprotocolprotocol.js:309:15)
[a5a88ae7][HTTP] <-- GET /session/a5a88ae7-dc12-4d55-a66b-bb46f6e36b8c/timeouts 404 2 ms - 2835
[da50e1b9][AndroidUiautomator2Driver@5d3b] Got response with status 500: {"sessionId":"f5381813-6ee5-4026-b7d0-e74f1eebd95a","value":{"error":"unknown error","message":"Timed out after 15527ms waiting for the root AccessibilityNodeInfo in the active window. Make sure the active window is not constantly hogging the main UI thread (e.g. the application is being idle long enough), so the accessibility manager could do its work","stacktrace":"io.appium.uiautomator2.common.exceptions.UiAutomator2Exception: Timed out after 15527ms waiting for the root AccessibilityNodeInfo in the active window. Make sure the active window is not constantly hogging the main UI thread 
[da50e1b9][HTTP] <-- POST /session/da50e1b9-f1d3-43c0-9bca-5d6c52cc333e/elements 500 15544 ms - 4613

Environment

[Appium] Welcome to Appium v2.11.1
[Appium] The autodetected Appium home path: C:Users13320.appium
[Appium] Attempting to load driver uiautomator2...
[Appium] Requiring driver at C:Users13320.appiumnode_modulesappium-uiautomator2-driverbuildindex.js
[Appium] AndroidUiautomator2Driver has been successfully loaded in 2.347s
[Appium] Appium REST http interface listener started on http://0.0.0.0:4723
[Appium] Available drivers:
[Appium]   - [email protected] (automationName 'UiAutomator2')

New contributor

quiet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật