How to use the uiautomator2.xpath.XPath function in uiautomator2

To help you get started, we’ve selected a few uiautomator2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openatx / uiautomator2 / uiautomator2 / xpath.py View on Github external
def init():
    uiautomator2.plugin_register("xpath", XPath)
github openatx / uiautomator2 / uiautomator2 / xpath.py View on Github external
"-P", "{0}x{1}@{0}x{1}/{2}".format(w, h, r), 
            "-s", ">"+remote_image_path])

        if d.sync.stat(remote_image_path).size == 0:
            raise RuntimeError("screenshot using minicap error")
        
        buf = io.BytesIO()
        for data in d.sync.iter_content(remote_image_path):
            buf.write(data)
        return Image.open(buf)



if __name__ == "__main__":
    d = AdbUI(adbutils.adb.device())
    xpath = XPath(d)
    # print(d.screenshot())
    # print(d.dump_hierarchy()[:20])
    xpath("App").click()
    xpath("Alarm").click()
    # init()
github openatx / uiautomator2 / uiautomator2 / __init__.py View on Github external
def xpath(self) -> xpath.XPath:
        return xpath.XPath(self)