phantomjs

phantomjs doesn't support flash player in windows machine

大城市里の小女人 提交于 2019-12-06 11:56:34
问题 I am developing a python script to take screenshots from many websites. for this I am using below tools, phantomjs with selenium python windows PC I have used pyside(instead of phantomjs) for that job but I faced many issues on pyside.. now I have found phantomjs tool from Google.com, I have used phantomjs with selenium for python in windows machine it is working flawless. but it has only one issue phantomjs doesn't support flash player, so am not able to process youtube and some flash

Load file into IMAGE object using Phantom.js

*爱你&永不变心* 提交于 2019-12-06 11:48:31
问题 I'm trying to load image and put its data into HTML Image element but without success. var fs = require("fs"); var content = fs.read('logo.png'); After reading content of the file I have to convert it somehow to Image or just print it to canvas. I was trying to conver binary data to Base64 Data URL with the code I've found on Stack. function base64encode(binary) { return btoa(unescape(encodeURIComponent(binary))); } var base64Data = 'data:image/png;base64,' +base64encode(content); console.log

Node-phantom show number of generated pdf pages

主宰稳场 提交于 2019-12-06 11:35:46
问题 I am facing problem to get the number of generated pdf pages in phantomjs. Basically I am using phantomjs with nodejs and I want to show total number of pages in page 5. function generatePdf() { // Load ejs template fs.readFile(__dirname + '/../pdf' + pdfpath, 'utf8', function (err, data) { var fileName = __dirname + '/pdfdata/' + f.formType + f.formId + '.pdf'; // Render the page to variable. var html = ejs.render(data, pdfJSON); fs.writeFile(__dirname + '/pdfdata/test.html', html, function

loop through array of urls in phantomjs using javascript

こ雲淡風輕ζ 提交于 2019-12-06 11:07:14
问题 I'm trying to get my code to loop through an array of urls but getting stuck. This bit of code simply runs in phantomjs and outputs the requested url and the redirects for any main resource objects. I'd like to use an array as an input to this process like: var pageUrl = [ 'http://www.google.com', 'http://www.facebook.com' ]; here's the original var sys = require('system'); var pageUrl = 'http://www.google.com'; console.log("Requested URL: " + pageUrl); var renderPage = function (url) { var

RSelenium Error: Can't Connect to Host; Selenium Server is not running

那年仲夏 提交于 2019-12-06 10:28:47
I am getting the following error: "Error in checkError(res) : Couldnt connect to host on http://localhost:4444/wd/hub . Please ensure a Selenium server is running." I'm using a mac version 10.9.5, and downloaded all of the latest versions of packages and java. My code is: library(rvest) library(RSelenium) library(wdman) setwd(Path to selenium standalone file) pJS <- phantomjs(pjs_cmd = "/phantomjs-2.1.1-macosx/bin/phantomjs") remDr <- remoteDriver(browserName = "phantomjs") Sys.sleep(5) remDr$open(silent = FALSE) And then I get the mentioned error. I've tried using the "java -jar selenium

Connection refused when phantomjs is run on different machine than selenium hub

拟墨画扇 提交于 2019-12-06 09:38:19
问题 Is it possible to have a selenium hub on one machine and an instance of phantomjs on a different computer that connects to the hub in the same manner as a selenium node? If I start a selenum hub and an instance of phantomjs on the same machine, I can successfully run tests. If I start a selenium hub and start a selenium node a different machine and run a test with firefox, the test is executed successfully. If I start a selenium hub and an instance of phantomjs on a different machine,

PhantomJs - Getting value out of page.evaluate + ajax (Synchronous Version)

不羁的心 提交于 2019-12-06 09:27:56
问题 Problem: Extracting data from ajax request inside page.evaluate Description: I usually get variables out of page.evaluate by simply returning them. However, I need to make an ajax request within the context of a page, and then I need to process its result out of the page's context. The code I'm trying to fix is: var theOutput = page.evaluate(function () { return $.ajax({ async: false, url: 'http://localhost:8080/captcha.php', data: { filename: 'C:\\wamp\\www\\images\\0.png' }, type: 'post',

Scrolling with phantomJs Selenium

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 07:59:28
问题 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

PhantomJS WebPage memory consumption?

北战南征 提交于 2019-12-06 07:45:37
Is there a programmatic (since i want to do it automatically at runtime) way to see how much memory a webpage uses when running it through PhantomJs? I am also using casperjs if that could be helpful. I have searched a lot but haven't found any way. PhantomJs uses QtWebKit so I don't have access to window.performance.memory. I want to have this information since I am setting up automated performance tests for a web application. Thanks in advance No, at this time this feature is not supported, but I have found issue about that https://github.com/ariya/phantomjs/issues/10031 来源: https:/

Phantomjs creating black output from SVG using page.render

末鹿安然 提交于 2019-12-06 07:36: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\":