phantomjs

PhantomJS “Can't find variable: require” when using PhantomJasmine

…衆ロ難τιáo~ 提交于 2019-12-08 17:05:47
问题 I would like to use Phantomjs and Jasmine for unit testing javascript. Phantomjs's website recommends that I use a separate thing to handle this, specifically, PhantomJasmine. I downloaded PhantomJasmine and ran the example. Everything went perfectly. I then added the line var system = require('system'); to the top of example_spec.js. The Phantomjs now throws an error when I try to run the example I get "ReferenceError: Can't find variable: require". So, I want to do need things like launch

How to call a button's onClick() method in PhantomJS?

牧云@^-^@ 提交于 2019-12-08 16:58:30
This is NOT a duplicate. I have looked at the answers in PhantomJS; click an element and the OP said that the answer was to call the "onClick()" method assigned to element that needs to be clicked, but the OP does NOT say HOW they accomplished this. Also there are no accepted answers. I am trying to automate the submission of Android apps to Amazon's App store with a PhantonJS script. I have these steps so far: Open the developer console URL: https://developer.amazon.com/login.html Login to my developer account Click on the add_new_app_link Populate the First App submission form and then call

httplib.BadStatusLine: '' on Linux but not Mac

南笙酒味 提交于 2019-12-08 16:23:55
问题 This error has been under my skin for a few hours now. I decided to code up a separate project just to see if I can replicate it and I can, but ONLY on my server. This works on my Mac. Mac: OSX El Capitan 10.11.6 Server: CentOS 7.2.1511 Both have PhantomJS version: 2.1.1 Python Mac: Python 2.7.11 Python Server: 2.7.5 Both have Selenium version: 2.53.0 Identical code ran on both: from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui

Javascript Internationalization API is not supported by PhantomJS

◇◆丶佛笑我妖孽 提交于 2019-12-08 15:48:52
问题 I have series of Jasmine tests running against an AngularJs service that uses ECMAScript Internationalization API. They all run successfully when I run them through Chrome. However, when I use PhantomJS to run them through maven, they all fail as it seems PhantomJs does not support Internationalization API yet. The error message I get for the tests using Intl object is : 1: ReferenceError: Can't find variable: Intl in localizationService.js And the rest of the tests just fail. The tests are

PhantomJS() not running in pyCharm

一笑奈何 提交于 2019-12-08 15:28:40
Hi I am trying to PhantomJS() in pyCharm IDE using from selenium import webdriver driver = webdriver.PhantomJS() I have also tried driver = webdriver.PhantomJS(executable_path = "/Path") But every time it gives me error: selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH But this is running absolutely fine in Python 3.6.0 Shell. I have also set the path varible correctly--"C:\PhantomJs\bin\phantomjs\". What could be the problem in pyCharm? Well I figured out the problem. In the executable path instead of using C:\PhantomJs\bin\phantomjs\ I used C

Problems directly using PhantomJS in node.js

丶灬走出姿态 提交于 2019-12-08 14:29:51
问题 I'm attempting to use PhantomJS, and I've installed it via NPM. I can't seem to run any of the of the examples, in fact I can't even run: var page = require('webpage').create(); I get the error: Error: Cannot find module 'webpage' Is there anything i'm missing? I'm using a few other modules that I've installed via NPM in the same directory with no issues 回答1: PhantomJS is not for Node.js. You are likely running the examples through node binary. Read the Getting Started documentation carefully

Insert casper javascript data to CSV file

亡梦爱人 提交于 2019-12-08 13:50:07
问题 I want to pass data from casper JS to CSV file I am currently using fs = require('fs'); fs.write('test.csv', "name, title", "a"); fs.write('test.csv', name.trim()+","+title.trim(), "a"); this is inside a loop so there are many records but printing to the CSV file is not inserting to a new row. It currently writes like this and I only want 2 columns on this Name Title name1 name1 name2 title2 name3 title3 回答1: add linebreaks fs.write('test.csv', name.trim()+","+title.trim()+"\n", "a"); CSVs

Open PDF with headless browser Phantomjs

空扰寡人 提交于 2019-12-08 13:11:18
问题 I have a pdf that is hosted on an s3 server, I would like to open the pdf and take screenshots within phantomjs. Everytime I get a status of fail. I looked around and cannot seem to find an easy solution var page = require('webpage').create(); var link = 'http://vfs.velma.com/Velma/testcard.pdf'; page.open(link, function(status) { if (status!=='success') { console.log(status); phantom.exit(); } console.log(status); phantom.exit(); });//ends page open() I searched the docs but found nothing

CasperJS and downloading a file via iFrame and JavaScript

僤鯓⒐⒋嵵緔 提交于 2019-12-08 12:31:01
问题 I have a script to test that - on click - generates an iFrame which downloads a file. How can I intercept the response with CasperJS? I already tried the sequence: casper.click('element'); casper.withFrame('frame', function(){ console.log(this.getCurrentUrl()); // only return about:blank, but should have URL console.log("content: " + this.getHTML()); // Yep, empty HMTL this.on('resource.received', function(resource){ console.log(resource.url); // never executed }); }); I need the content of

How to emulate mouseover or run JS function on page with PhantomJS in NodeJS

主宰稳场 提交于 2019-12-08 11:52:16
问题 NodeJS, PhantomJS, content parsing with Cheerio Need to parse webpage, that contains dynamically loaded div(hint). The event can be on many table td's, here is an example When I 'mouseover' on specific td I see this orange block with data, it's dynamically loaded with function, like this onmouseover="page.hist(this,'P-0.00-0-0','355svxv498x0x0',417,event,0,1)" I can view this info only after the page is loaded. Need to a specific row, only Marathonbet. When the function runs, the text is