#🔒 I want to use a browser with python

11 messages · Page 1 of 1 (latest)

young pecan
#

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()`
forest iglooBOT
#

@young pecan

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

bitter ravine
#

yea no u wont be able to

#

chatgpt has bot prevention

#

also we wont help u even if it was possible

#

cuz

#

!rule 5

forest iglooBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

young pecan
forest iglooBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.