如何在python中使用硒和beautifulsoup单击元素?我得到了这些代码行,发现很难实现。我想单击每个迭代中的每个元素。没有分页或下一页。只有大约10个元素,单击最后一个元素后,它应该停止。有谁知道我该怎么办。这是我的代码
Background Events
这是站点。我想在每个平面图部分中抓取详细信息和图像,但是这很困难,因为仅在单击特定元素后才会显示图像。除了图像本身,我只能得到详细信息。自己尝试一下,以便您了解我的意思。
编辑: 我尝试过这种方法
slotEventOverlap:false,
问题是单击速度太快,导致图像无法加载。而且我在这里使用硒。是否有类似选择from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
import urllib
import urllib.request
from bs4 import BeautifulSoup
chrome_path = r"C:\chromedriver.exe"
driver = webdriver.Chrome(chrome_path)
url = 'https://www.99.co/singapore/condos-apartments/a-treasure-trove'
driver.get(url)
html = driver.page_source
soup = BeautifulSoup(html,'lxml')
details = soup.select('.FloorPlans__container__rwH_w') //Whole container of the result
for d in details:
picture = d.find('span',{'class':'Tappable-inactive'}).click() //the single element.
print(d)
driver.close()
这样的beautifulsoup的方法?