Skip to content

Commit ed647d4

Browse files
authored
Merge pull request #5 from inganault/fix-new-selenium
Fix selenium internal API changes
2 parents 0aded26 + fabc26b commit ed647d4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pyhtml2pdf/converter.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ def __send_devtools(driver, cmd, params=None):
7676
if params is None:
7777
params = {}
7878
resource = "/session/%s/chromium/send_command_and_get_result" % driver.session_id
79-
url = driver.command_executor._url + resource
79+
if hasattr(driver.command_executor, '_client_config'):
80+
remote_url = driver.command_executor._client_config.remote_server_addr
81+
else:
82+
# Old internal API
83+
remote_url = driver.command_executor._url
84+
url = remote_url + resource
8085
body = json.dumps({"cmd": cmd, "params": params})
8186
response = driver.command_executor._request("POST", url, body)
8287

@@ -88,7 +93,6 @@ def __send_devtools(driver, cmd, params=None):
8893

8994
def __get_pdf_from_html(
9095
source: Union[str, io.BytesIO], timeout: int, install_driver: bool, print_options: dict
91-
):
9296
) -> bytes:
9397
webdriver_options = Options()
9498
webdriver_prefs = {}

0 commit comments

Comments
 (0)