【发布时间】:2019-04-05 14:50:46
【问题描述】:
我使用 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 错误。但我不知道它可能与什么有关。我手动没有这样的问题。可以是带有请求标头的东西吗? 提前感谢您对此问题的任何帮助。
【问题讨论】:
-
错误 500 来自服务器。所以你应该问负责该服务器的人。
标签: java selenium phantomjs rpa