phantomjs

Error: Unexpected request: GET views/partials/* for a nested directive even when using html2js in karma/jasmine unit test

自闭症网瘾萝莉.ら 提交于 2019-12-05 07:54:18
I am using Karma and Jasmine for unit testing for my angularjs application. I have a directive's(say Directive A) template in which another directive(say Directive B) is getting rendered, although it is working fine in application but test case fails to render the Directive B's template. Following is the error I get :- Error: Unexpected request: GET views/partials/directiveb.html Expected GET https://my-sandbox.app.com/123456 Below is the directive A's code :- angular.module('myApp') .directive('directiveA', function (myservices, myOtherServices) { return { controller: function(){ /* ...

Web scraping with CasperJS returns strange error that isn't documented

做~自己de王妃 提交于 2019-12-05 07:14:28
I wrote an web scraping script with CasperJS and it works perfectly on Mac OS 10.10.4 with CasperJS version 1.1.0-beta3 and PhantomJS version 1.9.8, but when I put the same script on one of my servers which is Ubuntu 14.04 (running inside Docker container) with the same environment (CasperJS and PhantomJS all the same versions) it suddenly just outputs this: I'm `fs` modules Which is pretty strange. One of my suggestion is that in this script I am also trying to require some other scripts with require like that: var parsingStrategy = require(strategiesPath + strategyName); and the path to

Amazon web scraping

淺唱寂寞╮ 提交于 2019-12-05 07:03:34
问题 I'm trying to scrape Amazon prices with phantomjs and python. I want to parse it with beautiful soup, to get the new and used prices for books, the problem is: when I pass the source of the request I do with phantomjs the prices are just 0,00, the code is this simple test. I'm new in web scraping but I don't understand if is amazon who have measures to avoid scraping prices or I'm doing it wrong because I was trying with other more simple pages and I can get the data I want. PD I'm in a

PhantomJS does not take arguments to function passed to page.evaluate()

痞子三分冷 提交于 2019-12-05 05:32:48
I can't pass arguments to function passed to page.evaluate . I am trying to submit form. data1 = "Textsample"; page.evaluate(function(data1) { var form = document.getElementById ("MyForm"); form.data.value = data1; form.submit(); }); But when I'am taking screenshot of page the data field is filled with "undefined". What am I doing wrong and how to fix it? Shikiryu You need to pass it as 2nd arg in page.evaluate . page.evaluate(function(arg){},arg); 来源: https://stackoverflow.com/questions/28524130/phantomjs-does-not-take-arguments-to-function-passed-to-page-evaluate

Yeoman generator always get some error

心已入冬 提交于 2019-12-05 05:32:33
When I'm trying using yeoman web generator, although it's working, but looking through the whole generate progress, it always gives me some errors below, no matter what generator I used, they are always there. npm ERR! phantomjs@1.9.7-6 install: `node install.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the phantomjs@1.9.7-6 install script. npm ERR! This is most likely a problem with the phantomjs package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node install.js npm ERR! You can get their info via: npm ERR! npm owner ls phantomjs

Is there a way to disable Google Analytics tracking in PhantomJS?

百般思念 提交于 2019-12-05 04:33:31
I want to track some sites using PhantomJS, but I don’t want to spam peoples Google Analytics. Is there a way to disable the Google Analytics tracking script (ga.js / analytics.js) from sending data to Google? Like it is possible with the usual GAOptOut browser plugins. I had a look in the Chrome Plugin and tried the code from that, but it doesn’t seem to be executed when telling PhantomJS to do so (onLoadStart). Use page.onResourceRequested method to abort all requests to google analytics. page.onResourceRequested = function(requestData, request) { if ((/google-analytics\.com/gi).test

Rendering rotated text to PDF in PhantomJS

十年热恋 提交于 2019-12-05 04:24:25
I have a HTML page, which contains several pieces of text that are rotated using the following piece of CSS: .rotate { transform: rotate(90deg); transform-origin: 50% 50%; } When I pull up the page directly in the browser this renders as expected. When I render the page through PhantomJS, it seems to ignore the rotation. I upgraded to Phantom 2.0.0, but still the same issue. Is there any way to make this work? I tested it with PhantomJS 1.9.18 in a node application. With -webkit-transform and -webkit-transform-origin the text on the generated PDF is rotated. Withouth the -webkit prefixes its

How to install wraith on windows 7

廉价感情. 提交于 2019-12-05 02:07:21
问题 Does anyone knows (maybe all relevant steps) how I can run/install Wraith on Windows 7? The documentation (http://bbc-news.github.io/wraith/index.html#Installation) is unfortunately very vague. Thanks in advance Martin 回答1: Required downloads: https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-windows.zip http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p481.exe?direct http://cdn.rubyinstaller.org/archives/devkits/DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe http

Adding Cookies working with Firefox webdriver but not in PhantomJS

若如初见. 提交于 2019-12-05 01:34:22
问题 I have a pickle with cookies that I create through the following command def doLogin(driver): #do login stuff pickle.dump(driver.get_cookies(), open("cookies.pkl", "wb")) I have the sample code to get the cookies driver = webdriver.PhantomJS() self.doLogin(driver) driver.delete_all_cookies() for cookie in pickle.load(open("cookies.pkl", "rb")): driver.add_cookie(cookie) I can see that it creates the cookie well because if I print it it's fine the add_cookie() is doing shady things This gives

How to save page in Firefox, Chrome, PhantomJS with selenium webdriver?

烂漫一生 提交于 2019-12-05 01:14:49
问题 I want to save a web site and download file into specific folder. How can I do it with webdriver? In Chrome and Firefox I just press Ctrl + S then select a folder to save the current website. Is there any way to do it in selenium webdriver? Can PhantomJS do it? 回答1: My conclusion is that you cannot do this with the current features of selenium. Why? The two available features from Selenium that are relevant for your needs are: taking screenshot and retrieving the html source of the page