wangkun 2 vuotta sitten
vanhempi
commit
a4da7df923
1 muutettua tiedostoa jossa 13 lisäystä ja 1 poistoa
  1. 13 1
      main/zqttk_recommend.py

+ 13 - 1
main/zqttk_recommend.py

@@ -79,7 +79,19 @@ class Recommend:
             driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
             driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
             driver.implicitly_wait(20)
             driver.implicitly_wait(20)
             # 向下滑动页面,展示出小程序选择面板
             # 向下滑动页面,展示出小程序选择面板
-            time.sleep(20)
+            for i in range(120):
+                try:
+                    # 发现微信消息 TAB,代表微信已启动成功
+                    if driver.find_elements(By.ID, 'com.tencent.mm:id/f2s'):
+                        break
+                    # 发现并关闭系统菜单栏
+                    elif driver.find_element(By.ID, 'com.android.systemui:id/dismiss_view'):
+                        Common.logger(log_type).info('发现并关闭系统下拉菜单栏')
+                        driver.find_element(By.ID, 'com.android.systemui:id/dismiss_view').click()
+                    else:
+                        pass
+                except NoSuchElementException:
+                    time.sleep(1)
             Common.logger(log_type).info('下滑,展示小程序选择面板')
             Common.logger(log_type).info('下滑,展示小程序选择面板')
             size = driver.get_window_size()
             size = driver.get_window_size()
             driver.swipe(int(size['width'] * 0.5), int(size['height'] * 0.2), int(size['width'] * 0.5),
             driver.swipe(int(size['width'] * 0.5), int(size['height'] * 0.2), int(size['width'] * 0.5),