phantomjs

PhantomJS/CasperJS site login, cookies are not accepted by PhantomJS

本小妞迷上赌 提交于 2019-12-20 10:07:11
问题 I recently tried to login into a webiste that forces me to accept cookies. I'm using phantomJs and casperJs. I wrote a little script that should handle the login, but it redirects me to a site that tells me I have to accept cookies. Email and password are just placeholders. The site I want to login is https://de.buyvip.com/ . But I need to click the button Anmelden mit Amazon so I can login with my amazon account. The other login form does not work. (That leads to this long url, I just copied

How to debug ember-cli tests running in phantomjs

眉间皱痕 提交于 2019-12-20 09:46:08
问题 Context: I have an acceptance test for my ember-cli application, and the test passes just fine in Chrome. However, in phantomjs, my test fails -- the UI doesn't get created the same way, and I'm trying to work out why. (I think the test is broken because of https://github.com/ember-cli/ember-cli/issues/1763, but the general question of how to debug remains) In Chrome, I can use the standard debugging tools on my tests and all is well -- but in phantomjs, I can't get at it with a debugger. I

How to Use CasperJS in node.js?

喜欢而已 提交于 2019-12-20 09:43:53
问题 I would like to use CasperJS in node.js. I have referred to the following URL's to use CasperJS in node.js: https://github.com/sgentle/phantomjs-node http://casperjs.org/index.html#faq-executable With the help of the above URLs I have written the following code: //DISPLAY=:0 node test2.js var phantom = require('phantom'); console.log('Hello, world!'); phantom.create(function (ph) { ph.casperPath = '/opt/libs/casperjs' ph.injectJs('/opt/libs/casperjs/bin/bootstrap.js'); var casper = require(

Is it possible to use Selenium WebDriver to drive PhantomJS?

烂漫一生 提交于 2019-12-20 08:47:09
问题 I’m going through the documentation for the Selenium WebDriver, and it can drive Chrome for example. I was thinking, wouldn't it be far more efficient to ‘drive’ PhantomJS? Is there a way to use Selenium with PhantomJS? My intended use would be web scraping: The sites I scrape are loaded with AJAX and lots of lovely JavaScript, and I’m thinking this setup could be a good replacement for the Scrapy Python framework that I’m currently working with. 回答1: PhantomJS now includes the GhostDriver

Debugging PhantomJS webpage.open failures

旧街凉风 提交于 2019-12-20 08:39:42
问题 In PhantomJS, webpage.open takes a callback with a status parameter that's set to 'success' or 'fail'. According to the docs, it wll be "'success' if no network errors occurred, otherwise 'fail'." Is there a way to see the underlying network error that caused the failure? The url I'm trying to load works fine when I put it in my browser, and when I take a screenshot after getting the 'fail' message I see the page that I was on before I called webpage.open (so I can't just ignore the fail). I

How can detect sound on webpage with JavaScript in PhantomJS?

故事扮演 提交于 2019-12-20 07:16:08
问题 I need detect all sound in webpage with banners. How I can do this? I look to PhantomJS, but can't find a API for browser sound. 回答1: PhantomJS (1.x and 2) doesn't support either Flash, <video> or the <audio> element. There is no way to detect sound, because there isn't any. From the docs: Support for plugins (such as Flash) was dropped a long time ago. and Video and Audio would require shipping a variety of different codecs. 来源: https://stackoverflow.com/questions/31697239/how-can-detect

CasperJS posting only the last item multiple times from my for-loop

流过昼夜 提交于 2019-12-20 06:39:59
问题 CasperJS is awesome but it's not posting to my localhost what my console output is. casper.wait(5000, function () { casper.wait(1000, function () { casper.then(function(){ for (var i = 0 ; i < 10; i++) { var description = casper.fetchText(x('//*[@id="acDataId-local'+i+'"]/a')); //*[@id="acDataId-local0"]/a console.log(description); var target_date = casper.fetchText(x('//*[@id="dtDataId-local'+i+'"]/text()[1]')); console.log(target_date); var target_location = casper.fetchText(x('//*[@id=

QunitJS-Tests don't start: PhantomJS timed out, possibly due to a missing QUnit start() call

扶醉桌前 提交于 2019-12-20 06:36:29
问题 I have set up my test environment as described here with QunitJS + PhantomJS + GruntJS: http://jordankasper.com/blog/2013/04/automated-javascript-tests-using-grunt-phantomjs-and-qunit/ If I execute the tests (grunt task) locally everything works fine. But If I try to execute the tests on our buildserver it throws following error: I checked the URL and path several times and the html-document for starting the qunit tests is also available on the configured path on our build server. Any ideas

PhantomJS Node - page.open - cannot keep track of multiple pages

£可爱£侵袭症+ 提交于 2019-12-20 04:26:13
问题 I'm using Phantom Node to interface node with PhantomJS. I'm trying to open pages in parallel, but the issue is that page.open callback function does not pass back the reference to the page, so I don't have a way to know which page has completed. Relevant Code self.queue[j].page.open.call( self.queue[j].page, rows[i].url, function( status ) { console.log( this ) // <-- returns undefined // So how do I keep track of which pages have finished loading? // The only variable I have available here

Phantom.js - Get Text Inside Alert Box

。_饼干妹妹 提交于 2019-12-20 04:09:50
问题 Is it possible to get the text inside an alert box using Phantom.js? var page = require("webpage").create() , assert = require("assert"); page.open("http://www.mysite.com/page", function (status) { page.includeJs("jquery-1.10.2.min.js", function () { var alertText = page.evaluate(function () { //This should cause an alert dialog to appear $('button[type="submit"]').click(); //This doesn't work, but is there some equivalent to this? return $("alert").val(); }); assert.equal(alertText, "Thanks