【发布时间】:2014-01-27 18:00:19
【问题描述】:
好的,有人可以帮助我吗?我是 casperjs 的新手,到目前为止,stackoverflow 非常棒,这里的人非常乐于助人。
在最终让我的脚本正常工作并使其回显 html 之后,我想添加一个新函数并需要有关如何执行此操作的帮助。
基本上不是将 html 回显出来。
我想检查一个 xpath 是否存在,如果它确实我希望它回显
you still have minutes
如果不存在则回显
no minutes left
这是我要检查的 xpath
/html/body/div/div[3]/div[2]/div/div/table/tbody/tr[2]/td[2]
谁能告诉我一个简单的函数可以做到这一点
我的功能
// Wait 2 sec then write to txt file
casper.wait(9000, function() {
//this.echo(this.getHTML());
//this.echo(this.getCurrentUrl());
this.fill('form[name="LoginForm"]', {
'username': 'test',
'password': 'test'
}, true);
});
【问题讨论】:
标签: javascript xpath phantomjs casperjs