簡體   English   中英

是否可以使用selenium來點擊這個按鈕?

[英]Is it possible to use selenium to click this button?

xpath 是正確的,我已經嘗試了兩種變體,但它返回 NoneType

from selenium import webdriver
from bs4 import BeautifulSoup
import time
import pyautogui

# Set up a webdriver instance using the Chrome browser
driver = webdriver.Chrome()

# Navigate to the staking page
driver.get('https://staking.chain.link/')

# Wait for the page to load
time.sleep(15)

# Find the "Next" button
next_button = driver.find_element_by_xpath('/html/body/div[1]/main/div/div[3]/div[3]/button[2]')

# Click the "Next" button to retrieve the next 10 results
next_button.click()

我希望能夠點擊顯示神諭答案的表格。 是否可以使用Selenium來點擊這個按鈕?

我也試過:

next_button = class_element= driver.find_element_by_class('button_secondary__WYcyn paragraph-100')

find_element_by_xpath 已在 Selenium 的較新版本中棄用

添加這個導入

from selenium.webdriver.common.by import By 

改變這一行

next_button = driver.find_element(By.XPATH, '/html/body/div[1]/main/div/div[3]/div[3]/button[2]')

https://selenium-python.readthedocs.io/

暫無
暫無

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

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