<div id="start" class="btn btn-huge btn-success"><i class="fas fa-power-off"></i> Start</div>
This is the HTML code line in the view source of a website. It is the code line for a start button that is on the website. I am using selenium with python and i want to locate this start button and click it. I have tried to use the following:
browser.find_element_by_css_selector("div.btn btn-huge btn-success").click()
browser.find_element_by_id("start").click()
and the .find_element_by_xpath()
method too.. but none of them seem to work. I dont know if the code is able to locate that start button or not, but it is not clicking it so i am assuming that it is not locating it.. please tell me how i should fix this.. :) this is my complete code:
import undetected_chromedriver as uc
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import time
browser = uc.Chrome()
browser.get('https://aternos.org/server/devialcraft')
browser.refresh()
time.sleep(1)
username = browser.find_element_by_id("user")
username.clear()
username.send_keys("Not_Breadbutter")
time.sleep(2)
password = browser.find_element_by_id("password")
password.clear()
password.send_keys("my_password")
time.sleep(2)
browser.find_element_by_id("login").click()
browser.refresh()
browser.refresh()
browser.find_element_by_css_selector("div.server-name").click()
#This is the line where i am locating that button:
time.sleep(1)
browser.find_element_by_css_selector("div.btn btn-huge btn-success").click()
time.sleep(9)
browser.quit()