【发布时间】:2014-07-19 15:53:58
【问题描述】:
我需要在一个页面上捕获一个 URL,然后打开目标。什么是最优雅的解决方案?下面的代码不起作用,因为变量 url 基本上是本地的。
function() {
page.open("https://www.google.com/blah");
},
function() {
page.evaluate(function() {
var url=document.getElementById('link42')[0]; //URL captured
});
},
//opening the target
function() {
page.open(url);
},
function() {
page.evaluate(function() {
console.log(document.querySelectorAll('html')[0].outerHTML);
});
}
【问题讨论】:
标签: variables url phantomjs argument-passing