Hello world
I was curios if I could operate a chat in chatgpt over my terminal and input my question in the terminal and get the response there. I know there are API's but this is just to test the waters.
I tried doing this with selenium, but every time that the code started a tab I was always logged out. I tried using the profile path in google chrome to stay logged in, but I can't manage to make it work. every time then code runs it opens google chrome but as user 1 and not as the account I gave it the path to.
Does anyone have experience with selenium and could help me out?
Current code:
`import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
def start_chrome_with_profile(profile_path):
chrome_options = Options()
chrome_options.add_argument("user-data-dir=" + profile_path) # Specify the path to the profile directory
chrome_options.add_argument("--start-maximized") # Maximize the browser window
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
driver = webdriver.Chrome(options=chrome_options)
return driver
if name == "main":
# Provide the path to the Chrome profile directory
profile_path = r"C:\Users\andre\AppData\Local\Google\Chrome\User Data\Profile 1"
driver = start_chrome_with_profile(profile_path)
# Let the browser stay open for 10 seconds
time.sleep(10)
# Close the browser
driver.quit()`