PhantomJS 网络驱动程序无法加载 url

PhantomJS webdriver can't load url

我使用 phantomjs webdriver 来实现 RPA。它尝试使用此代码加载一个 url:

webDriver.get(url);

问题是我可以手动转到此 url(只需将其复制到我在浏览器中的地址行)。它加载正常。但是到了phantomjs,就加载不出来了。我认为它可能与 ssl 协议有关,所以为 phantomjs 设置这些选项:

--ignore-ssl-errors=true
--ssl-protocol=any
--web-security=true

还是一样。在调试模式下,我在尝试加载 url:

时得到以下日志
[DEBUG] HTTP Request - URI /session/1ed10cc0-ddc6-11e8-87f5-2f782befb71d/url
[DEBUG] HTTP Request - Method POST
[DEBUG] HTTP Request - HTTP Version 1.1
[DEBUG] HTTP Request - Query String 
[DEBUG] HTTP Request - Receiving Header "Accept" = "application/json, image/png"
[DEBUG] HTTP Request - Receiving Header "Content-Type" = "application/json; charset=utf-8"
[DEBUG] HTTP Request - Receiving Header "Content-Length" = "141"
[DEBUG] HTTP Request - Receiving Header "Host" = "localhost:64560"
[DEBUG] HTTP Request - Receiving Header "Connection" = "Keep-Alive"
[DEBUG] HTTP Request - Method POST/PUT
[DEBUG] HTTP Request - Content Body: {"url":"myHiddenUrl"}
[DEBUG] WebPage - updateLoadingProgress: 56
[DEBUG] WebPage - updateLoadingProgress: 58
[DEBUG] WebPage - updateLoadingProgress: 61
[DEBUG] WebPage - updateLoadingProgress: 63
[DEBUG] WebPage - updateLoadingProgress: 66
[DEBUG] WebPage - updateLoadingProgress: 69
[DEBUG] WebPage - updateLoadingProgress: 72
[DEBUG] WebPage - updateLoadingProgress: 74
[DEBUG] WebPage - updateLoadingProgress: 77
[DEBUG] WebPage - updateLoadingProgress: 80
[DEBUG] Network - Resource request error: QNetworkReply::NetworkError(OperationCanceledError) ( "Operation canceled" ) URL: "http://localhost:8080/idea/style/kendo/fonts/glyphs/WebComponentsIcons.ttf?gedxeo"
[DEBUG] WebPage - updateLoadingProgress: 100
[DEBUG] WebPage - updateLoadingProgress: 10
[DEBUG] WebPage - setupFrame ""
[DEBUG] HTTP Response - Status Code 500 Internal Server Error
[DEBUG] HTTP Response - Sending Header "Cache" = "no-cache"
[DEBUG] HTTP Response - Sending Header "Content-Length" = "54132"
[DEBUG] HTTP Response - Sending Header "Content-Type" = "application/json;charset=UTF-8"

如您所见,出现了 500 错误。但我不知道它可能与什么有关。我手动没有这样的问题。会不会是有requestheaders的东西? 在此先感谢您对此问题的任何帮助。

您可能缺少一些 POST 请求参数,您的请求似乎无效。

您可以手动加载 URL 以缩小范围并支持上述声明。

确保发送的请求信息没有遗漏任何内容。