phantomjs

How to hide FirefoxDriver (using Selenium) without findElement function error in PhantomDriver(headless browser)?

蹲街弑〆低调 提交于 2019-12-01 13:52:52
I try to make hidden FirefoxDriver. According to my research I must use PhantomJSDriver but when I use PhantomJSDriver driver.FindElement statement no longer does not work. var options = new PhantomJSOptions(); options.AddAdditionalCapability("phantomjs.page.settings.userAgent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.94 Safari/537.36"); PhantomJSOptions p = new PhantomJSOptions(); var service = PhantomJSDriverService.CreateDefaultService(); service.SslProtocol = "any"; service.ProxyType = "http"; service.WebSecurity = false; service

browserify Error : http.createServer is not a function

Deadly 提交于 2019-12-01 13:25:42
I tried to browserify this node js script : var phantom = require('phantom') phantom.create(function(ph) { ph.createPage(function(page) { page.open("editor.html", function(status) { console.log("opened diagram? ", status); page.evaluate(function() { return document.getElementById("GraphImage").src; }, function(result) { //console.log(result); ph.exit(); }); }); }); }); So I used this command: browserify myscript.js > bundle.js and when I run bundle.js from an html file I get this error: http.createServer is not a function it seems that browserify does not support httpserver. How can I resolve

Using CasperJS as a Portable Installation?

泄露秘密 提交于 2019-12-01 12:33:07
I'm trying to run CasperJS in a portable way that doesn't involve setting the path variable in Windows. Currently I have gotten this to partially work by moving the phantomjs executable along with the entire contents of the CasperJS directory to the batchbin folder. I also edited the batch file to make it initialize casperJS using the current directory, which is where all the files are located. Here is my directory with all the files: http://i.imgur.com/ByTjU0s.png My casperjs.bat file: @ECHO OFF set CASPER_PATH=%~dp0 set CASPER_BIN=%CASPER_PATH%bin\ set ARGV=%* call phantomjs "%CASPER_BIN

Chinese characters showing as question marks

非 Y 不嫁゛ 提交于 2019-12-01 12:10:41
问题 This has been asked before, but I can't figure out what's wrong. I'm printing pdfs using phantomjs .render() . The rendered page is basically a local static site with these properties: <meta charset="UTF-8"> font: normal 17px helvetica,arial,verdana,sans-serif running and tested on Windows locally and Azure Worker Roles Chinese language pack installed and working when printing the same page from Chrome (Installed fonts e.g. Arial Unicode MS, SimSun ...) Latin characters are all fine, just

CasperJS/PhantomJS .then in do/while Loop Doesn't Work

六眼飞鱼酱① 提交于 2019-12-01 11:55:09
Something like this seemed pretty logical to me but caused phantom to wtfcrash (That's what it's called in the log but doesn't give helpful info)... do { casper.then(function() { var targetFound = false; links = this.evaluate(getLinks); var searchResultsAr = []; for (var link in links) { searchResultsAr.push(links[link].replace('/url?q=', '').split('&sa=U')[0]); } for (var result in searchResultsAr) { if (searchResultsAr[result] == target) { targetFound = true; casper.echo(targetFound); break; } } if(targetFound) { break; } }); }while(!targetFound); dasmelch There are different possibilies, if

Making a movie from the url using ffmpeg and phantomjs

夙愿已清 提交于 2019-12-01 11:26:11
问题 Im Taking screen shots from a url, using phantomjs using the setIntreval function (25 right now) and then piping the output to the ffmpeg (Using the frame rate -r 24). Here is the Code. ffmpeg.js var page = require('webpage').create(); page.viewportSize = { width: 1024, height: 768 }; page.open('http://ewoken.github.io/Leaflet.MovingMarker/', function () { setInterval(function() { page.render('/dev/stdout', { format: "png" }); }, 25); }); Then I run the script using this. phantomjs ffmpeg.js

Run/Execute CasperJS script by clicking a button on webpage

纵饮孤独 提交于 2019-12-01 10:48:55
I have a casperJS script which returns a JSON when run on commandline. I want to have an arrangement such that 1) I create a webpage 2) On clicking a button on the webpage the casperJS scripts gets executed at the server side and post/return the result back to the webpage. How can i do the same. EDIT: I am invoking an AJAX process written in php on clicking the buttom. The php script contains echo exec('casperjs sample.js'); It returned nothing but on checking the webserver error log I got the error 'casperjs' is not recognized as an internal or external command, operable program or batch file

Can't pass array items to function in PhantomJS

拜拜、爱过 提交于 2019-12-01 09:54:44
I am trying to pull the source code to several webpages at once. The links are fed into the array via a source text file. I am able to iterate through the array and print out the links and confirm they are there, but when trying to pass them through a function, they become undefined after the first iteration. My ultimate goal is to have it save the source of each page to its own document. It does the first page correctly, but subsequent attempts are undefined. I've searched for hours but would appreciate it if someone could point me in the right direction. var fs = require('fs'); var

Using Phantom.js evaluate, how can I get the HTML of the page?

别说谁变了你拦得住时间么 提交于 2019-12-01 09:37:45
page.evaluate(function() { return document; }, function(result){ console.log(result) next(); }); result is actually a huge object. I don't know the properties and attributes of that object. I just want the HTML of the page as you would see it in Chrome inspector . From the look of the object, it seems that the HTML includes CSS and javascript..which is weird. The user should not see the CSS and javascript, because they are not the web page's HTML. Those are external files. I only want the HTML that the user would see. The type of document is an HTML document. To get the entire DOM as a string,

How to run casperJS script from php API

杀马特。学长 韩版系。学妹 提交于 2019-12-01 09:00:07
问题 I have a casperJS script which returns JSON when run via commandline. I want to make an API preferably in PHP which runs the script as in commandline (casperJS sample.js) and returns the JSON as result. 回答1: You can use php-casperjs library which is a simple wrapper for casperjs . 回答2: I think you can use php exec() function as shown below to do this echo exec("/home/user/casperjs/bin/casperjs /full/path/to/your_script.js"); 来源: https://stackoverflow.com/questions/18302267/how-to-run-casperjs