forked from Michelangelo27/chatgpt_selenium_automation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestthis.py
27 lines (20 loc) · 1.06 KB
/
testthis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from handler.chatgpt_selenium_automation import ChatGPTAutomation
# Define the path where the chrome driver is installed on your computer
# Typically, if you've installed it globally, it might be accessible without the full path.
# Otherwise, specify the full path to your chromedriver (e.g., "/Users/your_username/path_to_chromedriver/chromedriver")
chrome_driver_path = "//Users/muhammadarbabarshad/ChatGPT-Browser-Automation/chromedriver-mac-arm64/chromedriver"
# The path to the Google Chrome executable on macOS
chrome_path = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
# Create an instance
chatgpt = ChatGPTAutomation(chrome_path, chrome_driver_path)
# Define a prompt and send it to chatgpt
prompt = "What are the benefits of exercise?"
chatgpt.send_prompt_to_chatgpt(prompt)
# Retrieve the last response from ChatGPT
response = chatgpt.return_last_response()
print(response)
# Save the conversation to a text file
file_name = "conversation.txt"
chatgpt.save_conversation(file_name)
# Close the browser and terminate the WebDriver session
chatgpt.quit()