gpt4 book ai didi

javascript - PhantomJS 没有运行 Javascript

转载 作者:行者123 更新时间:2023-11-27 23:30:21 25 4
gpt4 key购买 nike

<分区>

我有一个 html 页面,可以在本地 xampp 的帮助下访问,http://localhost/testingserver/trelloapi.html .

该页面看起来像这样,在 chrome 中打开时,该页面加载正常,并且在我的 trello 列表中创建了一张卡片。我换掉了 my_key 等所以在我的版本中我有一个长的 12345abcsd ...

trelloapi.html

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="https://api.trello.com/1/client.js?key={my_key}&token={my_token}"></script>
</head>
<body>

<script type="text/javascript">

var myList = "{my_listId}";
var creationSuccess = function(data) {
console.log('Card created successfully. Data returned:' + JSON.stringify(data));
};
var newCard = {
name: 'Making card from console 0.o',
desc: 'This is the description of our new card.',
// Place this card at the top of our list
idList: myList,
pos: 'top'
};
Trello.post('/cards/', newCard, creationSuccess);
</script>
</body>
</html>

但是当我将 PhantomJS 与以下代码一起使用时,来自 http://phantomjs.org/卡片不是在 Trello 上创建的

phantomcall.js

// Simple Javascript example
console.log('Loading a web page');
var page = require('webpage').create();
var url = 'http://localhost/testingserver/trelloAPI.html';
page.open(url, function (status) {
console.log(status);
//Page is loaded!
phantom.exit();
});

我下载了包含 bin/phantomjs 的 phantomjs-2.1.1-macosx.zip 并在终端中使用命令:$ sudo ./phantomjs ../../../Desktop/testingServer/phantomcall.js

控制台打印如下:

加载网页

成功

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com