簡體   English   中英

使用python webdriver進行數據抓取

[英]Data scraping using python webdriver

代碼樣本

我正在嘗試使用Firefox單擊按鈕-Python-WebDriver

但是每次出現錯誤時:

selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: .pull-right show-toggle with-icon

我在這里想念什么嗎? 登錄並執行了幾步操作后,我到達了一頁,需要單擊具有以下班級名稱的按鈕。

child = driver.find_element_by_class_name('pull-right show-toggle with-icon')
child.click()

還有其他方法嗎?

按照提供的HTML片段,您可以單擊以下代碼來單擊按鈕:

from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait as wait

button = wait(driver, 10).until(EC.visibility_of_element_located((By.XPATH,"//a[@data-toggle-text='Hide details']")))
button.click()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM