Data Science/Python
[python] Chrome web-driver options : speed up page loading.
DS-9VM
2023. 1. 31. 02:16
728x90
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from webdriver_manager.chrome import ChromeDriverManager
options = webdriver.ChromeOptions()
options.add_argument("--disable-extensions")
options.add_argument("--disable-gpu")
options.add_argument("--disable-infobars")
options.add_argument("--disable-notifications")
options.add_argument("--disable-popup-blocking")
options.add_argument("--disable-web-security")
options.add_argument("--start-maximized")
options.add_argument("--ignore-certificate-errors")
options.add_argument("--no-sandbox")
options.add_argument("--headless")
driver = webdriver.Chrome(options=options)
webdriver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
#...
These options disable various features in Chrome that can slow down page loading, such as extensions, notifications, and popup blocking. The --headless option runs Chrome in a headless mode, which means it runs in the background without opening a graphical user interface, which can also speed up page loading. Note that some of these options may not be suitable for all use cases and may affect the stability and security of your test environment.
Keep in mind that page loading time is also influenced by factors outside of the control of the web driver, such as the speed of the network connection, the size and complexity of the page, and the load on the server hosting the page.
728x90