如何将javascript与phantomjs结合使用
我试着用幻影写作 例如: 正在运行,错误提示:如何将javascript与phantomjs结合使用,javascript,phantomjs,Javascript,Phantomjs,我试着用幻影写作 例如: 正在运行,错误提示: TypeError: 'undefined' is not a function (evaluating 'document.getElmentsByTagName('a')') phantomjs://webpage.evaluate():2 phantomjs://webpage.evaluate():3 phantomjs://webpage.evaluate():3 null 为什么?我做了什么?看起来你没有调用phanto
TypeError: 'undefined' is not a function (evaluating 'document.getElmentsByTagName('a')')
phantomjs://webpage.evaluate():2
phantomjs://webpage.evaluate():3
phantomjs://webpage.evaluate():3
null
为什么?我做了什么?看起来你没有调用
phantom.exit()代码>当Phantomjs完成它的工作时
将所述命令附加到脚本末尾,它应该可以正常工作。我在代码中没有看到文档.getElmentById
,但只看到getElmentsByTagName
。他们都有打字错误。它应该是getElementById
或getElementsByTagName
。请显示与错误消息匹配的代码。能否尝试读取状态?例如:page.open(“…”,函数(状态){console.log(状态);var res=…})
然后查看状态,它应该是'success'
。还是打字错误?如你所愿,成功。但仍然报告TypeError:“undefined”不是函数…@AgashThamo。我修复了它。谢谢你的更正。请再次检查,please@ArtjomB.What没有结尾的脚本是否与明显的打字错误有关。这应该是一个评论。
TypeError: 'undefined' is not a function (evaluating 'document.getElmentsByTagName('a')')
phantomjs://webpage.evaluate():2
phantomjs://webpage.evaluate():3
phantomjs://webpage.evaluate():3
null