技术方案
python
selenium
先下载Microsoft Edge WebDriver
Microsoft Edge WebDriver 官网
先看一下自己的edge版本
搜索到版本然后下载自己的版本
安装依赖
pip install selenium
import time
from selenium import webdriverdriver = webdriver.Edge(executable_path=r"/Users/xiesi/Documents/Project/PythonDCD/edgedriver_mac64/msedgedriver",capabilities={},
)
r = driver.get("https://www.baidu.com")
print(driver.title)
time.sleep(10)
driver.quit()
已经抓到,但是需要解密
import time
from selenium import webdriverdriver = webdriver.Edge(executable_path=r"/Users/xiesi/Documents/Project/PythonDCD/edgedriver_mac64/msedgedriver",capabilities={},
)
r = driver.get("https://www.dongchedi.com/usedcar/9,10-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-3,5-x-x-x-x-420100-1-6-x-x-x-x"
)
print(driver.title)
time.sleep(10)
try:urllist = driver.find_elements_by_xpath("/html/body/div[1]/div/div[2]/div/div/div[2]/ul/li")print(len(urllist))for i in urllist:i2 = i.find_element_by_xpath("a/dl/dd[3]").textprint(i2)for i3 in i2:print(ord(i3))# /html/body/div[1]/div/div[2]/div/div/div[2]/ul/li[1]/a/dl/dd[3]/text()except Exception as e:print(e)driver.quit()