How to disable javascript in Chrome Driver Selenium Python

前端 未结 4 1955
不知归路
不知归路 2020-12-16 08:00

How can I disable Java Script in Selenium\'s Chrome Driver using python

4条回答
  •  渐次进展
    2020-12-16 08:56

    Disabling JavaScript in Chrome is possible with old ChromeDriver prior to ChromeDriver2, which only supports Chrome 28 or under. try as below :-

    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    
    chrome_options = Options()
    chrome_options.add_argument("--disable-javascript")
    driver = webdriver.Chrome(chrome_options=chrome_options)
    

    WARNING: Running without JavaScript is unsupported and will likely break a large portion of the ChromeDriver's functionality. I suspect you will be able to do little more than navigate to a page. This is NOT a supported use case, and we will not be supporting it.

    Hope it will help you...:)

提交回复
热议问题