Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does nobybody needs this to open the browser with the current profile? #119

Open
c0dem0nke opened this issue Feb 11, 2024 · 2 comments
Open

Comments

@c0dem0nke
Copy link

c0dem0nke commented Feb 11, 2024

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
Copy link

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
Copy link

XHXIAIEIN commented Feb 17, 2024

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/')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants