javascript - 在请求页面加载后呈现 JavaScript 内容以检索参数
问题描述
概览
我正在用 Python 编写一个脚本,该脚本的目标是使用请求在网站上自动执行结帐过程。
我已经完成了 99%,最后一步是提交付款,为此我需要页面加载后在 HTML 中由以下 JS 创建的参数。
JavaScript
我可以看到在 Chrome 'Sources' 部分运行的 JS 如下:
https://songbird.cardinalcommerce.com/edge/v1/songbird.js https://secure.louisvuitton.com/static/20.15.1-RC/min/scripts/cardinalCybs.js https://songbird.cardinalcommerce。 com/edge/v1/60b72a99f75c34959d37 / 1.60b72a99f75c34959d37.songbird.js https://songbird.cardinalcommerce.com/edge/v1/60b72a99f75c34959d37/12.60b72a99f75c34959d37.songbird.com/edge.js/v1 60b72a99f75c34959d37/11.60b72a99f75c34959d37.songbird.js https://songbird.cardinalcommerce.com/edge/v1/60b72a99f75c34959d37/5.60b72a99f75c34959d37.songbird.js
HTML
<!-- START - The following JSP handles the Cardinal Javascripts , inclusion , initialization and all the other cardinal Specific mechanism -->
<!-- The Below JSP is invoked in case of a Credit Card Payment . Its an integration point with the Cardinal Commerce -->
<script src="https://songbird.cardinalcommerce.com/edge/v1/songbird.js"></script>
<script type="text/javascript" src="https://secure.louisvuitton.com/static/20.15.1-RC/min/scripts/cardinalCybs.js"></script>
<input type="hidden" id="JWTContainer" value=""/>
<input type="hidden" id="cardinalJSLogging" value="off"/>
<!-- END - The following JSP handles the Cardinal Javascripts , inclusion , initialization and all the other cardinal Specific mechanism -->
我可以看到这个 JS 创建的请求,然后这些请求与支付网关交互以检索发送完整结帐请求所需的参数。
由于使用了 JWT 令牌并且我没有密钥,因此我无法在没有运行 JS 的情况下复制请求。
我的问题:如何让 JavaScript 文件运行、发送它们的正常请求并反馈结果参数以完成结帐?
我的想法是使用此答案https://stackoverflow.com/a/50612469/8840275中的类似方法建议并使用 Docker + Splash。
我不想使用硒。
解决方案
推荐阅读
- java - Android Dateformatter 问题
- sql-server - 从单个表中拆分列并作为多个列连接到另一个表中
- java - Liquibase 前提条件:如何检查列是否为正确的数据类型?
- reactjs - getDefaultProps 和 getInitialState 未按预期工作
- windows - 转义 > 不在嵌入式命令中工作
- javascript - 带选择的动态表单输入
- database - DDL 触发器 - 无法禁用触发器
- excel - 多个 COUNTIFS 条件格式 Excel
- c - C字符串数组,分配和传递等
- java - 更新 Firebase 库后出现“找不到 com.google.android.gms.internal.zzbck 的类文件”错误