Skip to content

Commit a11c8f8

Browse files
committed
Revert "Revert "Using new Service object instead of deprecated execution_path""
This reverts commit 35c66c6.
1 parent bb0ac51 commit a11c8f8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
def handler(event=None, context=None):
77
options = webdriver.ChromeOptions()
8+
service = webdriver.ChromeService("/opt/chromedriver")
9+
810
options.binary_location = '/opt/chrome/chrome'
911
options.add_argument('--headless')
1012
options.add_argument('--no-sandbox')
@@ -18,7 +20,8 @@ def handler(event=None, context=None):
1820
options.add_argument(f"--data-path={mkdtemp()}")
1921
options.add_argument(f"--disk-cache-dir={mkdtemp()}")
2022
options.add_argument("--remote-debugging-port=9222")
21-
chrome = webdriver.Chrome("/opt/chromedriver",
22-
options=options)
23+
24+
chrome = webdriver.Chrome(options=options, service=service)
2325
chrome.get("https://example.com/")
26+
2427
return chrome.find_element(by=By.XPATH, value="//html").text

0 commit comments

Comments
 (0)