casperjs

Is there a way to step in to CasperJS code and Debug step by step [closed]

谁说我不能喝 提交于 2019-12-29 14:20:24
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . Though I have been using CasperJS for some time, and rely on console logging for debugging. I was wondering if there is any IDE which support CasperJS step by step debugging or there is other way(remote debugging) to step in to CasperJS code? Has anybody successfully done it? Any

CasperJS parse next page after button click

点点圈 提交于 2019-12-29 08:22:27
问题 I use casperjs for grab some test. Algorithm is open URL parse page, click button for load next page. How to grab next pages until test is complete. All question get random and I don't now next question before form submitted. I need parse pages like a cycle or recursive. My code is: casper.start(startUrl, function () { this.click('#training'); this.evaluate(function () { $('input[type="submit"]:first').click(); }); }); casper.then(function () { var currentUrl = this.getCurrentUrl(),

CasperJS: swallows special keys like Enter?

风格不统一 提交于 2019-12-29 04:24:48
问题 I'm trying to write a test using CasperJS for a scenario where pressing Enter in an input is the trigger for the page to do something with the text otherwise typed into the input. An abbreviated/simplified version of the CasperJS test: casper.start('http://localhost:3000/input-demo', function() { this.sendKeys('#demo-input', 'demo text'); this.sendKeys('#demo-input', '\uE007'); this.test.assertEquals(this.getHTML('#stage'), 'input demo'); }); casper.run(); (Where we run it as casperjs test

casperjs download csv file

自作多情 提交于 2019-12-28 05:29:26
问题 I am trying to download a csv file(advert report) from a site using the below code. The issue is, it will download the HTML page and not the csv file. I cannot give you the URL as it is behind the login, but it is similar case when you download Firefox from the below URL http://www.mozilla.org/en-US/firefox/new/ It is a GET request and when I do inspect element Network Tab the get request gets Cancelled. I am new to Casper and don't know how to handle such requests. Any help would be

Click on all 'a' elements in paragraph with specific class in CasperJS

瘦欲@ 提交于 2019-12-25 14:17:01
问题 I have the following problem. I have this structure of HTML code: <p class="description"> lorem ipsum, bla bla bla <a href="# onclick="somemethod(id)">click</a> </p> <p class="description"> lorem ipsum, bla bla bla </p> <p class="description"> lorem ipsum, bla bla bla <a href="# onclick="somemethod(id)">click</a> </p> Now I need to click via CasperJS on every "a" in paragraphs with class 'description'. I try this: while (selector = document.querySelector('p.description a')) { casper.then

Click on all 'a' elements in paragraph with specific class in CasperJS

强颜欢笑 提交于 2019-12-25 14:15:13
问题 I have the following problem. I have this structure of HTML code: <p class="description"> lorem ipsum, bla bla bla <a href="# onclick="somemethod(id)">click</a> </p> <p class="description"> lorem ipsum, bla bla bla </p> <p class="description"> lorem ipsum, bla bla bla <a href="# onclick="somemethod(id)">click</a> </p> Now I need to click via CasperJS on every "a" in paragraphs with class 'description'. I try this: while (selector = document.querySelector('p.description a')) { casper.then

CasperJS - Access page's content while trying to fill drop-down menu through a loop

时光总嘲笑我的痴心妄想 提交于 2019-12-25 09:59:46
问题 I'm trying some tests with casperjs and the certain situation here is: extracting city names from a drop-down menu, (Already Done) then select each city (with casper.fill() ) which leads to load new contents and URL change on the page, ( Successful while testing with a single city name, Failed with loop through the list of cities' names) go one level further through new loaded items' links (new pages), finally, grab the content from each single page I was trying to do a loop to iterate

How to select tags with namespaces in CasperJS?

烈酒焚心 提交于 2019-12-25 06:47:30
问题 I'm refactoring a RSS so I decided to write some tests with CasperJS. One of the elements of the RSS is "atom:link" (") I tried this three codes, but none works test.assertExists("//atom:link", "atom:link tag exists."); test.assertExists({ type: 'xpath', path: "//atom:link" }, "atom:link element exists."); //even this... test.assertExists({ type: 'xpath', namespace: "xmlns:atom", path: "//atom:link" }, "atom:link element exists."); The RSS code is: <?xml version="1.0" encoding="utf-8" ?> <rss

How to use fillSelectors in casperjs

泪湿孤枕 提交于 2019-12-25 05:48:13
问题 I need to get some content from the page, but if I use fillSelectors() the content is not load. Maybe i need use evaluate() , but i dont undestend where and how. var casper = require('casper').create() casper.start('http://console.matomycontentnetwork.com/', function() { this.fillSelectors('form#login-form', { 'input[name="username"]': 'jpost', 'input[name="password"]': 'matomy123' }, true); this.clickLabel("Sign In", 'button'); }); casper.then(function() { var start_date = '09/01/2015'; var

CasperJS doesn't evaluate jQuery method

别说谁变了你拦得住时间么 提交于 2019-12-25 04:48:12
问题 I injected jQuery to CasperJS: phantom.injectJs('./utils/jquery/jquery-2.1.4.js'); but when I try to evaluate some jQuery code, it is ignored: example: function dragNdropAlertToActivity() { var tt = casper.evaluate(function() { $('div[id^="scheduler-alert-grid"] table:contains(BLUE ALERT)')[0].simulate("drag-n-drop", { dragTarget: { dx: 71, dy: 71, interpolation: { stepCount: 2 } } }); return "done"; }); casper.echo(tt); }; calling method like: casper.test.begin(function(){...}) . test are