Skip to content

Commit

Permalink
demo for OffScreen rendering? #440
Browse files Browse the repository at this point in the history
  • Loading branch information
artur-trzesiok committed Jun 27, 2024
1 parent adfea08 commit 34c4e66
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions k3d/headless.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def generate():
return Response(msgpack.packb(diff, use_bin_type=True),
mimetype='application/octet-stream')

while self.browser.execute_script("return typeof(window.headlessK3D) !== 'undefined'") == False:
while self.browser.execute_script(
"return typeof(window.headlessK3D) !== 'undefined'") == False:
time.sleep(1)
self.browser.get(url="http://localhost:" + str(port) + "/headless.html")

Expand Down Expand Up @@ -136,8 +137,6 @@ def close(self):

def get_headless_driver(no_headless=False):
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager

options = webdriver.ChromeOptions()

Expand All @@ -146,5 +145,4 @@ def get_headless_driver(no_headless=False):
if not no_headless:
options.add_argument("--headless")

return webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()),
options=options)
return webdriver.Chrome(options=options)

0 comments on commit 34c4e66

Please sign in to comment.