phantomjs

Some websites block selenium webdriver, how does this work?

ε祈祈猫儿з 提交于 2019-12-12 18:44:13
问题 So I'm trying to web crawl clothing websites to build a list of great deals/products to look out for, but I notice that some of the websites that I try to load, don't. How are websites able to block selenium webdriver http requests? Do they look at the header or something. Can you give me a step by step of how selenium webdriver sends requests and how the server receives them/ are able to block them? 回答1: Selenium uses a real web browser (typically Firefox or Chrome) to make its requests, so

How to open a specific URL in a session after login in PhantomJS

假如想象 提交于 2019-12-12 17:40:25
问题 I'm loging in to facebook with PhantomJS. Here is my code: var page = require('webpage').create(); phantom.cookiesEnabled = true; page.open("http://www.facebook.com/login.php", function(status) { if (status === "success") { page.evaluate(function() { document.getElementById("email").value = "email"; document.getElementById("pass").value = "pass"; document.getElementById("loginbutton").click(); }); window.setTimeout(function() { page.render("page.png"); phantom.exit(); }, 5000); } }); page

PhantomJs timeout

喜欢而已 提交于 2019-12-12 17:27:55
问题 I am using Jasmine with PhantomJS to run test cases. In my typical test case, I make a service call, wait for response and confirm response. Some requests can return in a few seconds and some can take up to a minute to return. When ran through PhantomJS, the test case fails for the service call that is supposed to take a minute ( fails because the response is not yet received). What's interesting is that the test passes when ran through Firefox. I have tried looking at tcpdump and the headers

PhantomJS/CasperJS AssertExists() is failing

≡放荡痞女 提交于 2019-12-12 16:44:05
问题 I am trying to check wether a selector exists in my webpage but casperjs never finds it. I've tried two approaches: 1. Without waiting casper.then(function() { // search for 'casperjs' from google form this.test.assertExists('#search-form', 'the element exists'); // this.test.assertExists('.glyphicon.glyphicon-plus', 'the element exists'); }); 2. Waiting for selector casper.waitForSelector('#search-form', function() { this.echo("I'm sure #search-form is available in the DOM"); }); 3. Another

CasperJS seems unable to recognise password field on login form

别来无恙 提交于 2019-12-12 16:40:51
问题 I'm brand new to CasperJS and coffeescript. I have a very simple part of my CasperJS coffeescript test to login to a website, that used to work before a recent change to the password element of the login form. Unfortunately I can't remember the original form but here's how the current login form looks: <div id="login-body"> <img src="/assets/images/logo.png" class="logo" alt="Test Acme Wil-e-Coyote Company"> <form action="/Login/login/" method="post"> <h2>Please log in to catch the roadrunner

Unable to parse JSON string with highcharts exporting server with the windows phantomjs version

时间秒杀一切 提交于 2019-12-12 14:14:25
问题 What i did: Download the latest phantomjs (1.9.2, windows) Download the latest sources of highcharts-convert.js from github (note: download the whole directory) Start phantomjs with convert script in server mode: bin\phantomjs.exe --debug=yes js\highcharts-convert.js -host 127.0.0.1 -port 3003 Use CURL to send example json to phantomjs server: curl -H "Content-Type: application/json" -X POST -d '{"infile":"{xAxis: {categories: [\"Jan\", \"Feb\", \"Mar\"]},series: [{data: [29.9, 71.5, 106.4]}]

Fit content width-wise in pdf

折月煮酒 提交于 2019-12-12 12:26:11
问题 When rendering to pdf, I need the html page to be 100% of the print width. Otherwise content gets cut off. Is there an easy way to do this? I came up with a work-around, which gets the html width after rendering and then sets the zoom factor to force the correct width. var page = require('webpage').create(), system = require('system'), dpi = 89.9, // strange, but that's what I get on Mac pageWidth = 210; // in mm var getWidth = function() { return page.evaluate(function() { // get width

error in unit test vue.js karma : undefined is not a constructor ()

徘徊边缘 提交于 2019-12-12 12:16:35
问题 This is my first unit test and I'm getting an error message that couldn't find why I get it in the forums so far. This is my unit test: import LoginPage from 'src/pages/Login' describe('Login.vue', () => { it('mounted is a fuction', () => { expect(typeof LoginPage.mounted).toBe('function') }) }) And this is the login page: <template> <div class=""> <p v-if="$route.query.redirect"> You need to login first. </p> <form class="column is-one-third is-offset-one-third" @submit.prevent="login"> <div

using webshot within knitr

与世无争的帅哥 提交于 2019-12-12 11:38:51
问题 In the process of trying to find a solution to this SO question about saving a heatmap produced by d3heatmap , I encountered an unrelated problem using webshot within the development version of knitr (HT: hrbrmstr). library(devtools) devtools::install_github('yihui/knitr', build_vignettes = TRUE) library(knitr) After installing and loading the development version of knitr , I tried running the following .Rmd file: --- title: "Untitled" output: pdf_document --- ```{r} library(d3heatmap)

Parsing post data in phantomjs

强颜欢笑 提交于 2019-12-12 11:35:14
问题 I am working with the POSTMAN extension to chrome and am trying to send a post request to phantomjs I have managed to send a post request to a phantomjs server script by setting postman as in the attached screenshot My phantomjs script is as follows: // import the webserver module, and create a server var server = require('webserver').create(); var port = require('system').env.PORT || 7788; console.log("Start Application"); console.log("Listen port " + port); // Create serever and listen port