我正在尝试找到这些元素,我知道在此页面上有 12 个元素,但是在执行此代码时我无法找到它们。我开始发疯了,因为我不知道为什么用这种方法找不到元素...
import requests
from bs4 import BeautifulSoup
page = requests.get("https://www.coop.se/globalt-sok/butiker?
query=coop&page=1")
html = page.text
soup = BeautifulSoup(html, 'lxml')
buttons = soup.find_all('li', class_='body > main > div.js-
childLayoutContainer.u-marginTmd > div:nth-child(1) > div > div >
div > div > div > ol > li')
print(buttons)`