Does nobybody needs this to open the browser with the current profile?
c0dem0nke opened this issue · 2 comments
c0dem0nke commented
is there a way to start chrome with my current Default profile?
it's useless for the most of my tasks when it opens the browser with a new and empty profile
VISWESWARAN1998 commented
def start_chrome(url=None, headless=False, maximize=False, options=None):
"""
:param url: URL to open.
:type url: str
:param headless: Whether to start Chrome in headless mode.
:type headless: bool
:param maximize: Whether to maximize the Chrome window.
Ignored when `headless` is set to `True`.
:type maximize: bool
:param options: ChromeOptions to use for starting the browser
:type options: :py:class:`selenium.webdriver.ChromeOptions`
I believe start_chrome
function accepts an argument named options where you can specify your chrome options!
XHXIAIEIN commented
import os
from helium import *
from selenium.webdriver import Chrome, ChromeOptions
from selenium.webdriver.chrome.service import Service as ChromeService
def launch_webdriver():
ROOTPATH = os.path.join(os.path.expanduser("~"), "Desktop", "2024")
DOWNLOAD_FOLDER = os.path.join(ROOTPATH,'download')
USERDATA_FOLDER = os.path.join(ROOTPATH,'selenium')
prefs = {
'download.directory_upgrade': True,
'download.prompt_for_download': 'false',
'profile.default_content_settings.multiple-automatic-downloads': 1,
'download.default_directory': DOWNLOAD_FOLDER
}
options = ChromeOptions()
options.add_argument('--user-data-dir={}'.format(USERDATA_FOLDER))
options.add_argument('--window-size=960,1200')
options.add_argument('--disable-remote-fonts')
options.add_argument('--hide-scrollbars')
chromedriver_path = 'chromedriver.exe'
service = ChromeService(executable_path=chromedriver_path)
driver = Chrome(options=options, service=service)
set_driver(driver)
go_to('https://www.google.com/')