Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
189 views
in Technique[技术] by (71.8m points)

javascript - PhantomJS doesn't load the entire page with enough time

(I am sorry that for the credential reason, I am not able to share the code)

I am trying to use PhantomJS to simulate a user visits a web page. The page is only loaded partially (only the navigation bar is loaded). It is also weird that the layout looks pretty weird than expected comparing the screenshot (page.render()) to the web page opened via browser manually. I initially thought it was because I need to wait for more time/the page hasn't finished loading; however, after extending the waiting time to 300 seconds it still didn't load. Also, even though the page doesn't look like loaded entirely, I am able to click the buttons on the navigation part. May I ask for any potential solutions?

Several things I have tried:

  1. Tried to utilize onRequestReceived(), on RequestRequested() and all other event listener.
  2. Tried to wait for a long time.
  3. Tried running script with --ignore-ssl-errors=true --web-security=no
  4. 'status' is not failed.
  5. Currently I suspect maybe there are some JS files in that html are not imported correctly but not sure if this is the correct direction to investigate. Any suggestion on this maybe how to verify which js files were not imported? I tried to print all requested resources and noticed some are missing comparing to the Network list under Inspect Element tool of the browser.

One thing worth mention is that I tried to use Selenium to do the same thing and the page was loaded perfectly, so there's no issue with the url/html itself. (We prefer to still use PhantomJS due to some scenarios.)

Tech: PhantomJS 2.1.1

Thanks for any advice!

question from:https://stackoverflow.com/questions/65931425/phantomjs-doesnt-load-the-entire-page-with-enough-time

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...