phantomjs

Phantomjs creating black output from SVG using page.render

我是研究僧i 提交于 2019-12-04 14:50:30
I have been running PhantomJS 1.9.6 happily on a turnkey Linux server for about 4 months now. Its purpose is to take an SVG file and create different sizes using the page.render function. This has been doing this but since a few days ago has started to generate a black mono output. Please see below: The code: var page = require('webpage').create(), system = require('system'), address, output, ext, width, height; if ( system.args.length !== 4 ) { console.log("{ \"result\": false, \"message\": \"phantomjs.rasterize: error need address, output, extension arguments\" }"); //console.log('phantomjs

Unable to load page resources with PhantomJS

冷暖自知 提交于 2019-12-04 14:46:39
问题 I'm using PhantomJS to get page content for given URL. The problem is that on some pages PhantomJS can not load some resources (js, css...), and the error I'm getting is: error code 5, Operation canceled Web page on which I can reproduce this problem is www.lifehacker.com The resources I can not get are: http://x.kinja-static.com/assets/stylesheets/tiger-4ee27d6612a71ee3c68440f8e9c0025c.css http://c.amazon-adsystem.com/aax2/amzn_ads.js and some others too... The command I'm running is:

Render CSS3 animation as a sequence of image files with PhantomJS

梦想与她 提交于 2019-12-04 14:38:26
问题 I didn't work with PhantomJS before, but want to use it to render some custom-made CSS3 animated sequences to sets of PNG files on server side to join them into a single video file next. Seems like PhantomJS has an option to render current page state to an image. Next, I found -webkit-animation-play-state that I hope can help me to pause the animation, render the page, then go to next frame and do it all again. May be I should do these animations with pure JS so that I can control all pause

Scrolling with phantomJs Selenium

本小妞迷上赌 提交于 2019-12-04 14:24:07
I am trying to get this particular code running for scrolling a webpage which is a type of pagination. It works like a charm with the Firefox driver, but when i use phantomJS it doesn't work and goes into infinite loop public class Drivers { public WebDriver phJS() { File phantomjs = Phanbedder.unpack(); //Phanbedder to the rescue! String[] phantomArgs = new String[] { "--webdriver-loglevel=NONE" }; DesiredCapabilities dcaps = new DesiredCapabilities(); dcaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomjs.getAbsolutePath()); dcaps.setCapability( "phantomjs

Unreliable/Flakey Capybara/AngularJS Integration Tests With Timing Issues

放肆的年华 提交于 2019-12-04 14:05:54
问题 How do I make these tests reliably pass? Currently these tests are flakey. Sometimes they pass. Sometimes they fail. Below is the setup, code and output demonstrating this issue. Suggestions to overcome this issue will be greatly appreciated and I am sure will help many others, so please comment! Test Code Environment Rails 3.2 RSpec 2.x Capybara Poltergeist PhantomJS AngularJS Google Chrome Version 47.0.2526.106 (64-bit) Testing Gems from Gemfile.lock capybara (2.1.0) database_cleaner (0.7.1

Selenium GhostDriver/PhantomJS: File not getting uploaded using sendKeys() / Javascript

有些话、适合烂在心里 提交于 2019-12-04 12:46:00
I am running a headless script using PhantomJSDriver/GhostDriver and trying to upload a file on gmail while composing an email. Tool: Selenium with PhantomJS/GhostDriver. The html code is as below: Click the "Browse" button to select a file. Click "Done" when you're finished.</table><table width=100% cellpadding=2 cellspacing=0 border=0> <tr><td align=right>1. </td><td> <input name="file1" type=file size=42><tr><td align=right>2. </td><td> <input name="file2" type=file size=42><tr><td align=right>3. </td><td> <input name="file3" type=file size=42><tr><td align=right>4. </td><td> <input name=

Why doesn't the shim for watch() and unwatch() at https://gist.github.com/384583 work in phantomjs?

牧云@^-^@ 提交于 2019-12-04 12:43:45
I'm doing some server-side javascript bits and pieces that essentially need both access to websites' full DOMs and the ability to open sites cross-domain, and at least so far, PhantomJS seems the best tool for the job. However, it lacks an Object.watch() method, which I'd rather like to have. As such, I'm trying to use the shim posted as an answer elsewhere on Stackoverflow (available here: https://gist.github.com/384583 ) to give me access to just such methods. It isn't working. It's also well beyond my level of JavaScript understanding - so I'm wondering if anyone could help me understand

Injecting javascript into zombie.js

前提是你 提交于 2019-12-04 12:28:58
问题 Hi I was wondering if there is the ability in node js and zombie js to inject javascript files in to the headless browser, similar to what you can do with phantomjs. For example in phantom js you would do: page.injectJs("amino/TVI.js") I have used phantomjs and it does do what I want it to do but however I am testing other options due to the high memory required by using phantom js. 回答1: you can append script tag into document object since it support DOM API in zombie. The following example

PhantomJS to screenshot website div for Spring MVC, Tomcat and iText use

帅比萌擦擦* 提交于 2019-12-04 12:19:06
I've been introduced to the power of PhantomJS and CasperJS to take website screenshots. The article " Responsive Screenshots With Casper " was really helpful to learn about the basics of the two technologies plus the screenshot feature. Next is to how can this technology be used for integration with a Spring MVC application. So far I have tried " Screen Capture using PhantomJS, GhostDriver, Selenium Hub "'s code and combined it with the answer provided in " Remote PhantomJS driver in Junit ". What happened is that every time I run the program, I keeps having a ClassNotFoundError and I kept

Getting remote data for a page using AJAX in CasperJS

人盡茶涼 提交于 2019-12-04 12:10:03
问题 In the course of executing a CasperJS script I need to fetch and parse JSON data from another site so that I can use that data to fill in a form on the site I'm actively working on. How can I do this? 回答1: You can use __utils__.sendAJAX(): var casper = require('casper').create(); var wsurl = 'https://raw.github.com/n1k0/casperjs/master/package.json'; var word; casper.start('http://google.com/', function() { word = this.evaluate(function(wsurl) { try { return JSON.parse(__utils__.sendAJAX