簡體   English   中英

單擊python selenium中的按鈕

[英]click button in python selenium

html 代碼我的代碼如何使用 selenium 在這個 html 代碼中單擊按鈕。

我正在嘗試在我的管理面板中編寫一個循環。

首先那個按鈕沒有id='button'

在沒有看到網站的情況下,您可以嘗試執行以下操作:

login_button = driver.find_element(By.TAG_NAME, 'button')
login_button.click() # this assumes that there are no other buttons on the page as find_element finds the first button on the page

要么

login_button = driver.find_element(By.CLASS_NAME, 'btn')
login_button.click() # this assumes that there are no other elements with the `btn` class to click

暫無
暫無

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

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