如何使用pythonselenium获取css伪元素内容

2024-06-29 01:08:10 发布

您现在位置:Python中文网/ 问答频道 /正文

enter image description here

如何使用selenium定位伪元素? 我想要的输出是地址“http://www.meishij.net/alldish.php?内径=1799616”。在


Tags: 定位imagehttp元素nethere地址www
1条回答
网友
1楼 · 发布于 2024-06-29 01:08:10

为什么不试试BeautifulSoup

import requests 
from bs4 import BeautifulSoup
pages = requests.get('http://www.meishij.net/zuofa/qingjiaosansi.html')
soup =BeautifulSoup(pages.content, 'html.parser')
result = soup.find('a',{'title':"青椒三丝"}).get('href')
print(result)

result将是:

^{pr2}$

相关问题 更多 >