openatx / uiautomator2

Android Uiautomator2 Python Wrapper
MIT License
6.57k stars 1.4k forks source link

setter and getter clipboard #853

Closed moein-keyvani-pur closed 5 months ago

moein-keyvani-pur commented 1 year ago

get data from clipBoard and set data in clipboard not working

def run_app():
    d = u2.connect()
    # d.unlock()
    time.sleep(1)
    d.set_clipboard(text='Hello, World!')
    time.sleep(2)
    print(f'data is {d.clipboard}')

if __name__ == '__main__':
    run_app()

output is: data is None

mobile model: xiaomi 11t pro The version number of uiautomator2: 2.16.21

krasimvannu commented 1 year ago

Set pasteboard content or fetch content (currently known to be a problem that background programs after 9.0 cannot get clipboard content)'

moein-keyvani-pur commented 1 year ago

krasimvannu Thankful What is the alternative to this problem? How should I use the clipboard now?