Disable images in Selenium Google ChromeDriver

后端 未结 7 1345
悲哀的现实
悲哀的现实 2020-12-16 13:58

How does one disable images in Google chrome when using it through Selenium and c#?

I\'ve attempted 6 ways and none worked. I\'ve even tried the answer on this Stack

相关标签:
7条回答
  • 2020-12-16 14:45

    Use http://chrome-extension-downloader.com/ to download the "Block Image" extension (https://chrome.google.com/webstore/detail/block-image/pehaalcefcjfccdpbckoablngfkfgfgj?hl=en-GB). The extension prevents the image from being downloaded in the first place. Now it's just a matter of loading it using the following statement:

        var options = new ChromeOptions();
    
        //use the block image extension to prevent images from downloading.
        options.AddExtension("Block-image_v1.0.crx");
    
        var driver = new ChromeDriver(options);
    
    0 讨论(0)
提交回复
热议问题