javaweb-scrapinghtmlunit

htmlunit 404 error for scripts within page


i am using htmlunit to try to open a site but I keep getting 404 errors. The site works in my python scripts and in my browser but not in html unit for some reason. I think my URL itself is fine but it seems to be opening another site within the site and failing (example.com/SharedResources/Default/js/coda_bubble/jquery.codabubble.js)

For anyone familiar with htmlunit, is there any way to get it not to automatically load these other areas of the site? or more gracefully handle errors on the site?

Thanks so much in advance.


Solution

  • ok sorry for posting without researching very heavy. I couldn't figure it out and a savy programming friend pointed me to the api and to stop this error I had to put:

    webclient.setThrowExceptionOnFailingStatusCode(False)
    

    I had some problems at first but after I capitalized the F in False, it worked out. Shows how new I am to programming.

    Thanks everyone and I hope it helps!