Home > Blockchain >  how can i click this element on the discord page with selenium in python?
how can i click this element on the discord page with selenium in python?

Time:06-14

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.

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("[email protected]")
    password_box.send_keys("Kalel12345shjd")
    


login(driver=driver,email_box=email_box, password_box=password_box)```

CodePudding user response:

If you want to click on login button use the below locator and click on it.

CSS Selector

button[type='submit']

OR XPATH

//button[@type='submit']
  • Related