cookies - AssertionError: Find text within the document body casperJS/phantomJS AND how count the total number of Li with specific class name using casperJS -


I tried this code:

  var casper = require ('casper') . (); Var mouse = requires ("mouse"). Build (Casper); Phantom.casperTest = true; Phantom.cookiesEnabled = true; Phantom.addCookie ({'name': 'authToken', 'value': '88f115b38585155c1', 'domain': 'localhost', 'path': '/'}); Phantom.addCookie ({'name': 'activationId', 'value': '1', 'domain': 'localhost', 'path': '/'}); Phantom.addCookie ({'name': 'userId', 'value': '1', 'domain': 'localhost', 'path': '/'}); Casper.start ('http: //localhost/history.php', function () {casper.on ('remote.message', function (message) {console.log (message);}); casper.thenOpen (' Http: //localhost/history.php ', function () {this.page.render (' cookie.jpeg '); this.evaluate (function () {console.log (' make it cookie here '); console log ("title -" + document.title); console.log (document.cookie);});});}); Casper.then (function () {this.test.assertTextExists ('tomorrow');}); Casper.run ();   

This gives me this error

  root @ debian: / var / www # casperjs histroyuitest_today.js Document ready device Pixelertio --- 1 Load History Product [object object], [object object] cookie title here - Zen Autotoken = 88f115b38585155c1; ActivationId = 1; UserId = 1 Find text within FAIL document body # type: assertTextExists # Subject: Wrong # text: "Tomorrow" assurance error: Find the text within the document body /root/phantomjs-1.9.2-linux-i686/casperjs/ assertTextE xists /var/www/histroyuitest_today.js:40 / root / phantomjs- in the module / tester .js: 323 /root/phantomjs-1.9.2-linux-i686/casperjs/modules/tester.js:766 1.9.2-Linux-i686 / casperjs / modules / casper.js: 1558 in checktip in runtype /root/phantomjs-1.9.2-linux-i686/casperjs/modules/casper.js399? Looks like you do not use start (1), which is essential from the FAIL enforcement error: Find the text within the document body # Type: Error # Subject: Wrong # Error: "Entertainment Error: Within the Document Body Find the text "#Stack: /root/phantomjs-1.9.2-linux-i686/casperjs/modules/tesIn emphasis in ter.js: assertTextExists (323) in /root/phantomjs-1.9.2-linux-i686 Tester r.js in / casperjs / modules /: histroyuitest_today.js in anonymous (766): runStep (40) in /root/phantomjs-1.9.2-linux-i686/casperjs/modules/casper.js1558 in checkStep ( ) In / root /phantomjs-1.9.2-linux-i68 6 / casperjs / modules / casper.js39 9   

Why am I getting this error? Is my cookie set or unset? And how can I calculate the total number of li with a specific table name in KCJRJS? Answer: For your comments: It depends, I do not know if you own the CSS selectors. Are:

  this.click ('li.history: nth-of-type (2) a');   

But care takes this second lei element from her guardian, so classname does not filter search (this is used only to return true parents). Using jQuery with Xpath (or eq () is more intuitive (if I remember well it is something with xpath):

  var x = require ('casper' ) SelectXPath; This.click (x ("li [@ class = 'layout_right'] [2] one"));    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -