我需要使用 frisby.js 和 javascript 自动化一些 API 测试,但是我无法访问 HTML 响应的一些数据,这很可能是因为响应不是 JSON 格式。
下面是我的代码
var frisby = require('frisby');
frisby.create('Get some information')
.get(someUrl)
.after(function (err, res, body) {
console.log(body);
})
.toss()
下面是console.log(body);
函数的结果
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>MDpay default response template for web</title>
</head>
<body OnLoad="OnLoadEvent();" >
<form name="downloadForm"
action="https://someurl"
method="POST">
<input type="hidden"
name="PaReq"
value="eJxVUdtuwjAM/ZWKDyBJCWuLjCUuk8YDE2JMYk8opN6ogBTSdIK/X1LK2PISn5PYxz6G1c4STd9I15YQ5lRV6ouiIh92krgnZQdhMVrSGeGbbFWUBkWXd2Ngd+hTrN4p4xCUPo9nrygznkgOrIVwJDubIudc8HCA3Qgw6kg42m+V2W960828zOmwWVHlgDVPoMvaOHvFJPN6dwC1PeDOudOAMWABAHu0sKhDVPnkS5HjgtPc6Zyvx5PLm5YFlcXabd8/1TMfAgs/IFeOMOYi8d09RaI/4PFAJsAaHtQxqOJq+RH1eTf03jJwCkKjG+g3U/1lwLtpyegrZjLzvd8R0OVUGvI//ES/MeRUaYy8aLiBPYaYvARXtfN2xWkvTkUabG1wKFV4P0QqbrUCABYyWLsx1m7TR/+2/APkDqQg">
<input type="hidden"
name="TermUrl" value="https:someurl">
<input type="hidden"
name="MD"
value="402277:56F8FBC5FC36742423302C8EFF56C796E7B123FC61132EA2AD89A389A02C4093:4243:##100100000">
<!-- To support javascript unaware/disabled browsers -->
<div style="text-align: center;">
<img src="templates/preloader.gif"/><br/>
<noscript>
<center>Please click the submit button below.<br>
<input type="submit" name="submit" value="Submit"></center>
</noscript>
</div>
</form>
<SCRIPT LANGUAGE="Javascript" >
function OnLoadEvent() {
document.downloadForm.submit();
}
</SCRIPT>
</body>
</html>
我的问题是你知道到达value
's ofPaReq
和HTML 标签TermUrl
的方法吗?MD
谢谢