Python Selenium输出与浏览器中呈现的不同
我有以下代码:Python Selenium输出与浏览器中呈现的不同,python,selenium-webdriver,selenium-chromedriver,Python,Selenium Webdriver,Selenium Chromedriver,我有以下代码: from bs4 import BeautifulSoup from selenium import webdriver import pandas import time import requests PATH = "C:\Program Files (x86)\chromedriver.exe" options = webdriver.ChromeOptions() options.add_argument("--ignore-certif
from bs4 import BeautifulSoup
from selenium import webdriver
import pandas
import time
import requests
PATH = "C:\Program Files (x86)\chromedriver.exe"
options = webdriver.ChromeOptions()
options.add_argument("--ignore-certificate-errors")
options.add_argument("--incognito")
driver = webdriver.Chrome(options=options, executable_path=PATH)
URL = "https://www.lego.com/en-gb/themes/architecture"
driver.get(URL)
request = requests.get(URL)
soup = BeautifulSoup(request.content, "html.parser")
print(soup)
但是,输出的“Soup”与浏览器上呈现的页面内容不匹配。我可能错了,但Selenium不是要“呈现”动态网站吗?我只是缺少了一个标签还是什么?看起来它确实输出了页面内容。e、 g.
print(soup.find('h1').text)
输出与Selenium打开的页面的DOM相匹配的“架构”。也许可以在这个问题上添加一两个您期望的具体数据的例子?或者用这个来明确你的最终目标。