Unable to load page resources with PhantomJS

前端 未结 1 1374
失恋的感觉
失恋的感觉 2021-02-10 16:22

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 17:03

    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)
提交回复
热议问题