??? CasperJS ?? Web ??????й??????
???????????? ???????[ 2013/9/4 13:46:46 ] ????????
????CasperJS ?????Щ????????????????? Web ??????й??????????????????????д???μ? JavaScript ????????? Google ????????
view source
print
01 var casper = require('casper').create();
02
03 casper.start('http://www.google.fr/'?? function() {
04 this.test.assertTitle('Google'?? 'google homepage title is the one expected');
05 this.test.assertExists('form[action="/search"]'?? 'main form is found');
06 this.fill('form[action="/search"]'?? {
07 q: 'foo'
08 }?? true);
09 });
10
11 casper.then(function() {
12 this.test.assertTitle('foo - Recherche Google'?? 'google title is ok');
13 this.test.assertUrlMatch(/q=foo/?? 'search term has been submitted');
14 this.test.assertEval(function() {
15 return __utils__.findAll('h3.r').length >= 10;
16 }?? 'google search for "foo" retrieves 10 or more results');
17 });
18
19 casper.run(function() {
20 this.test.renderResults(true);
21 });
??????????????casper.test ?? tester.Tester ?????????????????????????ж?????????
????tester.Tester API documentation ?? dedicated section.
?????????????????????????
????view source
????print?
????$ casperjs samples/googletest.js
?????????????н????
???????????????????????????????????
?????????????? xUnit ???
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11