-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp_example.py
More file actions
25 lines (19 loc) · 687 Bytes
/
Copy pathapp_example.py
File metadata and controls
25 lines (19 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import json
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
def lambda_handler(event, context):
options = Options()
options.binary_location = '/opt/headless-chromium'
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--single-process')
options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome('/opt/chromedriver',chrome_options=options)
driver.get('https://www.google.com/')
body = f"Headless Chrome Initialized, Page title: {driver.title}"
driver.close();
driver.quit();
return {
"statusCode": 200,
"body": body
}