diff --git a/tasks/douyin/__init__.py b/tasks/douyin/__init__.py index 3e8dd76..19e504a 100644 --- a/tasks/douyin/__init__.py +++ b/tasks/douyin/__init__.py @@ -2,9 +2,11 @@ from uiautomator2 import Device def click_search_icon(d: Device): - (d - .xpath('//*[@resource-id="com.ss.android.ugc.aweme:id/ybv"]/android.widget.Button[1]/android.widget.FrameLayout[1]') - .click()) + selector = d.xpath('//*[@resource-id="com.ss.android.ugc.aweme:id/ybv"]/android.widget.Button[' + '1]/android.widget.FrameLayout[1]') + if selector.exists: + selector.click() + def input_search_text(d: Device, text: str): (d