|
10 | 10 | # and if it doesn't exist, download it automatically, |
11 | 11 | # then add chromedriver to path |
12 | 12 |
|
13 | | -chrome_options = webdriver.ChromeOptions() |
14 | | -# Add your options as needed |
| 13 | +chrome_options = webdriver.ChromeOptions() |
| 14 | +# Add your options as needed |
15 | 15 | options = [ |
16 | | - # Define window size here |
17 | | - "--window-size=1200,1200", |
| 16 | + # Define window size here |
| 17 | + "--window-size=1200,1200", |
18 | 18 | "--ignore-certificate-errors" |
19 | 19 |
|
20 | 20 | #"--headless", |
21 | | - #"--disable-gpu", |
22 | 21 | #"--window-size=1920,1200", |
23 | 22 | #"--ignore-certificate-errors", |
24 | 23 | #"--disable-extensions", |
25 | | - #"--no-sandbox", |
26 | | - #"--disable-dev-shm-usage", |
27 | | - #'--remote-debugging-port=9222' |
| 24 | + # These flags BELOW are recommended for stability when running Chrome in headless or containerized environments (such as GitHub Actions). |
| 25 | + "--disable-gpu", |
| 26 | + "--no-sandbox", |
| 27 | + "--disable-dev-shm-usage", |
| 28 | + '--remote-debugging-port=9222' |
28 | 29 | ] |
29 | | - |
30 | 30 | for option in options: |
31 | 31 | chrome_options.add_argument(option) |
32 | 32 |
|
|
37 | 37 | print(driver.title) |
38 | 38 | with open('./GitHub_Action_Results.txt', 'w') as f: |
39 | 39 | f.write(f"This was written with a GitHub action {driver.title}") |
40 | | - |
0 commit comments