Created
April 12, 2020 13:53
-
-
Save prince-mishra/da5a57fc4d65f355ccc28be54dd1af9e to your computer and use it in GitHub Desktop.
Options to make Chrome Webdriver work in headless mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| chrome_options = webdriver.ChromeOptions() | |
| chrome_options.add_argument("--no-sandbox") | |
| chrome_options.add_argument("--disable-dev-shm-usage") | |
| chrome_options.add_experimental_option("detach", True) | |
| chrome_options.add_argument("--disable-infobars") | |
| chrome_options.headless = True | |
| chrome_options.add_argument("--single-process") | |
| chrome_options.add_argument("--remote-debugging-port=9222") | |
| chrome_options.add_argument("--user-data-dir=/home/mishraprince/chrome-data") | |
| chrome_options.add_experimental_option("prefs", { | |
| "profile.default_content_setting_values.notifications": 2 # 1:allow, 2:block | |
| }) | |
| driver = webdriver.Chrome(options=chrome_options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment