I'm attempting to login to a website using selenium and python. I'm using PyCharm for the IDE. I've found the class name for the login button, but when I search for and try to click it using:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
notsure=Service(r"C:\Users\kumpd\OneDrive\Desktop\Project\chromedriver_win32\chromedriver.exe")
website = "https://buff.market/market/goods/1?game=csgo"
path = r"C:\Users\kumpd\OneDrive\Desktop\Project\chromedriver_win32\chromedriver.exe"
driver = webdriver.Chrome(service=notsure)
driver.get(website)
time.sleep(10)
login = driver.find_element(By.CLASS_NAME, "w-button c-nav-sign w-button--primary w-button--l")
login.click()
driver.quit()
Here is the HTML from the website: enter image description here
I get the following error:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".w-button c-nav-sign w-button--primary w-button--l"}
Backtrace:
(No symbol) [0x0026DCE3]
(No symbol) [0x002039D1]
(No symbol) [0x00114DA8]
(No symbol) [0x0014019F]
(No symbol) [0x001403AB]
(No symbol) [0x0016EE62]
(No symbol) [0x0015AF14]
(No symbol) [0x0016D57C]
(No symbol) [0x0015ACC6]
(No symbol) [0x00136F68]
(No symbol) [0x001380CD]
GetHandleVerifier [0x004E3832+2506274]
GetHandleVerifier [0x00519794+2727300]
GetHandleVerifier [0x0051E36C+2746716]
GetHandleVerifier [0x00316690+617600]
(No symbol) [0x0020C712]
(No symbol) [0x00211FF8]
(No symbol) [0x002120DB]
(No symbol) [0x0021C63B]
BaseThreadInitThunk [0x76AE7D69+25]
RtlInitializeExceptionChain [0x77B0BB9B+107]
RtlClearBits [0x77B0BB1F+191]
(No symbol) [0x00000000]
Any idea why selenium can't find the button? Thanks for the help!
As you can see I did already try using time sleep to force the webpage to wait.