diff --git a/serverPython/facebook_bot.py b/serverPython/facebook_bot.py index fc44461..0e82c5c 100644 --- a/serverPython/facebook_bot.py +++ b/serverPython/facebook_bot.py @@ -123,17 +123,23 @@ class FacebookBot: done_btn = self.d(textContains="Xong") if not done_btn.exists: done_btn = self.d(textContains="Done") + if done_btn.exists: done_btn.click() time.sleep(1) - else: - logging.warning("Không tìm thấy nút đính kèm ảnh, sẽ chỉ gửi text.") + else: + # Nếu không có nút Xong, bấm Back để gập cái thư viện ảnh lại, vì nó đang che khuất nút Gửi! + logging.info("Không có nút Xong, gập thư viện ảnh xuống...") + self.d.press("back") + time.sleep(1.5) - # Bấm gửi - logging.info("Bấm nút Gửi (Send)...") - send_btn = self.d(descriptionContains="Gửi") + # Tìm nút "Gửi" (Send) + logging.info("Tìm nút Gửi...") + send_btn = self.d(descriptionMatches="(?i)^gửi$") if not send_btn.exists: - send_btn = self.d(descriptionContains="Send") + send_btn = self.d(descriptionMatches="(?i)^send$") + if not send_btn.exists: + send_btn = self.d(descriptionContains="Gửi") if send_btn.exists: send_btn.click()