phantomjs

Use jQuery DOM selector syntax in PhantomJS?

北城以北 提交于 2019-12-03 13:30:22
I'm learning PhantomJS and wondered if it's possible to use jQuery DOM selectors in the JS files PhantomJS runs? I've seen a short example on github that appears to indicate this: Sample of PhantomJS with Qunit (and jQuery?) If you look at the run-qunit.js file at the top it seems state you can use jQuery DOM selectors as parameters. But I'm getting errors when I do that-- not sure whether it's my syntax or because Phantom doesn't know about jQuery, so I thought I'd ask first about the PhantomJS/jQuery relationship. Sandip Mondal Use page.injectJs('jquery-1.6.1.min.js'); it will work fine.

PhantomJS not captured when ran via build server

跟風遠走 提交于 2019-12-03 13:26:35
I am using Karma and PhantomJS with Jasmine to test my AngularJS. When I run my gulp test locally it works fine, launches PhantomJS and runs all my tests, but when the tests get run on the build server it fails with the following errors: Note that I am using VSTS and using their built in cloud build system (hosted agent). Having said that its pretty much a task runner and I only use it to run gulp tasks (build, test etc) on checkin [32m13 07 2016 15:21:32.260:INFO [karma]: [39mKarma v1.1.1 server started at http://localhost:9876/ [32m13 07 2016 15:21:32.262:INFO [launcher]: [39mLaunching

phantomjs pdf to stdout

我的梦境 提交于 2019-12-03 13:04:54
I am desperately trying to output a PDF generated by phantomJS to stdout like here What I am getting is an empty PDF file, although it is not 0 in size, it displays a blank page. var page = require('webpage').create(), system = require('system'), address; address = system.args[1]; page.paperSize = {format: 'A4'}; page.open(address, function (status) { if (status !== 'success') { console.log('Unable to load the address!'); phantom.exit(); } else { window.setTimeout(function () { page.render('/dev/stdout', { format: 'pdf' }); phantom.exit(); }, 1000); } }); And I call it like so: phantomjs

Element.Click not executed when using PhantomJS selenium webdriver in .Net

自古美人都是妖i 提交于 2019-12-03 12:53:12
问题 I am using our existing tool that works perfectly using the Firefox and Chrome implementations of the Selenium IWebdriver. I am now doing some experimentation using the PhantomJS implementation. So far so good. However, as soon as I want to click a button it does nothing. I can retrieve the element, however, looking closer at its properties the 'Selected' property states the following: Error Message => 'Element is not selectable' caused by Request => {"headers":{"Accept":"application/json,

Generate pdf files phantomjs, repeating HEADER

久未见 提交于 2019-12-03 12:32:32
问题 I'm generating pdf files using phantomjs but I would like to repeat a defined header with HTML, it works when there are no images but as soon I add it doesn't work page.viewportSize = { width: 600, height: 600 }; page.paperSize = { format: 'A4', orientation: 'portrait', margin: '0px', header: { height: "1.2cm", contents: phantom.callback(function(pageNum, numPages) { return '<img src="https://www.google.com.bo/images/srpr/logo4w.png" height="0.95cm"/>'; }) }, footer: { height: "0.7cm",

Passing a value from PhantomJS to node.js

≯℡__Kan透↙ 提交于 2019-12-03 12:32:06
问题 I have a phantomJS script that is executed via an exec() call in a node.js script. Now I need to return a string from the PhantomJS script so that it can be utilized back in node. Is there a way to achieve that ? Node app: child = exec('./phantomjs dumper.js', function (error, stdout, stderr) { console.log(stdout, stderr); // Always empty }); dumper.js (Phantom) var system = require('system'); var page = require('webpage').create(); page.open( system.args[1], function (status) { if (status !=

How to render an html element using phantomjs

江枫思渺然 提交于 2019-12-03 12:30:17
问题 I want to save the image inside the div specified in the code. But using the code below i"m getting some other portion rendered. Is this the correct way to do it? I'm just a beginner in phantomjs. So Please help. var page = require('webpage').create(); page.open("http://n1k0.github.io/casperjs/#phantom_Casper_captureSelector", function (status) { if (status !== 'success') { console.log('Unable to load the address!'); } else { var clipRect = page.evaluate(function () { return document

Running Selenium on Azure Web App

夙愿已清 提交于 2019-12-03 12:24:53
I have an Azure Web App that I want to use to screen scrape a website when I call an Action on a controller, like so. var driver = new PhantomJSDriver(); driver.Url = "http://url.com"; driver.Navigate(); var source = driver.PageSource; var pathElement = driver.FindElementByXPath("//table[@class='someclassname']"); string innerHtml = ""; IJavaScriptExecutor js = driver as IJavaScriptExecutor; if (js != null) { innerHtml = (string)js.ExecuteScript("return arguments[0].innerHTML;", pathElement); } return innerHtml; This works fine locally, however when I upload to my Azure Web App, I get this

PhantomJS and iFrame

浪尽此生 提交于 2019-12-03 12:23:42
问题 I'm using phantomjs(1.5) and casperjs for my functional tests. casper = require('casper').create loadImages: false casper.start 'http://vk.com', -> @fill 'form[name="login"]', { email: mail, pass: pass}, true casper.thenOpen "http://vk.com/#{app}", -> @echo "User at #{app}" casper.then -> @click "iframe['element']" #?! how I can do it? casper.then -> @wait 2000000, -> @echo "exit from room: #{num}" casper.run() So, I login to vk.com (social network in Russia), my app loaded with iframe. How I

CasperJS : Why does my url change to about:blank when my page is loaded?

与世无争的帅哥 提交于 2019-12-03 12:13:21
问题 I'm a beginner at PhantomJS/CasperJS. I just want to start a session and verify that it's OK. Here's my code: var casper = require('casper').create({ verbose: true, logLevel: 'debug', pageSettings: { loadImages: false, loadPlugins: false, userAgent: 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0' } }); casper.on('remote.message', function(msg) { this.echo('remote message caught: ' + msg); }); casper.on("page.error",