phantomjs

Jasmine + Pahtom.js + ReSharper : Test session don't stop after execution

筅森魡賤 提交于 2019-12-22 10:42:17
问题 I write my JS tests using Jasmine and execute then with Phantom.js (1.8.1) on ReSharper (7.1) Everything runs smoothly as ever, exept that the ReSharper Testrunner's Test Session is not stopped after all unittests are run. The result is that everytime I run a new unittest, it opens another Unittests session, and all the other open sessions have the "executing animation". Any ideas how to get the test session to stop when all tests are run? 回答1: This is a known problem for ReSharper, I've open

Trouble downloading PhantomJS generated pdf

混江龙づ霸主 提交于 2019-12-22 10:26:34
问题 I am having some trouble downloading a PhantomJS generated file to my asp.net application. I am running phantomJs as a server: The file is generated correctly and saved to disk in the PhantomJS folder, but something happens during the transfer and inclusion into my Http response stream. The file is downloaded by the browser, but when I try to open it, the file errors with the message that it can't be opened. I suspect it gets corrupted in the stream transfer? I would like to avoid reading the

How to get the height of a full html page in Phantomjs (javascript)?

旧巷老猫 提交于 2019-12-22 10:18:30
问题 Hi have tried all of these: document.body.scrollHeight document.body.offsetHeight document.documentElement.clientHeight document.documentElement.scrollHeight document.documentElement.offsetHeight These work in a normal browser but in Phantomjs I get the CMD (command-line window) height.. I want to get the height so that I can crop a screenshot later in the code.. and the height of the page must be as it is being viewed on a normal browser I'm getting 300 pixels and I want to get the full html

Running a RequireJS/WireJS app using PhantomJS

笑着哭i 提交于 2019-12-22 09:14:32
问题 I'm trying to execute a basic app that uses RequireJS (2.1.8), WireJS (0.10.2) and PhantomJS (1.9.2): When running the app using PhantomJS (this is my goal), WireJS fails to load (see error below). When running the app using Chrome, it completes properly. Please help to point out the missing part for WireJS to run properly under PhantomJS. Following are my app files. 1) app.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>SaphirJS.core</title> <script data-main="app"

CasperJS/PhantomJS failing SSL handshakes on some sites even with --ssl-protocol=any

旧街凉风 提交于 2019-12-22 08:13:07
问题 I've had issues with CasperJS and SSL, but using --ssl-protocol=any has always fixed the problem, as referenced in this answer. In this case, I'm still having issues. I put this in the command line: casperjs --ssl-protocol=any --ignore-ssl-errors=true sanity.js This is sanity.js: var casper = require('casper').create({ verbose: true, logLevel: 'debug' }); casper.on("resource.error", function(resourceError){ console.log('Unable to load resource (#' + resourceError.id + 'URL:' + resourceError

Phantom JS + Docker: html font-family is not respected when converting from HTML

[亡魂溺海] 提交于 2019-12-22 08:09:14
问题 When I run my phantomjs app in docker, in Node, it works fine (converting HTML to Jpeg). However, when I publish it to a docker container, the font names are no longer being respected. This app converts HTML into jpeg, pdf or other media, using html-convert npm, which is a wrapper for phantomjs dockerfile: FROM node:latest WORKDIR /app COPY package.json /app RUN npm install COPY . /app CMD node app.js EXPOSE 8081 package.json { "name": "htmlconverter", "version": "1.0.0", "description": "",

Adding a hash prefix at the config phase if it's missing

泄露秘密 提交于 2019-12-22 08:07:44
问题 I am now integrating phantom in my Angularjs-based web application. This fine article says that I should call the $locationProvider.hashPrefix() method to set the prefix to '!' from SEO reasons(allow crawlers to intercept the _escaped_fragment component of the URL). The problem is that I haven't though of the earlier, and some of my URLs look as following: #/home . I though perhaps there is a way that I can implant this '!' char into the begging of the URL programmatically(in case it is not

How to use phantomJS to simulate mouse hover on a HTML element

戏子无情 提交于 2019-12-22 06:40:38
问题 I have the phantomJS code below to fetch the HTML code: var page = require('webpage').create(); var url = 'http://example.com/'; page.open(url, function (status) { var js = page.evaluate(function () { return document; }); console.log(js.all[0].outerHTML); phantom.exit(); }); The content I want to fetch will only be read while the mouse is hover on the specific element which is controlled by JavaScript, so the code above is not working. I want to know how to simulate the mouse hover on a HTML

PhantomJS unexpected load behavior with multiple pages

限于喜欢 提交于 2019-12-22 06:23:24
问题 i have a script (below) that scrapes a site with a 3 step process. it works great when set to a maximum of 1 page at a time. however, when i increase that to 2 at a time things start getting wonky. the onFinished fires earlier than i would expect and the page isn't completely loaded yet. because of this the rest of my script breaks. any idea why this might be happening? i should add that i'm using the newest version (1.5). MAX_PAGES = 1 ### changing MAX_PAGES to >1 causes some pages

Issues getting CasperJS to upload image to file field - tried CasperJS fill() and PhantomJS uploadFile()

房东的猫 提交于 2019-12-22 05:09:12
问题 I'm trying to use CasperJS to upload images to a web-form. My form looks something like this: <form action="" method="POST" enctype="multipart/form-data" class="form-vertical"> ... <legend>Campaign Banner</legend> <div class="control-group image-field "> <label class="control-label">Now Large</label> <div class="controls"> <div class="file-field"><input id="id_now_large_image" name="now_large_image" type="file"></div> <div class="image-preview"></div> <div class="clear"></div> <span class=