phantomjs

casperJS failed Injecting jQuery

旧巷老猫 提交于 2019-12-10 11:27:22
问题 Does anyone know how come I am encountering [warning] [phantom] Failed injecting %s client side. Failed injecting includes/jquery-1.10.2.min.js client side when I have included 'includes/jquery-1.10.2.min.js' within the Casper constructor. Someone posted a similar question here: https://groups.google.com/forum/#!msg/casperjs/hY4ziaoXIEE/YFi8Sj4JysMJ, but I do not understand how they have incorporated the casper.evaluate() in their solution: casper.then( function() { this.evaluate(function($)

Better way to add PhantomJS binary to a maven project?

瘦欲@ 提交于 2019-12-10 10:54:14
问题 I tried using the phantomjs-maven-plugin to install phantomjs binary. I wanted to run my tests on a Tomcat7 server that is why I need to configure binary automatically. Here is my pom.xml <properties> <ghostdriver.version>1.2.0</ghostdriver.version> <phantomjs.version>1.9.7</phantomjs.version> <phantomjs-maven-plugin.version>0.7</phantomjs-maven-plugin.version> </properties> <dependencies> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version

How can I force PhantomJS to wait until MathJax is finished?

旧城冷巷雨未停 提交于 2019-12-10 10:28:23
问题 I'm trying to pre-render a MathJax html file using PhantomJS. For example, suppose in math.html I have: <!DOCTYPE html> <html> <head> <script type="text/javascript" src="MathJax/MathJax.js"></script> <script src="ConfigMathJax.js"></script> </head> <body> <span class="math">\(e = m c^2\)</span> </body> </html> My (broken) render script currently looks like: var page = require('webpage').create(); var system = require('system'); var fs = require('fs'); page.open(system.args[1], function () {

Phantomjs - Is there a way to pass parameters to th

痞子三分冷 提交于 2019-12-10 10:15:19
问题 Let's say I have this code in PHP to call Phantomjs shell_exec("phantomjs a-phantomjs-file.js"); Is there way to pass data from PHP to the phantomjs file? Some sort of commandline arguments perhaps? 回答1: There is a list of command line arguments for phantomjs here: https://github.com/ariya/phantomjs/wiki/API-Reference You can use string concatenation or interpolation to pass them from PHP, just be aware of and careful to protect against injection attacks if the arguments could ever be coming

How can I make casperjs repeat a loop until a certain condition is met?

南笙酒味 提交于 2019-12-10 09:46:27
问题 I'm trying to get casperjs working with the following situation: A web page loads, then within that page, it ajax loads data items along with a 'read more' button which in turn loads some more data items. I need the script to recursively check if the 'read more' button exists (as there are many data items to load), if so, click it, else continue with the rest of the script and output the full page as a jpeg. I've tried by writing the code below, but it doesn't loop as I had hoped. It just

How to correctly pass basic auth (every click) using Selenium and phantomjs webdriver

ε祈祈猫儿з 提交于 2019-12-10 05:42:12
问题 I am running some unittests with Selenium Webdriver. I have an entire test that runs successfully using webdriver.Firefox(), here is the setup: def setUp(self): self.driver = webdriver.Firefox() self.driver.implicitly_wait(30) self.base_url = "http://www.nike.com" self.verificationErrors = [] self.accept_next_alert = True The test runs successfully, however I have to manually enter in basic auth multiple times for the test to keep moving forward. In an attempt to bypass basic auth and have

How to pass PhantomJS path to Selenium Grid

廉价感情. 提交于 2019-12-10 04:52:56
问题 I'm getting an error when trying to set up a phantomjs node on Selenium Grid (https://wiki.jenkins-ci.org/display/JENKINS/Selenium+Plugin) I've set up the following custom json configuration: { "capabilities": [ { "browserName": "phantomjs", "phantomjs.binary.path": "/usr/bin/phantomjs", "platform": "LINUX", "maxInstances": 5 } ], "configuration": { "nodeTimeout":120, "port":5555, "hubPort":4444, "hubHost":"localhost", "nodePolling":2000, "registerCycle":10000, "register":true, "cleanUpCycle"

Does phantomJS support geolocations?

青春壹個敷衍的年華 提交于 2019-12-10 03:17:13
问题 I'm trying to run qunit test cases with PhantomJS. One of my tests are hanging in when phantomJS try to access the navigator.geolocation function of DOM. same test is working fine in the browser, just hangs in the console with phantomJS. doe phantomJS support geolocations ? any suggestion? breaks in the following if condition if(navigator.geolocation) { window.navigator.geolocation.watchPosition(updateLocation, null, { frequency: 3000 }); } 回答1: No. Simply check the features.js example.

How do I capture JavaScript errors generated in a page fetched by PhantomJS?

为君一笑 提交于 2019-12-10 02:06:07
问题 I have a PhantomJS script that loads a local HTML file, injects some javascript files, then executes some javascript in the context of the page. The javascript that runs generates an exception, but I only get output from the console, which doesn't seem to distinguish between an error and a normal log and doesn't have file, line numbers or a stacktrace. What I need is a way to capture or otherwise distinguish these errors. I have already tried: Wrapping my PhantomJS script in a try-catch

How can I set the viewport size of PhantomJS through grunt & jasmine?

此生再无相见时 提交于 2019-12-10 00:23:30
问题 I'm trying to test something using grunt + jasmine + phantomjs. This specific test requires a large viewport so the responsive styles render the large-screen version within phantomjs. I noticed in the grunt-contrib-jasmine plugin this code, which would seem to allow for setting phantomjs options: // Merge task-specific options with these defaults. var options = this.options({ ... phantomjs : {}, ... }); However, when I add this to my config in grunt it has no effect: options: { phantomjs: {