繁体   English   中英

如何从 web whatsapp 中提取此信息; 使用 python 和 selenium

[英]How can extract this information from web whatsapp; using python and selenium

来自一组的数字

团体

大家好我希望你们好。 我想使用 selenium 从 webwhatsapp 中提取这些数字

这是我的代码:

from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

import os

dir_path = os.getcwd()
profile = os.path.join(dir_path, "profile", "wpp")
s=Service('chromedriver.exe')
op = webdriver.ChromeOptions()
op.add_experimental_option('excludeSwitches', ['enable-logging'])
op.add_argument(
    r"user-data-dir={}".format(profile))


driver = webdriver.Chrome(service=s, options=op)

url='https://web.whatsapp.com'
driver.get(url)

numbers=driver.find_element(By.CLASS_NAME, "zzgSd _3e6xi").text
print(numbers)

但这不起作用。 请帮我!!

右键单击检查浏览器中的元素并复制选择器路径CSS_选择器

在 selenium 中使用numbers = driver.find_element_by_css_selector('#paste the path').text

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM