phantomjs

Angular 2 + Karma + karma-jspm + karma-coverage + typescript report phantomJS failure

旧城冷巷雨未停 提交于 2019-12-11 14:02:17
问题 I've been fighting the last few days with getting coverage reports working and I've hit an issue I haven't been able to resolve. The stack trace I'm receiving, with a couple of lines of surrounding debug code, is 15 07 2016 14:41:53.413:DEBUG [middleware:source-files]: Requesting /jspm_packages/npm/process@0.11.5/browser.js / 15 07 2016 14:41:53.413:DEBUG [middleware:source-files]: Fetching /jspm_packages/npm/process@0.11.5/browser.js 15 07 2016 14:41:53.415:DEBUG [proxy]: proxying request -

Angular2, TypeScript, PhantomJS - Can't find variable: Audio

纵然是瞬间 提交于 2019-12-11 14:01:57
问题 PhantomJS doesn't support HTML5 Audio tags, which is making it difficult to test my Angular2 app. I've looked around for a solution, but unfortunately I haven't been able to figure out a way to mock the Audio object or somehow get around this. I have an Angular2 service that looks like this: import {Injectable} from 'angular2/core'; @Injectable() export class MyService { var snd; constructor() { this.snd = new Audio('Assets/sound.wav'); } simpleFunction() { return true; } } My test looks like

Need to open an array of URL's in PhantomJS

隐身守侯 提交于 2019-12-11 13:41:18
问题 I have created a script in phantomJs. What it does is, it fetches some elements from a specific page which works fine. Here is the code: var page = new WebPage(), testindex = 0, loadInProgress = false, fs = require('fs'), i = 0, j = 0, k = 0; page.onConsoleMessage = function(msg) { console.log(msg); }; page.onLoadStarted = function() { loadInProgress = true; console.log("load started"); }; page.onLoadFinished = function() { loadInProgress = false; console.log("load finished"); }; // Sets the

Not able to switch Frame in PhantomJS but switches successfully with Firefox using selenium python

余生颓废 提交于 2019-12-11 12:27:33
问题 The following command runs successfully with Firefox Driver but with PhantomJS I am facing an error message: driver.switch_to.frame(frame) Error Message with PhantomJS: errorMessage":"Unable to switch to frame" Has anyone faced the issue previously and can help me here? 回答1: PhantomJS/GhostDriver has this issue which has been resolved - https://github.com/detro/ghostdriver/issues/194 Below statements work with GhostDriver. There is no difference in the statements that have to be used with

SocketIO + PhantomJS emit not working

岁酱吖の 提交于 2019-12-11 12:12:16
问题 I am having a pretty specific problem but I hope people can point me in the right direction for how to debug or even fix it. I am trying to write a local client which can run and test a webpage I had built which uses SocketIO. I am running Phantom with the command line option --web-security=false since otherwise no in or out connections are legal as my local tester is not considered part of the same origin as my website I am testing (had to fix that before the listening would work). Using

POST parameters strangely parsed inside phantomjs

空扰寡人 提交于 2019-12-11 11:57:55
问题 I am working with PHP/CURL and would like to send POST data to my phantomjs script, by setting the postfields array below: In my php controller I have: $data=array('first' => 'John', 'last' => 'Smith'); $url='http://localhost:7788/'; $output = $this->my_model->get_data($url,$data); In my php model I have: public function get_data($url,$postFieldArray) { $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT

Phantomjs Alternative - RFC6455 WebSocket Standard required

北城以北 提交于 2019-12-11 11:40:25
问题 Unit Testing javascript frontend with phantomjs however the websockets unable to authenticate (401) requests. Did some research found that Phantomjs using older Webkit with older standard. What Alternative headless browser could I use instead of Phantomjs with the latest Websocket Standards? 回答1: http://slimerjs.org/ has the same API and can be run headlessly with xvfb. It runs the gecko engine through your installed firefox. So you will have web socket support. There is also http://triflejs

CasperJS inject javascript via this.evaluate

[亡魂溺海] 提交于 2019-12-11 11:33:20
问题 Today I tried to inject some javascript logic into remote page using CasperJS with PhantomJS together. Well, I'm quite surprised because of that: casper.then(function() { console.log(this.evaluate(function() { function myMethod() { return 'Any thing?!'; } return myMethod(); })); console.log(this.evaluate(function() { return myMethod(); })); }); I tried many combinations... Like: casper.evaluate(...) this.evaluate(...) casper.page.evaluate(...) <- directly to phantomJS this.page.evaluate(...)

How to ensure that google map is loaded?

白昼怎懂夜的黑 提交于 2019-12-11 10:43:39
问题 I have to make screenshot of google maps using phantomjs. I dynamically pass few markers to web page that is being executed by phantom, draw them on map and then I call map.fitBounds(bounds) to make sure map will cover all markers. The problem is that I have to know when map (all tiles?) is loaded so I can make a screenshot. I know how to communicate from page executed by phantom to rendering script, but I don't know how to ensure that map is loaded. Here is my code: map = new google.maps.Map

Casperjs Not returning Google Search link titles BUT Screenshot & Source Code test works

你说的曾经没有我的故事 提交于 2019-12-11 10:27:42
问题 Appreciate someone can help me with this problem I'm having. Please see my image to understand further. https://onedrive.live.com/redir?resid=F95DD828CA2E63D7!1326&authkey=!AEbavlKl38fBJYI&v=3&ithint=photo%2cjpg I have a screenshot of the actual CasperJS html capture. It shows that casperjs correctly entered the field in google. The problem is CasperJS not calling my function getLinks >> links = this.evaluate(getLinks);. >> it returns null. I have tested the actual selector >>