node.js - CasperJS 已被重定向,然后以 status=fail (HTTP 302) 退出
问题描述
/opt/casperjs 中的 CasperJS 版本 1.1.4,使用 phantomjs 版本 2.1.1。在centOS上运行。
试图通过在 ASP.net webforms 上运行的身份验证页面,但在提交按钮后单击:
casper.then(function(){
if (this.exists("#LoginTyreLink_LoginButton")) {
this.echo("Login button found");
this.click("#LoginTyreLink_LoginButton", function(){
saveShot("login_button_clicked");
});
}
});
我得到重定向周期和超时:
[debug] [phantom] Mouse event 'mouseup' on selector: #Loginsite_LoginButton
[debug] [phantom] Mouse event 'click' on selector: #Loginsite_LoginButton
[info] [phantom] Step anonymous 14/17: done in 3131ms.
[info] [phantom] Step _step 15/17 https://site.brand.eu/link/ (HTTP 200)
[info] [phantom] Step _step 15/17: done in 3155ms.
[debug] [phantom] Navigation requested: url=https://site.brand.eu/link/Homepage.aspx, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] Navigation requested: url=https://site.brand.eu/link/Login.aspx, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] Navigation requested: url=https://site.brand.eu/link//Homepage.aspx, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] Navigation requested: url=https://site.brand.eu/link/Login.aspx, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] Navigation requested: url=https://site.brand.eu/link/Homepage.aspx, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] Navigation requested: url=https://site.brand.eu/link/Login.aspx, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] Navigation requested: url=https://site.brand.eu/link/Homepage.aspx, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] Navigation requested: url=https://site.brand.eu/link/Login.aspx, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] Navigation requested: url=https://site.brand.eu/link/Homepage.aspx, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] Navigation requested: url=https://site.brand.eu/link/Login.aspx, type=Other, willNavigate=true, isMainFrame=true
[warning] [phantom] Loading resource failed with status=fail (HTTP 302): https://site.brand.eu/link/Login.aspx
[debug] [phantom] Automatically injected includes/jquery-3.3.1.js client side
[warning] [phantom] Casper.waitFor() timeout
[error] [phantom] Wait timeout of 20000ms expired, exiting.
Wait timeout of 20000ms expired, exiting.
[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "about:blank"
我试图在我的本地机器上运行脚本 - 它成功了,但不能在我的远程 centOS 机器上运行。
附言
用了一年多就好了...
解决方案
正如我上面提到的——平台是centOS。这很有趣,但是...
sudo yum update
然后:
sudo reboot
任务完成。
推荐阅读
- tensorflow - 是否有适合分子的 HuggingFace Tensorflow 模型和标记器?
- node.js - 使用 Express Paginate 返回 JSON 响应
- javascript - 推送到数组是返回索引而不是项目(React)
- flutter - 颤振:未为“JsonCodec”类型定义运算符“[]”
- python - 如何将字典中的嵌套字典转换为字典
- c++ - 受操作系统限制的条件类型
- php - 问题:如何使用以及在laravel中的位置
- c - 如何找到任何给定矩阵的伪逆
- zabbix - Zabbix 计划报告配置 - 无法连接到 Web 服务:无法连接到服务器
- mysql - Sql select查询分配结果P=,F=