| 1 | from conf import LOCAL_CHROME_HEADLESS, LOCAL_CHROME_PATH |
| 2 | |
| 3 | def get_browser_options(): |
| 4 | options = { |
| 5 | 'headless': LOCAL_CHROME_HEADLESS, |
| 6 | 'args': [ |
| 7 | '--disable-blink-features=AutomationControlled', |
| 8 | '--lang=zh-CN', |
| 9 | '--disable-infobars', |
| 10 | '--start-maximized', |
| 11 | '--no-sandbox', |
| 12 | '--disable-web-security' |
| 13 | ] |
| 14 | } |
| 15 | if LOCAL_CHROME_PATH: |
| 16 | options['executable_path'] = LOCAL_CHROME_PATH |
| 17 | return options |
| 18 |