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)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章