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

update to selenium 4.11+ Webdriver init code #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pdfoid/backends/direct.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import base64
from contextlib import closing

from selenium.webdriver.chrome.service import Service
from tornado import gen
from tornado.process import Subprocess

from pdfoid.utils import utf8bytes, utf8text

Expand Down Expand Up @@ -78,11 +78,12 @@ def get_log(self, driver):

@gen.coroutine
def html_to_pdf(self, *, header_template, footer_template, wait_for):
service = Service(executable_path=self.backend.chromedriver_path)
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.binary_location = self.backend.chrome_path

browser = webdriver.Chrome(self.backend.chromedriver_path, options=options)
browser = webdriver.Chrome(service=service, options=options)
with closing(browser):
browser.get('file://%s' % self.input_html_file)

Expand Down