phantomjs

phantomjs javascript read a local file line by line

风流意气都作罢 提交于 2019-12-18 14:14:17
问题 I've never used javascript to read a file line by line, and phantomjs is a whole new ballgame for me. i know that there is a read() function in phantom, but I'm not entirely sure how to manipulate the data after storing it to a variable. My pseudocode is something like: filedata = read('test.txt'); newdata = split(filedata, "\n"); foreach(newdata as nd) { //do stuff here with the line } If anyone could please help me with real code syntax, I'm a bit confused as to whether or not phantomjs

cntlm proxy with phantomjs

本秂侑毒 提交于 2019-12-18 13:26:57
问题 I'm trying to use the cntlm proxy on my windows machine to talk to a local web application on IIS that uses Windows Authentication from PhantomJS. To create the proxy, I'm doing: cntlm -v -u username@domain -p password -l 1456 localhost:80 My app lives at localhost/myapp To test whether or not this works, I try to browse to localhost:1456/myapp but I always get an auth challenge and no sensible username/password combination seems to work. Any thoughts on why this setup might not be working as

Proxy in phantomjs

╄→гoц情女王★ 提交于 2019-12-18 11:49:06
问题 I cant understand how to using proxies in phantomjs, i tried phantomjs example.js --proxy="ip:port" phantomjs example.js --proxy=ip:port phantomjs example.js --proxy=ip:port --proxy-type=http but i see only my ip=( No any output, also if proxy ip apriori invalid. example.js: var page = require('webpage').create(); page.onConsoleMessage = function(msg) { console.log(msg); }; page.onLoadFinished = function(status){ if (!status){ console.log('fail'); phantom.exit(); } page.render("1.png");

Running Phantomjs on Heroku [closed]

给你一囗甜甜゛ 提交于 2019-12-18 10:54:12
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Is there a way to run phantomjs, a command-line tool, on Heroku? 回答1: check out this buildpack: https://github.com/stomita/heroku-buildpack-phantomjs I also am able to run the x86_64 build of PhamtomJS, just stuck in my app's vendor directory: http://phantomjs.org/download.html 回答2: In Version 1.5 we got rid of

How to download images from a site with phantomjs

孤者浪人 提交于 2019-12-18 10:46:29
问题 I wanna save some images from a site. At the moment I can get the paths to the images but I have no clue how to get and save the images with phantomJs. findRotationTeaserImages = -> paths = page.evaluate -> jQuery('.rotate img').map(-> return this.src).get() for path, i in paths console.log(path); //save the image 回答1: I know this is an old question, but you do this pretty simply by storing the dimensions and location of each image on the in an object, then altering the phantomjs page

java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.find(Ljava/lang/String;)Ljava/lang/String; while using PhantomJS 2.1.1 with Selenium

橙三吉。 提交于 2019-12-18 09:29:29
问题 OS - Windows 7 PhantomJS version - 2.1.1 Selenium - 3.8.1(selenium-server). JDK - 152. I'm trying to run simple test, using PhantomJS: 1) initializing the driver: System.setProperty("phantomjs.binary.path","src\\main\\resources\\phantomjs.exe"); WebDriver driver = new PhantomJSDriver(); 2) any test, let it be verifying text "welcome" on en.wikipedia.org: driver.get("http://en.wikipedia.org"); System.out.println(driver.findElement(By.xpath("//div[contains(text(),'Welcome')]")).isDisplayed());

Does PhantomJS store any persistent files by default?

喜你入骨 提交于 2019-12-18 09:28:02
问题 As a new user to PhantomJS I want to be sure that I understand how PhantomJS handles any persistence of data that it accumulates from a HTTP request. My question is: Does PhantomJS store any data persistently by default (i.e. a simple example where you are not using require('fs') anywhere in the script to store the request, just dumping it out to STDOUT ). I am assuming that all of the work from a page.evaluate() call is done in memory. Here is a simple example for illustration: var page =

How to set the browser language of PhantomJS

£可爱£侵袭症+ 提交于 2019-12-18 09:12:31
问题 I'm using DalekJS with PhantomJS to test a web application. I have important assertions which depend on the browser language. And these fail if the language is not English. Any Ideas how I can set the default browser language of pantomjs?? Cheers izocan. 回答1: This question has been further discussed here: https://groups.google.com/forum/#!topic/dalekjs/HHt6eoZRQc4 回答2: Let me answer my own question: The problem is solved when you use following code in your index.html: <script> localStorage

C# example of using PhantomJS webdriver ExecutePhantomJS to filter out images

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 08:27:42
问题 I am looking to be able to selectively turn on and off certain images. I've come across the following article: PhantomJS how to skip download resource I've also found this article which is very similar using python: Selenium driven by PhantomJS/Python I am presuming that I can do this via webdriver.ExecutePhantomJS(string script, params object[] args) . What I don't know is if I need to create some page object first via the Selenium PageFactory and then call this function? How would I turn it

Difference between PhantomJS 2.0 and PhantomJS 1.9

假装没事ソ 提交于 2019-12-18 07:46:08
问题 Can anyone give me the differences between those versions? What can I do in version 2 that I could not do in earlier versions? I use PhantomJS to execute code generated by Selenium. Will be there performance improvements? 回答1: PhantomJS 2 has a "new" WebKit version underneath. So it changed from 534.34 in PhantomJS 1 to 538.1 in PhantomJS 2. The difference in numbers in this dimension is not big, but there is a more than two year difference between the release of the two WebKit versions. See