Unable to load page resources with PhantomJS

前端 未结 1 1413
谎友^
谎友^ 2021-02-10 16:06

I\'m using PhantomJS to get page content for given URL. The problem is that on some pages PhantomJS can not load some resources (js, css...), and the error I\'m getting is:

1条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-10 16:42

    For coders who come across this page during their quest to find an solution for resources not completely loading on phantomjs. I had a project where the script would stall/hang on a few resources. It was 50/50 if it would execute or not.

    Some digging and I found the following page: https://github.com/ariya/phantomjs/issues/10652

    Where the solution to set an timeout for resources was working out for me:

    page.settings.resourceTimeout = 10000;
    

    In regards to the above question I am not sure if this is completely appropiate but at least the information is easier to find now and can be regarded part of an solution to some.

    0 讨论(0)
提交回复
热议问题