2013-11-15 99 views
0

我使用casperjs和它不工作,同時傳遞具有像https://www.google.co.in/imghp?ie=UTF-8&hl=en&tab=wi&ei=ne6FUuvXIIiPrgeN-YGQDA&ved=0CAMQqi4oAg一些querystrings的url。我正在使用下面的命令來運行腳本。CasperJS:查詢字符串作爲參數不起作用

casperjs url.js https://www.google.co.in/imghp?ie=UTF-8&hl=en&tab=wi&ei=ne6FUuvXIIiPrgeN-YGQDA&ved=0CAMQqi4oAg

url.js

var casper = require('casper').create({ 
pageSettings: { 
    loadImages: false,   
    loadPlugins: false   
}, 
verbose: true, 
logLevel: "debug" 
}); 
casper.echo("### Has URL: "+casper.cli.has(0)); 
casper.echo("### URL: "+casper.cli.get(0)); 
casper.run(); 

上面的腳本輸出

C:\casperjs>casperjs custom.js https://www.google. 
co.in/imghp?ie=UTF-8&hl=en&tab=wi&ei=ne6FUuvXIIiPrgeN-YGQDA&ved=0CAMQqi4oAg | cl 
ip 
### Has URL: true 
### Store URL: https://www.google.co.in/imghp?ie=UTF-8 
[info] [phantom] Starting... 
[info] [phantom] Running suite: 2 steps 
[debug] [phantom] opening url: https://www.google.co.in/imghp?ie=UTF-8, HTTP GET 

[debug] [phantom] Navigation requested: url=https://www.google.co.in/imghp?ie=UT 
F-8, type=Other, willNavigate=true, isMainFrame=true 
[debug] [phantom] url changed to "https://www.google.co.in/imghp?ie=UTF-8" 
[debug] [phantom] Successfully injected Casper client-side utilities 
[info] [phantom] Step anonymous 2/2 https://www.google.co.in/imghp?ie=UTF-8 (HTT 
P 200) 
### Got Url: https://www.google.co.in/imghp?ie=UTF-8 Data, Processing... 
[info] [phantom] Step anonymous 2/2: done in 908ms. 
[info] [phantom] Done 2 steps in 912ms 
'hl' is not recognized as an internal or external command, 
operable program or batch file. 
'tab' is not recognized as an internal or external command, 
operable program or batch file. 
'ei' is not recognized as an internal or external command, 
operable program or batch file. 
'ved' is not recognized as an internal or external command, 
operable program or batch file. 

C:\casperjs> 

實際上其分裂&符號後的網址,請給我一些解決方案爲它,讓我khow如果我這樣做預測錯誤。

回答

1

這很可能是由於命令提示符誤解輸入。

運行以下應該工作:

casperjs url.js "https://www.google.co.in/imghp?ie=UTF-8&hl=en&tab=wi&ei=ne6FUuvXIIiPrgeN-YGQDA&ved=0CAMQqi4oAg" 
相關問題