Disable images in Selenium Python

前端 未结 4 1389
你的背包
你的背包 2020-12-05 05:38

Because Webdriver waits for the entire page to load before going on to the next line, I think disabling images, css and javascript will speed things up.

from         


        
4条回答
  •  半阙折子戏
    2020-12-05 06:33

    The accepted answer doesn't work for me either. From the "reason" links referred by kyrenia I gathered that Firefox overrides the "permissions.default.image" preference on the first startup and I was able to prevent that by doing:

    # Arbitrarily high number
    profile.set_preference('browser.migration.version', 9001)
    

    Which seems to be ok since I create the profile on each driver startup so there is nothing to actually be migrated.

提交回复
热议问题