whatsapp 上的硒阅读重定向
selenium reading redirection on whatsapp
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox(executable_path='/home/geckodriver')
driver.get('https://web.whatsapp.com/')
#function to check weather qr code is scanned or not
您好,我正在尝试为 "wait" 编写一个函数,直到用户实际扫描 QR 码为止,即 return 如果他已登录则为 True,否则为 False。我检查了它是如何在网络选项卡中完成的,基本上它是一个 POST 到 WhatsApp 然后用户登录。
如果有其他方法可以做到这一点,我洗耳恭听。
将 WebDriverWait()
与 expected_conditions.invisibility_of_element_located()
一起使用:
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
WebDriverWait(driver, 60).until(EC.invisibility_of_element_located((By.CLASS_NAME, 'landing-window')))
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox(executable_path='/home/geckodriver')
driver.get('https://web.whatsapp.com/')
#function to check weather qr code is scanned or not
您好,我正在尝试为 "wait" 编写一个函数,直到用户实际扫描 QR 码为止,即 return 如果他已登录则为 True,否则为 False。我检查了它是如何在网络选项卡中完成的,基本上它是一个 POST 到 WhatsApp 然后用户登录。
如果有其他方法可以做到这一点,我洗耳恭听。
将 WebDriverWait()
与 expected_conditions.invisibility_of_element_located()
一起使用:
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
WebDriverWait(driver, 60).until(EC.invisibility_of_element_located((By.CLASS_NAME, 'landing-window')))