File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 55
66def 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
You can’t perform that action at this time.
0 commit comments