当我运行casperjs脚本时,我的脚本在控制台消息上被阻止[info] [幻影]开始...我不明白为什么.
我的剧本
var casper = require('casper').create({
verbose: true,
logLevel: 'debug',
});
var login = '******@hotmail.fr';
var password = '*******';
var baseURL = 'http://fr.bazarchic.com/';
casper.start('http://fr.bazarchic.com/', function(){
this.fill('form[action="/login/"', {
'email' : login,
'pass' : password
}, true)
});
casper.then(function() {
var pageTitle = this.evaluate(function(){
return document.title;
})
this.echo(pageTitle);
});
Run Code Online (Sandbox Code Playgroud) 我想沙盒一个应用程序,它使用applescript联系safari来获取选项卡列表.然后我通过NSAppleEventDescriptor在目标c中找回那些数据.我已经将com.apple.security.temporary-exception.apple-events键与com.apple.safari一起添加到我的权利中.当我的应用程序没有沙盒时我没有问题,但当我尝试沙箱时,我只是得到"空"作为数据.
applescript列出选项卡并将其作为xml返回.
tell application "Safari"
set listeSite to {{"http://www.deezer.com", "deezer"}}
set resp to "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>"
repeat with aWindow in windows
repeat with aTab in tabs of aWindow
set URLTab to URL of aTab
repeat with aSite in listeSite
if URLTab starts with item 1 of aSite then
set oktabURL to URL of aTab
set oktabWindowID to id of aWindow
set resp to resp & "<site><url>" & oktabURL & "</url><windowID>" & oktabWindowID & "</windowID><type>" & item 2 of aSite & …Run Code Online (Sandbox Code Playgroud) 在使用Meteor HTTP在Spotify API上请求access_token时,我无法解决问题.实际上,当我对Spotify https://accounts.spotify.com/api/token进行POST调用时.我收到以下回复:
{"statusCode":400,"content":"{\"error\":\"unsupported_grant_type\",\"error_description\":\"grant_type must be client_credentials, authorization_code or refresh_token\"}"
Run Code Online (Sandbox Code Playgroud)
我认为这可能与Content-Type标头和BODY参数的编码有关,但我无法解决这个问题.我试图使用数据和参数,但没有一个工作.
这是我的代码:
HTTP.post("https://accounts.spotify.com/api/token", {
data: {
grant_type : "authorization_code",
code : authCode,
redirect_uri : Router.routes['redirect_spotify'].url()
},
headers: {
'Authorization' : "Basic " + CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse("xxxx:yyyyy")),
'Content-Type':'application/x-www-form-urlencoded'
}
}, function(error, result) {
console.log("POST made with data : %j", result);
if (error){
Registrations.remove({userId : this.userId });
return;
}
Registrations.update({
userId : this.userId },
{$set : {
state: "Done",
accessToken: result.access_token,
//TODO expires
refreshToken: result.refresh_token
}},
{ upsert : true}
);
}); …Run Code Online (Sandbox Code Playgroud) 当我尝试使用MR_findAllSortedBy具有多个键的函数时,我得到一个未找到键路径的错误.但是,当我使用此功能只有两个键路径之一时,它的工作原理.我无法理解为什么它不起作用.
我的代码
-(void)performActionOnEachTrajetWithBlock:(void (^) (Trajet *trajet, NSArray *previousTrajets))actionBlock{
NSMutableArray *previousTrajets = [NSMutableArray arrayWithArray:@[]];
for (Trajet *trajet in [Trajet MR_findAllSortedBy:@"isActive, date" ascending:YES]){
actionBlock(trajet, [NSArray arrayWithArray:previousTrajets]);
[previousTrajets addObject:trajet];
}
return;
}
Run Code Online (Sandbox Code Playgroud)
错误
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'keypath date not found in entity <NSSQLEntity Trajet id=2>'
Run Code Online (Sandbox Code Playgroud)
感谢你们对我的帮助.
这基本上是我的问题,你知道 deezer api 请求配额是通过 URL 还是 Oauth 令牌应用的吗?我的意思是,如果同一台服务器同时向 5 个不同的 deezer 用户发出请求,配额是 50/5 秒(因此适用于 URL)还是 250/5 秒(因此适用于令牌)。
先感谢您
我是javascript中的noobie,当我尝试使用原型来扩展我的对象时,我得到以下错误代码:
Object function ProcessManager() {...} has no method 'startBrowsing'
Run Code Online (Sandbox Code Playgroud)
这是我的代码.我在nodejs中执行此代码.
代码
function ProcessManager(){
this.browser = new Browser();
this.salePagesToVisit = [];
this.salePagesCurrent = [];
this.salePagesDone = [];
this.categoryPagesToVisit = [];
this.categoryPagesCurrent = [];
this.categoryPagesDone = [];
this.listPagesToVisit = [];
this.listPagesCurrent = [];
this.listPagesDone = [];
}
ProcessManager.prototype.startBrowsing = function () {
winston.log('verbose', 'Starting scrapping Bazarchic');
}
var processManager = new ProcessManager();
ProcessManager.startBrowsing();
Run Code Online (Sandbox Code Playgroud) 当我只是调用MR_createEntity时,我得到一个exc_bad_access错误.由于我是magicalRecord的新手,我无法找到bug的来源.
代码 :
TMTAppDelegate.m
//TMTAppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[MagicalRecord setupAutoMigratingCoreDataStack];
NSArray *trajetsRawArray = @[@{@"km" : @125, @"mn":@110, @"adressStart" : @"Metz", @"adressEnd" : @"Gérardmer", },
@{@"km" : @4, @"mn":@14, @"adressStart" : @"Plappeville", @"adressEnd" : @"Metz"},
@{@"km" : @312, @"mn":@200, @"adressStart" : @"Metz", @"adressEnd" : @"Paris"},
@{@"km" : @413, @"mn":@236, @"adressStart" : @"Marseille", @"adressEnd" : @"Toulouse"},
@{@"km" : @2, @"mn":@4, @"adressStart" : @"Ban-St-Martin", @"adressEnd" : @"Metz"},
@{@"km" : @65, @"mn":@63, @"adressStart" : @"Metz", @"adressEnd" : @"Gérardmer"}
];
//[[UINavigationBar appearance] …Run Code Online (Sandbox Code Playgroud)