简体   繁体   English

单击python selenium中的按钮

[英]click button in python selenium

html code my code how can click buton in this html code im using selenium. html 代码我的代码如何使用 selenium 在这个 html 代码中单击按钮。

I'm trying to writing a loop in my admin panel.我正在尝试在我的管理面板中编写一个循环。

first off that button does not have an id='button'首先那个按钮没有id='button'

without seeing the website you could try do something like:在没有看到网站的情况下,您可以尝试执行以下操作:

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

OR要么

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