feat: add FacebookBot class to automate comment posting using uiautomator2
This commit is contained in:
@@ -123,17 +123,23 @@ class FacebookBot:
|
|||||||
done_btn = self.d(textContains="Xong")
|
done_btn = self.d(textContains="Xong")
|
||||||
if not done_btn.exists:
|
if not done_btn.exists:
|
||||||
done_btn = self.d(textContains="Done")
|
done_btn = self.d(textContains="Done")
|
||||||
|
|
||||||
if done_btn.exists:
|
if done_btn.exists:
|
||||||
done_btn.click()
|
done_btn.click()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
else:
|
else:
|
||||||
logging.warning("Không tìm thấy nút đính kèm ảnh, sẽ chỉ gửi text.")
|
# 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
|
# Tìm nút "Gửi" (Send)
|
||||||
logging.info("Bấm nút Gửi (Send)...")
|
logging.info("Tìm nút Gửi...")
|
||||||
send_btn = self.d(descriptionContains="Gửi")
|
send_btn = self.d(descriptionMatches="(?i)^gửi$")
|
||||||
if not send_btn.exists:
|
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:
|
if send_btn.exists:
|
||||||
send_btn.click()
|
send_btn.click()
|
||||||
|
|||||||
Reference in New Issue
Block a user