forked from TonyNguyenVn17/Food_Hunting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
35 lines (27 loc) · 1022 Bytes
/
config.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
28
29
30
31
32
33
34
35
from selenium import webdriver
from dotenv import load_dotenv
import os
load_dotenv()
CHROME_PROFILE_PATH = os.getenv('CHROME_PROFILE_PATH')
# How to find chrome profile
# https://www.howtogeek.com/255653/how-to-find-your-chrome-profile-folder-on-windows-mac-and-linux/
# For Linux
# CHROME_PROFILE_PATH = '/home/<username>/.config/google-chrome/Default'
SELE_HUB_URL = os.getenv('SELE_HUB_URL')
# You can either use your own Chrome Browser
# Or use the remote selenium Chrome for isolated environment
#! Using Local Chrome
options = webdriver.ChromeOptions()
options.add_argument(f'--user-data-dir={CHROME_PROFILE_PATH}')
driver = webdriver.Chrome(options)
#! using Remote Selenium
#! Mandatory when deployed on AWS
# from selenium.webdriver.chrome.options import Options
# import time
# time.sleep(10) # wait for the selenium hub to start properly
# options = Options()
# options.set_capability("browserName", "chrome")
# driver = webdriver.Remote(
# command_executor=SELE_HUB_URL,
# options=options
# )