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

Ability to launch chromedriver in headless mode #212

Open
arkochhar opened this issue Jul 31, 2018 · 0 comments
Open

Ability to launch chromedriver in headless mode #212

arkochhar opened this issue Jul 31, 2018 · 0 comments

Comments

@arkochhar
Copy link

Sample code that I changed to get this running of Linux server (with no GUI)

    def _get_Chrome(self):
        try:
            #service_log_path = 'chromedriver.log'
            #service_args = ['--verbose']
            chrome_ops = webdriver.ChromeOptions()
            chrome_ops.add_argument('--headless')
            chrome_ops.add_argument('--no-sandbox')
            if self.proxy:
                chrome_ops.add_argument(
                    '--proxy-server={}://{}:{}'.format(self.proxy.proto, self.proxy.host, self.proxy.port))
            self.webdriver = webdriver.Chrome(chrome_options=chrome_ops) #, service_args=service_args, service_log_path=service_log_path)
            #else:
            #    self.webdriver = webdriver.Chrome()#service_log_path='/tmp/chromedriver_log.log')
            return True
        except WebDriverException as e:
            # we don't have a chrome executable or a chrome webdriver installed
            raise
        return False

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

1 participant