phantomjs

How to handle/accept JS Alerts in PhantomJS using WebDriver?

浪尽此生 提交于 2020-01-02 07:04:13
问题 Being new to PhantomJSDriver for Selenium, how does it handle JS alerts? I've found the JSPhantom onAlert documentation, but what would the equivalent PhantomJSDriver code for Driver.SwitchTo().Alert().Accept(); be? At the moment, I've returning early with a guard clause for PhantomJSDriver , to stop exceptions, but how should js alerts in PhantomJS be interacted with? 回答1: I had similar problems with PhantomJS Web Driver handling alerts. The below code seems to resolve the issue. This is a C

How to handle/accept JS Alerts in PhantomJS using WebDriver?

寵の児 提交于 2020-01-02 07:04:10
问题 Being new to PhantomJSDriver for Selenium, how does it handle JS alerts? I've found the JSPhantom onAlert documentation, but what would the equivalent PhantomJSDriver code for Driver.SwitchTo().Alert().Accept(); be? At the moment, I've returning early with a guard clause for PhantomJSDriver , to stop exceptions, but how should js alerts in PhantomJS be interacted with? 回答1: I had similar problems with PhantomJS Web Driver handling alerts. The below code seems to resolve the issue. This is a C

How to read an image from phantomjs stdout in nodejs to serve it?

浪子不回头ぞ 提交于 2020-01-02 04:35:27
问题 There's probably some detail that I'm missing, because the rasterization script works fine standalone, but I haven't been successful reading its output from NodeJS so far. Here's the NodeJS part: var http = require('http'); var qs = require('querystring'); var fs = require('fs'); var spawn = require('child_process').spawn; var SCRIPT = fs.readFileSync('./script.js', { encoding: 'utf8' }); http.createServer(function (request, response) { var body = ''; request.on('data', function (data) { body

Yeoman generator always get some error

跟風遠走 提交于 2020-01-02 03:09:10
问题 When I'm trying using yeoman web generator, although it's working, but looking through the whole generate progress, it always gives me some errors below, no matter what generator I used, they are always there. npm ERR! phantomjs@1.9.7-6 install: `node install.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the phantomjs@1.9.7-6 install script. npm ERR! This is most likely a problem with the phantomjs package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on

JS Testing: Trigger jQuery keypress event from CasperJS and PhanthomJS

十年热恋 提交于 2020-01-01 19:42:14
问题 my webpage has a listener to the enter key press event. I am trying to run the casperjs code below to trigger this event, but without success. Although no error is prompted out, the (evaluate) function returns true and the code works fine from my chrome console, the function result, that should be sending a request to the server is never happening casper.then(function(){ var result = this.evaluate(function(term){ var search_form_id = "#search-form"; $(search_form_id).val(term); jQuery(search

Python Web Scraping (Beautiful Soup, Selenium and PhantomJS): Only scraping part of full page

左心房为你撑大大i 提交于 2020-01-01 11:51:26
问题 Hello I am having trouble trying to scrape data from a website for modeling purposes (fantsylabs dotcom). I'm just a hack so forgive my ignorance on comp sci lingo. What Im trying to accomplish is... Use selenium to login to the website and navigate to the page with data. ## Initialize and load the web page url = "website url" driver = webdriver.Firefox() driver.get(url) time.sleep(3) ## Fill out forms and login to site username = driver.find_element_by_name('input') password = driver.find

Responsive design testing with PhantomJS

☆樱花仙子☆ 提交于 2020-01-01 09:39:05
问题 I have a javascript application (RequireJS with Backbone ) which I am testing using PhantomJS with Jasmine. After much pain I finally have simple tests running. I am using a test runner based on the one found here run-jasmine.js. My application is responsive in that as the viewport width changes, the widths of various DOM elements will also change. I am aware that I can set the viewport width in 'run-jasmine.js' when I create the 'page' for testing. What I would like to know is.....Are you

Phantom.js / Casper.js with rotating proxy?

断了今生、忘了曾经 提交于 2020-01-01 09:25:10
问题 I have a simple goal: load webpages with either phantom.js (out of the box) or casper.js (nice and easier) but using proxy and rotate it from a list if current one is bad (i.e. webpage loads fail or something like that). I know casper.js has --proxy param but it dictates the user to specify only ONE proxy and use it during runtime. Question #1 is: how to rotate proxy on the fly programmatically? I did some research and found this node-requester but it's not integrated with casper.js . I tried

PhantomJS 1.8 with Selenium on python. How to block images?

倾然丶 夕夏残阳落幕 提交于 2020-01-01 08:38:31
问题 Is there a way to configure PhantomJS webdriver on Selenium to do not load images? I know if I use phantomjs directly, I can start it with --load-images=no and it won't load the images, but how can I configure that via Selenium and Python? UPDATE Tried the following: args = { 'desired_capabilities': { 'loadImages': False } } driver = webdriver.PhantomJS(**args) No success... 回答1: Why are you not trying webdriver.PhantomJS(service_args=['--load-images=no']) ? 回答2: EDIT: passing arguments is

Building PhantomJS-2 from source on Windows

99封情书 提交于 2020-01-01 06:48:05
问题 I'm attempting to build the development version of PhantomJS 2 from source on Windows 8.1 x64 based on these instructions. However I get the following errors 'mingw32-make' is not recognized as an internal or external command, operable program or batch file. 'nmake' is not recognized as an internal or external command, operable program or batch file. Error: "qmake.exe is missing Can't proceed." I'm unsure how to fix this, please can someone help and/or give steps on how to build this on