如何在CasperJS中按下下载按钮时获取URL

问题描述 投票:0回答:1

我想点击CasperJS中的“下载”按钮后获取URL。

<a href="javascript:void(0);" onclick="return Support.DownloadContent('', 'content','contents');">Download</a>
javascript casperjs
1个回答
0
投票

您可以使用click(),然后使用getCurrentUrl()

var casper = require('casper').create();

casper.start('https://example.com/');

casper.then(function () {
  this.click('a');
});

casper.then(function () {
  this.echo(this.getCurrentUrl());
});

casper.run();
© www.soinside.com 2019 - 2024. All rights reserved.