1

Is it possible to prevent img and css download in phantomjs webdriver(selenium)?

Dmitrijs Zubriks
  • 2,696
  • 6
  • 22
  • 33

2 Answers2

2

If you check phantomjs API, an option can be passed as: --load-images=[true|false] load all inlined images (default is true). Also accepted: [yes|no].

However, you cannot block CSS download AFAIK.

Rafael I
  • 66
  • 6
0

If you are using HtmlUnitDriver on Java, you can use following method to modify the webclient options:

 @Override
    protected WebClient modifyWebClient(WebClient client) {
        client.getOptions().setCssEnabled(false);
        return client;
    }

hope this helps

Anudeep Samaiya
  • 1,910
  • 2
  • 28
  • 33