from lib2to3.pgen2 import driver
from time import sleep
import pickle
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from data import *
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.get(steam_link)
sleep(5)
for cookie in pickle.load(open(f"{username}_cookies", "rb")):
driver.add_cookie(cookie)
sleep(5)
driver.refresh()
sleep(10)
# driver.get(steam_link)
# driver.implicitly_wait(5)
# login_input.send_keys(username)
# sleep(5)
# password_input = driver.find_element(By.NAME, "password")
# password_input.send_keys(password)
# driver.find_element(By.XPATH, '//*[@id="imageLogin"]').click()
# self.xpath_exists("//input[@id = 'twofactorcode_entry']")
# # cookies
# pickle.dump(driver.get_cookies(), open(f"{username}_cookies", "wb"))
# def xpath_exists(self, param):
# 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()
bot = SteamBot()
if __name__ == "__main__":
bot.log_into_steam()
Нужно что-бы входило по кукам в стим. Как это сделать?