-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_profile.py
More file actions
47 lines (39 loc) · 1.54 KB
/
Copy pathsetup_profile.py
File metadata and controls
47 lines (39 loc) · 1.54 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import os
import sys
import undetected_chromedriver as uc
from selenium.webdriver.chrome.options import Options
import time
def setup_chrome_profile():
print("="*50)
print(" 🛠️ CHROME PROFILE SETUP WIZARD")
print("="*50)
print("This script will open a persistent Chrome browser.")
print("Please manually log into all necessary accounts (Pinterest, Facebook, Medium, etc.).")
print("When you are done logging in, completely CLOSE the browser window.")
print("="*50)
print("\nPress ENTER to launch the browser...")
input()
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
USER_DATA_DIR = os.path.join(BASE_DIR, "ChromeProfile")
if not os.path.exists(USER_DATA_DIR):
os.makedirs(USER_DATA_DIR)
options = Options()
options.add_argument(f"--user-data-dir={USER_DATA_DIR}")
try:
driver = uc.Chrome(options=options)
driver.get("https://www.google.com")
print("✅ Browser Launched! Please log in to your accounts.")
print("Waiting for browser to be closed manually...")
# Wait until the user closes the browser
while True:
try:
_ = driver.title
time.sleep(1)
except Exception:
# Browser is closed
break
print("\n✅ Profile Saved Successfully! You can now run the agent.")
except Exception as e:
print(f"\n❌ Error launching Chrome: {e}")
if __name__ == "__main__":
setup_chrome_profile()