phantomjs

How to get the binary of the image requested by CasperJS?

点点圈 提交于 2020-01-06 14:46:35
问题 Code: casper.on("resource.received", function (response) { if (response.url.indexOf('checkcode') != -1) { this.log('response: ' + JSON.stringify(response), 'debug'); } }) Output: [debug] [phantom] [2016-04-21T01:36:46.007Z] response: {"body":"","bodySize":1847,"contentType":"image/png","headers":[{"name":"Server","value":"Tengine/2.1.0"},{"name":"Date","value":"Thu, 21 Apr 2016 01:36:45 GMT"},{"name":"Content-Type","value":"image/png"},{"name":"Content-Length","value":"1847"},{"name":

Behat works fine but PhantomJS fails on dropdown menu when trying to click

♀尐吖头ヾ 提交于 2020-01-06 09:08:34
问题 Gherkin below works fine with behat but when I use PhantomJS I get error on When I follow "Profile" line below: Note: The element is a dropdown menu from bootstrap so it toggles after click. Error : Exception thrown by (//html/.//a[./@href][(((./@id = 'Profile' or contains(normalize-space(string(.)), 'Profile')) or contains(./@title, 'Profile') or contains(./@rel, 'Profile')) or .//img[contains(./@alt, 'Profile')])] | .//*[./@role = 'link'][((./@id = 'Profile' or contains(./@value, 'Profile')

Behat works fine but PhantomJS fails on dropdown menu when trying to click

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 09:06:33
问题 Gherkin below works fine with behat but when I use PhantomJS I get error on When I follow "Profile" line below: Note: The element is a dropdown menu from bootstrap so it toggles after click. Error : Exception thrown by (//html/.//a[./@href][(((./@id = 'Profile' or contains(normalize-space(string(.)), 'Profile')) or contains(./@title, 'Profile') or contains(./@rel, 'Profile')) or .//img[contains(./@alt, 'Profile')])] | .//*[./@role = 'link'][((./@id = 'Profile' or contains(./@value, 'Profile')

Casperjs - trying to run casper script from command line doesn't output correctly

人盡茶涼 提交于 2020-01-06 08:16:19
问题 I'm brand new to casperjs, and in the process of trying to run my first casper script from the command line (using $ casperjs sample.js ), I received this output: Casper CLI passed args: [] Casper CLI passed options: { "casper-path": "/usr/local/Cellar/casperjs/1.1-beta2/libexec", "cli": true } Instead of the predicted output of: CasperJS, a navigation scripting and testing utility for PhantomJS PhantomJS: Headless WebKit with JavaScript API Here are the contents of the sample file: var

What is this DalekJS error when I try to run a test via PhantomJS?

和自甴很熟 提交于 2020-01-06 07:26:13
问题 Every time I try to run a test using PhantomJS, Dalek gives me this error. However using GoogleChrome the test runs properly. Running tests /Users/user/node_modules/dalekjs/node_modules/dalek-browser-phantomjs/index.js:273 this.spawned.kill('SIGTERM'); ^ TypeError: Cannot read property 'kill' of null at Object.PhantomJSDriver.kill (/Users/user/node_modules/dalekjs/node_modules/dalek-browser-phantomjs/index.js:273:17) at EventEmitter.emit (/Users/user/node_modules/dalekjs/node_modules

How to control a CasperJS automation script from a remote jquery client using socket.io

こ雲淡風輕ζ 提交于 2020-01-06 02:57:17
问题 I have an automation script in CasperJS controlling a PhantomJS headless browser that logs into a site, enters data over multiple pages / form. From the same physical server, I have PHP/MySQL serving up a CRM client website. On the CRM site, I want to have the ability to: Trigger the remote CasperJS script to go browse a remote site and log in and fill out forms Read the output stream (i.e. "Page 1 complete, page 2 complete" ,etc) Display the status updates to the client user as the CasperJS

phantomjs not showing form fields

白昼怎懂夜的黑 提交于 2020-01-05 19:21:10
问题 I am using following js script to phantomjs on ember site running locally: //test_phantomjs.js require('phantomjs-polyfill'); var page = require('webpage').create(); page.open('http://localhost:4200/', function(status) { console.log("Status: " + status); if(status === "success") { page.render('example.png'); } phantom.exit(); }); The command I run the test this script is as follow: phantomjs --remote-debugger-port=9001 --remote-debugger-autorun=yes test_phantomjs.js I am suppose to get login

Using $.ajaxStop() to determine when page is finished loading in CasperJS

狂风中的少年 提交于 2020-01-05 18:01:34
问题 So far in my tests written in CasperJS, I've been using waitForSelector() on page-specific elements to determine if a page has fully loaded (including all the async ajax requests). I was hoping to come up with a more standard way of waiting for page load and was wondering if the following was possible? Inject as clientscript the following (include.js) $(document).ajaxStop(function() { // Do something }) Description of ajaxStop according to jquery api: Register a handler to be called when all

Using $.ajaxStop() to determine when page is finished loading in CasperJS

有些话、适合烂在心里 提交于 2020-01-05 18:01:03
问题 So far in my tests written in CasperJS, I've been using waitForSelector() on page-specific elements to determine if a page has fully loaded (including all the async ajax requests). I was hoping to come up with a more standard way of waiting for page load and was wondering if the following was possible? Inject as clientscript the following (include.js) $(document).ajaxStop(function() { // Do something }) Description of ajaxStop according to jquery api: Register a handler to be called when all

PhantomJS: submit a form

做~自己de王妃 提交于 2020-01-05 12:02:41
问题 I am filling out and submitting a form using PhantomJS and then outputting the resulting page. The thing is, I have no idea if this thing is being submitted at all. I print the resulting page, but it's the same as the original page. I don't know if this is because it redirects back or I didn't submit it or I need to wait longer or or or. In a real browser it sends a GET and receives a cookie, which it uses to send more GETS before eventually receiving the final result - flight data. I copied