phantomjs

Jasmine test fails running in VS2012 + Resharper + PhantomJS

心已入冬 提交于 2019-12-02 02:43:19
问题 I tried to run a jasmine unit test in resharper 7 in vs2012 but its failing. resharper + phantomjs is running it in autogenerated url which maybe the cause of the failure is there a way to configure the test to use an absolute or a known URL? UPDATE I added js reference in my *spec.js file /// <reference path="../jasmine/jasmine-html.js" /> /// <reference path="../jasmine/jasmine.js" /> /// <reference path="../jasmine/boot.js" /> /// <reference path="../jasmine/console.js" /> /// <reference

page.set('content') doesn't work with dynamic content in phantomjs

扶醉桌前 提交于 2019-12-02 02:41:30
I tried to use phantomjs for screen capturing my page with node-phantom bridge. Here is what I'm trying: var phantom = require('node-phantom'); phantom.create(function (err, ph) { return ph.createPage(function (err, page) { return page.set('content', '<html><head></head><body><p>Hello</p></body></html>', function (err, status) { return page.render('./content.png', function (err) { ph.exit(); }); }); }); }); That works fine, but if I try to set content which contains javascript, that doesn't work. Please help me, why does it not work? EDIT: This doesn't work: var phantom = require('node-phantom

linux安装phantomjs

谁说胖子不能爱 提交于 2019-12-02 02:30:51
一.下载PhantomJS;   从官网http://phantomjs.org/download.html下载linux64位的安装包即 phantomjs-2.1.1-linux-x86_64.tar.bz2   #tar -xjvf phantomjs-1.9.7-linux-x86_64.tar.bz2 如果报没找到命令,则yum install -y bzip2 如果镜像下载不下来,也可本地用360解压好,直接上传到服务器 或者镜像命令一直不行,考虑重启镜像 yum clean all   rpm --rebuilddb 安装依赖——fontconfig和freetype:   #yum install fontconfig freetype2 将可执行文件放入系统路径:   #sudo ln -s /usr/soft/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs 添加权限 sudo chmod u+x,o+x /usr/soft/phantomjs-2.1.1-linux-x86_64/bin/phantomjs如果还是不行,可以考虑加入环境变量中,修改etc/profile文件 在终端下测试Phantomjs。你应该会看到如下输出:  #phantomjs -v 1.9.7  

Custom casperjs modules

自作多情 提交于 2019-12-02 02:11:17
I've extended my casperjs to use some new methods like this one : casper.getTxt = function(selector) { if(this.exists(selector)) { return this.getHTML(selector); } else { return ''; } }; I've to add these functions on every script that I write. so I made a new file custom.js on the same location where other modules( colorizer.js , mouse.js etc) were placed. custom.js has following code : var require = patchRequire(require); var casper = require('casper').create(); var getTxt = function(selector) { if(casper.exists(selector)) { return casper.getHTML(selector); } else { return ''; } }; exports

Jasmine test fails running in VS2012 + Resharper + PhantomJS

自作多情 提交于 2019-12-02 01:56:17
I tried to run a jasmine unit test in resharper 7 in vs2012 but its failing. resharper + phantomjs is running it in autogenerated url which maybe the cause of the failure is there a way to configure the test to use an absolute or a known URL? UPDATE I added js reference in my *spec.js file /// <reference path="../jasmine/jasmine-html.js" /> /// <reference path="../jasmine/jasmine.js" /> /// <reference path="../jasmine/boot.js" /> /// <reference path="../jasmine/console.js" /> /// <reference path="Player.js" /> /// <reference path="Song.js" /> /// <reference path="SpecHelper.js" /> and it fixed

Explain karma unit test times

落花浮王杯 提交于 2019-12-02 01:08:24
I've been searching the web for this for two days and I found nothing. Maybe I'm looking in the wrong way — I don't know... So here it is: what are the times on my console when running a Karma+Jasmine+phantomJs unit test? ... Executed 1 of 1 SUCCESS (0.878 secs / 0.112 secs) First, I though that the second time is the total unit test time (for example, when running multiple tasks), however, sometimes the first time gets to be 'bigger', sometimes not... Anyone? total time / net time net time = only test execution (in the browser) total time = how long it took since Karma noticed the file change

(window.beforeEach || window.setup) is not a function

廉价感情. 提交于 2019-12-02 01:02:36
I've tried to setup a testing environment with mocha, phantomjs and istanbul (and grunt). It works great so far, but when it comes to angular-testing i got some problems. I want (and need) to use angular-mocks, but as soon as I include it in my test.html, I get the following console-error in my browser: Uncaught TypeError: (window.beforeEach || window.setup) is not a function The matching code in amgular-mocks.js is the following one: (window.beforeEach || window.setup)(function() { annotatedFunctions = []; currentSpec = this; }); This happens both for the current version (1.4.3) and for an

Geb/Selenium tests hang loading new page

允我心安 提交于 2019-12-02 00:57:10
问题 My Selenium tests frequently hang indefinitely on CI, always at an attempt to load a new page in driver.get . I am using PhantomJS 1.9.8. After several rounds of debugging, I think I've traced the problem to the webpage load not completing in PhantomJS. Selenium RemoteWebDriver has sent a request to PhantomJS/GhostDriver and it is waiting on a response. GhostDriver is still accepting requests. I can see what page it's stuck on by hitting curl http://localhost:port/session/:sessionId/url and

PNG is not being rendered using PhantomJS with multiple attempts in a loop

↘锁芯ラ 提交于 2019-12-02 00:08:30
var page = require('webpage').create(); var filepath = "/home/abc/" + "abc.html"; //create path to charts.html for (i = 0; i < 3; i++) { // make three attempts console.log("hi") page.open(filepath, function(status) { console.log(status); //if(status !== 'success') { //if not success, make another attempt // continue; // } page.render('abc.png'); phantom.exit(); }); } phantom.exit(); running this code like this: $ phantomjs hello.js Q1: I am expecting abc.png to be generated in my home dir. However with current code it is not generated. Q2: Adding the commented out if block back causes the code

Phantomjs to scrape webpage function not working

岁酱吖の 提交于 2019-12-01 23:44:11
I am using phantomjs to learn how to scrape a webpage, so far I have developed the following code below.. I know that I am able to connect to the site, but I am unable to get data from the table at all..am I on the right track? My goal is to scrape data from the table on this site. I also understand that I need to use includeJs or injectJs to wait for the table to load else I would be scraping an empty html page. I am trying to put these concepts together, but am stuck for over 3 days now..please give some guidance.. var page = require('webpage').create(); console.log('Welcome to scraping...')