selenium获取结果转为json格式

from selenium import webdriver
from bs4 import BeautifulSoup


option = ChromeOptions()
option.add_experimental_option('excludeSwitches', ['enable-automation'])
driver = webdriver.Chrome(options=option)


Url = "http://www.XXXX.com"
driver.get(Url)
html = driver.page_source
soup = BeautifulSoup(html, 'lxml')
ss = soup.select('pre')[0]
res = json.loads(ss.text)
print(res)

 

你可能感兴趣的:(python,selenium)