phantomjs

Is there a way to visually see what has been render by PhantomJS on a Browser

对着背影说爱祢 提交于 2019-12-11 03:25:51
问题 I know you can render/rasterize a web page to image or PDF in PhantomJS, but is there a way to do it inside a browser like for example on iframe, to use PhantomJS as an engine to show the source in a browser? I need the render to be interactive Thanks in advance! 回答1: There is no built-in way of doing this and especially not in an interactive fashion. PhantomJS is headless browser, but a complete browser nonetheless. It cannot be simply put into another browser without much much work. One

PhantomJS page.open freezes

拈花ヽ惹草 提交于 2019-12-11 03:13:24
问题 I am trying to open a website using PhantomJS using the Capture example var page = require('webpage').create(); page.open('http://github.com/', function() { page.render('github.png'); phantom.exit(); }); The code works fine on my local machine, using Ubuntu 14.04. But when I run the code on a virtual server, the callback is never called and the script does not exit. The server and my local machine are running the exact same setup. I tried it on 2 different servers on virtualised with VMWare

Mink + PhantomJS: How do I set the user agent?

梦想的初衷 提交于 2019-12-11 03:06:35
问题 I am using phantomjs with mink: default: extensions: Behat\MinkExtension\Extension: goutte: ~ selenium2: browser: phantomjs wd_host: http://localhost:8643/wd/hub capabilities: webStorageEnabled: true But I need to masquerade as the latest chrome. I have tried this: /** * @BeforeStep */ public function masqueradeAsLatestChrome(StepEvent $event) { $this->getSession()->setRequestHeader('User-Agent', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049

submitting simple form and capturing before and after screen

半世苍凉 提交于 2019-12-11 02:33:01
问题 im trying to submit a simple form with phantomjs here is my code var webPage = require('webpage'); var page = webPage.create(); page.settings.userAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36'; page.onLoadFinished = function(){ page.render("after_post.png"); console.log("done2!" ); phantom.exit(); }; page.open('http://localhost/bimeh/phantom/testhtml.php', function(status) { page.includeJs("http://code.jquery.com/jquery

How to trigger a window.scrollTo(x, y) in phantomJS

北城余情 提交于 2019-12-11 02:17:02
问题 I open a web page, and I want trigger a scrolling in onLoadFinished callback. but it dose't working. I also tried scrollPosition and set timer to sent key event. Both of them dose't working. So ask for help. page.onLoadFinished = function() { window.scrollTo(0, document.height); } page.open('http://www.XXX.com', function (status) { if (status !== 'success') { console.log('Unable to open weibo.com'); } } 回答1: Why would you need scrolling if you could open the page in the whole size? Just set

NightmareJS screenshot callback

☆樱花仙子☆ 提交于 2019-12-11 02:09:50
问题 I'm using this framework to make screenshots of several urls. The process of taking the screenshot is async, and the method does not provide a way to execute a callback, and I want to execute a callback when each screenshot is made on this script: nightmare = new Nightmare(); urls.forEach(function (url) { nightmare.goto(url).screenshot(path); }); nightmare.run(function () { console.log('finished all'); }); Any ideas how can I do this? 回答1: I found a way to do this, with the "use" method for

PhantomJS & Conductor Framework

守給你的承諾、 提交于 2019-12-11 01:58:53
问题 I'm using the Conductor framework to run my tests, and I want to run the tests with PhantomJS. Even though PhantomJS is installed in the expected directory, Conductor is complaining that it isn't. JUnit config on my test: @Config(browser = Browser.PHANTOMJS, url = "http://url") Log Output: Nov 23, 2015 10:58:32 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init> INFO: executable: /Users/richhunt/IdeaProjects/selenium/phantomjs Nov 23, 2015 10:58:32 AM org.openqa.selenium.phantomjs

Karma for automatic user interaction testing?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 01:58:23
问题 I'm testing a setup with Karma + Mocha. One of the things this might (?) do is testing user-interaction on a variety of browsers including PhantomJS (headless webkit). I say might because I'm not sure how to get basic PhantomJS functionality to work within a Karma+Mocha setting. I.e: var page = require("webpage").create(); is supposed to be a canonical example in PhantomJS to start-off with, but Karma can't locate require . Now, I might be able to solve this by including require.js to Karma,

CasperJS- Register on a site and validate the mail sent on Gmail -for both slimer and phantom-

≡放荡痞女 提交于 2019-12-11 01:56:25
问题 Edit : this is the windows behaviour, with linux it just fails. First, if you succeeded navigate on gmail with casper (without random waiting time -from 20sec to 5min-), please tell me. I want to register on our site, then validate my registration automatically with Gmail (an entire register step). Did someone do that before? I have no problem to register, and I can login on my mailbox (Gmail) but after i have some troubles to navigate and validate my registration in Gmail, and i observe

How to have Phantomjs execute a js file on Windows

霸气de小男生 提交于 2019-12-11 01:40:31
问题 I just executed phantomjs.exe and a command line window popup. How could I execute the .js files under ./examples/? If just enter the file name "version.js", I got the error message - "cannot find the variable: version". Thank you! 回答1: Open the command window - this can be done by holding SHIFT + Right mouse click and there is a choice of Open command window here... From the command line you can then invoke the phantomjs.exe $ path/to/phantomjs.exe path/to/version.js 回答2: You can also create