页面内脚本的htmlunit 404错误 [英] htmlunit 404 error for scripts within page

查看:195
本文介绍了页面内脚本的htmlunit 404错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用htmlunit尝试打开网站,但我不断收到404错误.该网站可以在我的python脚本和浏览器中运行,但由于某些原因,不能在html单元中运行.我认为我的URL本身很好,但似乎正在该站点内打开另一个站点并失败了(example.com/SharedResources/Default/js/coda_bubble/jquery.codabubble.js)

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)

对于熟悉htmlunit的任何人,有什么方法可以使其不自动加载网站的其他区域?或更优雅地处理网站上的错误?

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?

非常感谢.

推荐答案

很抱歉,您在不进行大量研究的情况下就发布了.我想不通,一个精明的编程朋友向我指出了api,为了阻止这个错误,我不得不提出:

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)

起初我遇到了一些问题,但是当我在False中大写F之后,它就解决了.显示我对编程有多新.

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!

这篇关于页面内脚本的htmlunit 404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆