Skip to content

Commit 644bd6a

Browse files
committed
Add a way to run Playwright headless.
1 parent 45512b6 commit 644bd6a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

computers/playwright/playwright.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414
import termcolor
1515
import time
16+
import os
1617
import sys
1718
from ..computer import (
1819
Computer,
@@ -88,11 +89,9 @@ def __enter__(self):
8889
print("Creating session...")
8990
self._playwright = sync_playwright().start()
9091
self._browser = self._playwright.chromium.launch(
91-
args=[
92-
'--disable-blink-features=AutomationControlled'
93-
],
94-
headless=False,
95-
)
92+
args=["--disable-blink-features=AutomationControlled"],
93+
headless=bool(os.environ.get("PLAYWRIGHT_HEADLESS", False)),
94+
)
9695
self._context = self._browser.new_context(
9796
viewport={
9897
"width": self._screen_size[0],

0 commit comments

Comments
 (0)