phantomjs

How can I change logfile path of phantomjs with selenium?

杀马特。学长 韩版系。学妹 提交于 2019-12-06 04:38:57
问题 When using phantomjs with selenium, I would like to change the default --webdriver-logfile parameter, that selenium passes to phantomjs. How can I do it? The corresponding line in selenium log: 11:06:06.960 INFO - arguments: [--webdriver=14380, --webdriver-logfile=<ROOT PATH DELETED HERE>/phantomjsdriver.log] Firing up phantomjs in coffeescript: webdriverio = require 'webdriverio' module.exports.World = World = (next) -> @browser = webdriverio.remote({ desiredCapabilities: { browserName:

PhantomJS sometimes gives “parse error” messages

点点圈 提交于 2019-12-06 04:22:43
问题 Our company wants to start triggering our QUnit unit tests through our CI server and are looking at PhantomJS as a means of achieving this goal. We started by just trying to open a couple of our QUnit test pages in phantom via the following script: var page = require('webpage').create(); var args = require('system').args; page.onConsoleMessage = function(msg, lineNum, sourceId) { console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")'); }; page.onError = function

Page-break-inside support in phantomjs on heroku

[亡魂溺海] 提交于 2019-12-06 04:21:10
I have a NodeJS app using PhantomJS to generate PDF files. My app is deployed to Heroku and I'm using this phantom build pack. Unfortunately this build pack does not support the page-break-inside: avoid CSS property. I did a research and found 2 hacks on this GitHub issue page. I've tried both of them, but unfortunately I can't use the CSS one, due to my page structure and the JavaScript one isn't page-breaking properly. One of the guys in the GitHub link above mentioned that this problem is fixed if I compile from source, but I have no idea how I can compile from source on Heroku App and is

PhantomJS to screenshot website div for Spring MVC, Tomcat and iText use

好久不见. 提交于 2019-12-06 04:09:47
问题 I've been introduced to the power of PhantomJS and CasperJS to take website screenshots. The article "Responsive Screenshots With Casper" was really helpful to learn about the basics of the two technologies plus the screenshot feature. Next is to how can this technology be used for integration with a Spring MVC application. So far I have tried "Screen Capture using PhantomJS, GhostDriver, Selenium Hub"'s code and combined it with the answer provided in "Remote PhantomJS driver in Junit". What

selenium PhantomJS send_keys doesn't work

我的梦境 提交于 2019-12-06 03:51:08
问题 I am using selenium and PhantomJS for testing. I followed Selenium's simple usage, but send_keys doesn't work on PhantomJS, it works on Firefox. Why? I have to use button.click() instead? #!/usr/bin/python # -*- coding: utf-8 -*- import sys reload(sys) sys.setdefaultencoding('utf-8') from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.PhantomJS() driver.get("http://www.python.org/") elem = driver.find_element_by_id("q") elem.clear() elem.send_keys

Ajax request in PhantomJs script

爷,独闯天下 提交于 2019-12-06 03:49:16
问题 Problem: Ajax request within phantomJs script to a local page doesn't work (no response) Question: How can I make it work? Any ideas or possible solutions? Description: I'm running a phantomJs script and I need to access some data that is provided by a php function in another page (local). In order to do that, I use an ajax request to that page inside the phantomjs script. However, the request doesn't do anything. The script is: page.open(url, function (status) { page.includeJs('http://ajax

PhantomJS: Add Javascript include to web page (not to PhantomJS environment)

隐身守侯 提交于 2019-12-06 03:37:53
I would like to add a JavaScript <script></script> tag, containing or sourcing untrusted code, to web pages PhantomJS visits, and have the page behave as if the page originally included the tag. includeJs() / injectJs() do not do what I need - they inject code into my PhantomJS environment, but I need my code injected into the web page. Further, these functions expose my PhantomJS local variables to the untrusted code, which I do not want. evaluate() does not do what I need either, as it will not take a string containing untrusted JavaScript. Instead, it expects my PhantomJS script to include

WebDriver PhantomJS Unable to find element, but works fine with Firefox

淺唱寂寞╮ 提交于 2019-12-06 03:36:07
问题 I have been banging my head into the wall for a long time now so I thought I would ask the "experts" why the below code would not work (entering password) with PhantomJS but works just fine with Firefox. The most disturbing of all is that one field entry (username) is successful but the second would not work at all. The page loads just fine and I have included test code to verify other components are loaded just fine. See code below: import java.io.File; import org.openqa.selenium.*; import

HTML rendering on server with Node.js

余生长醉 提交于 2019-12-06 03:07:04
问题 Suppose I've got a web page, which contains nothing but a javascript reference. When a browser loads the page it runs the javascript, which does the actual rendering. The javascript is large, complex, and makes a lot of XHR calls. Now I need to make this page searchable , i.e. render the page on the server. I tried to load the page in phantomJS but the it was slow and sometimes did not complete the whole page. So I'm wondering if there is an alternative. Ideally I need a node.js script to

casperjs: evaluating document.querySelector returns a null

女生的网名这么多〃 提交于 2019-12-06 02:36:44
问题 I'm using the waitForSelector() and captureSelector() methods in CasperJS to wait for and select an element using a CSS selector, then save a screenshot of it. However, I'm finding that because the css background has been set to transparent , the screenshot turns out pretty ugly, so I'd like to set the background to white . I've made sure that I'm using document.querySelector in an evaluate() call, but that doesn't seem to work. Here's my script (you can ignore everything before casper.start(