Выбивает вот такие вот ошибки: Traceback (most recent call last):
File "C:\Users\XXX\PycharmProjects\pythonProject2\main.py", line 82, in
bot.log_into_steam()
File "C:\Users\XXX\PycharmProjects\pythonProject2\main.py", line 73, in log_into_steam
driver.find_element(By.CLASS_NAME, 'btn_green_white_innerfade').click()
File "C:\Users\XXX\PycharmProjects\pythonProject\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 856, in find_element
return self.execute(Command.FIND_ELEMENT, {
File "C:\Users\XXX\PycharmProjects\pythonProject\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 434, in execute
self.error_handler.check_response(response)
File "C:\Users\XXX\PycharmProjects\pythonProject\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".btn_green_white_innerfade"}
(Session info: chrome=104.0.5112.81)
Stacktrace:
Backtrace:
Ordinal0 [0x009078B3+2193587]
Ordinal0 [0x008A0681+1771137]
Ordinal0 [0x007B41A8+803240]
Ordinal0 [0x007E24A0+992416]
Ordinal0 [0x007E273B+993083]
Ordinal0 [0x0080F7C2+1177538]
Ordinal0 [0x007FD7F4+1103860]
Ordinal0 [0x0080DAE2+1170146]
Ordinal0 [0x007FD5C6+1103302]
Ordinal0 [0x007D77E0+948192]
Ordinal0 [0x007D86E6+952038]
GetHandleVerifier [0x00BB0CB2+2738370]
GetHandleVerifier [0x00BA21B8+2678216]
GetHandleVerifier [0x009917AA+512954]
GetHandleVerifier [0x00990856+509030]
Ordinal0 [0x008A743B+1799227]
Ordinal0 [0x008ABB68+1817448]
Ordinal0 [0x008ABC55+1817685]
Ordinal0 [0x008B5230+1856048]
BaseThreadInitThunk [0x763DFA29+25]
RtlGetAppContainerNamedObjectPath [0x77B67A9E+286]
RtlGetAppContainerNamedObjectPath [0x77B67A6E+238]
Process finished with exit code 1
как их исправить?
from time import sleep
import pyautogui
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium import webdriver
from data import *
running = True
options = webdriver.ChromeOptions()
options.add_argument(
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36')
options.add_argument("--disable-blink-features=AutomationControlled")
class SteamBot:
def __init__(self):
self.username = username
self.password = password
self.driver = webdriver.Chrome(executable_path=r'C:\Users\XXX\PycharmProjects\pythonProject2\chromedriver.exe')
def log_into_steam(self):
driver = self.driver
driver.get(steam_link)
driver.maximize_window()
driver.implicitly_wait(5)
login_input = driver.find_element(By.NAME, 'username')
login_input.send_keys(username)
sleep(1)
password_input = driver.find_element(By.NAME, 'password')
password_input.send_keys(password)
sleep(1)
driver.find_element(By.CLASS_NAME, 'btn_green_white_innerfade').click()
sleep(2)
self.xpath_exists("//input[@id = 'twofactorcode_entry']")
code = input("Type your Steam Guard code: ")
self.driver.find_element(By.XPATH, "//input[@id='twofactorcode_entry']").send_keys(code)
self.driver.find_element(By.CSS_SELECTOR, "div[type=submit]").click()
driver.implicitly_wait(10)
element = driver.find_element(By.XPATH, '/html/body/div[1]/header/div[2]/div/div/nav[1]/ul/li[2]/a')
# pyautogui.moveTo(262, 186)
action = ActionChains(driver)
action.move_to_element(element).click().perform()
sleep(1)
table = driver.find_element(By.CSS_SELECTOR,
'body > div.site-wrapper.clearfix > header > div.header__primary > div > div > nav:nth-child(2) > ul > li:nth-child(3) > div > div > div > div:nth-child(2) > div > ul > li:nth-child(2) > figure > a > img')
table.click()
driver.implicitly_wait(5)
driver.find_element(By.XPATH, '//*[@id="data-table"]/tbody/tr[1]/td[2]/div[1]/span[1]/b/span')
driver.find_element(By.XPATH, '//*[@id="data-table"]/tbody/tr[1]/td[3]/div/span[1]/b/span')
driver.find_element(By.XPATH, '//*[@id="scroll"]/div/div[1]/div[4]').click()
driver.find_element(By.XPATH, '//*[@id="scroll"]/div/div[2]/div[9]').click()
sleep(3)
driver.refresh()
driver.find_element(By.XPATH, '//*[@id="change1"]').click()
sleep(5)
newwindow = "window.open('https://steamcommunity.com/openid/login?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=checkid_setup&openid.return_to=https%3A%2F%2Fauthsb.trade%2Flootlogin.php&openid.realm=https%3A%2F%2Fauthsb.trade&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select')"
driver.execute_script(newwindow)
for item_el in range(1, 10):
name = driver.find_element(By.XPATH, f'//*[@id="data-table"]/tbody').text
print(name)
driver.find_element(By.CLASS_NAME, 'btn_green_white_innerfade').click()
driver.find_element(By.XPATH, '//*[@id="closeSubscribe"]').click()
def xpath_exists(self, param):
pass
bot = SteamBot()
if __name__ == "__main__":
bot.log_into_steam()