[英]how can i click this element on the discord page with selenium in python?
Discord Element To Click要单击的不和谐元素
I am trying to click the button on the discord login page, i have tried finding the class however the class is random every session i believe and i have tried finding the ID but it does not have an ID.我正在尝试单击不和谐登录页面上的按钮,我尝试查找课程,但是我相信每个会话都是随机的,我尝试查找 ID,但它没有 ID。
My goal is to insert text (i've done that already) and click the "Login" button我的目标是插入文本(我已经这样做了)并单击“登录”按钮
import selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
driver = webdriver.Chrome(r"C:/Users/sexyv/Downloads/chromedriver_win32/chromedriver.exe")
driver.get("https://discord.com/login")
email_box = driver.find_element(by=By.NAME, value="email")
password_box = driver.find_element(by=By.NAME, value="password")
submit_button = driver.find_element(by=By.ID, value="login-button")
def login(driver, email_box, password_box):
driver.implicitly_wait(3)
driver.implicitly_wait(5)
email_box.send_keys("johnsonkalel15@gmail.com")
password_box.send_keys("Kalel12345shjd")
login(driver=driver,email_box=email_box, password_box=password_box)```
If you want to click
on login
button use the below locator and click on it.如果您想click
login
按钮,请使用下面的定位器并单击它。
CSS Selector CSS 选择器
button[type='submit']
OR XPATH或 XPATH
//button[@type='submit']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.