casperjs

How to Login by filling the form in CasperJs

佐手、 提交于 2019-11-30 22:57:03
问题 Following is the hlml of the login form that I have <div class="login_area_user"> <form method="post" action="https://www.tradus.com/login?dest_url=https://www.tradus.com/cart/select-address" id="user-login"> <input type="hidden" value="1" name="form_submit"> <h3 style="display:inline-block;">Already a Member</h3> <p id="login-main-center-right-descp">You can use tradus login id and password</p> <div class="login-row"> <label class="colorBlack">Email / Login*</label> <input class="login-field

How to fill up form using CasperJS without form tag

拥有回忆 提交于 2019-11-30 19:57:24
I'm new to CasperJS and I'm having problems in logging in into this site http://weibo.com/login.php here's what I've tried this.fill('form#contact-form', { 'username': 'test@test.com', 'password': 'anypassword', }, true); I can't used that since it has no form. so I tried a different method using sendKeys. this.sendKeys('.W_input ', 'tinkerbell@gmail.com'); Now my problem in here is that the input text has no ID in it, only a CLASS and both username and password have the same CLASS in it. how can i type into that textbox using only that class? or is it possible to use sendKeys using XPath?

Can I get the original page source (vs current DOM) with phantomjs/casperjs?

眉间皱痕 提交于 2019-11-30 19:19:03
I am trying to get the original source for a particular web page. The page executes some scripts that modify the DOM as soon as it loads. I would like to get the source before any script or user changes any object in the document. With Chrome or Firefox (and probably most browsers) I can either look at the DOM (debug utility F12) or look at the original source (right-click, view source) . The latter is what I want to accomplish. Is it possible to do this with phantomjs/casperjs? Before getting to the page I have to log in. This is working fine with casperjs. If I browse to the page and render

Issues running casperjs with phantomjs#2.0.0 on Mac (Yosemite)

北城余情 提交于 2019-11-30 19:11:26
I'm trying to run CasperJS having PhantomJS#2.0.0 on a Mac(Yosemite) . When trying to run CasperJS I´m getting the following message: "CasperJS needs PhantomJS v1.x /usr/local/Cellar/casperjs/1.1-beta3/libexec/bin/bootstrap.js:91 in __die" How can I make it run? Has anyone got it working? Currently there is no newer version than 1.1-beta3 released which contains this check. The simplest fix would be to open the bin/bootstrap.js file and remove these lines or replacing the lines that are currently in the master branch : (function (version) { // required version check if (version.major === 1) {

Page Object Pattern Implementation with CasperJS

▼魔方 西西 提交于 2019-11-30 18:17:34
问题 Is there anyone who have already implemented the famous "Page Object Pattern" with casperjs, it's very useful for test maintenability in the long term ? It's very very cool to use that when you have to separe the mechanics and the purpose of your tests. it become more pleasurable to write your tests this way. There are some examples with ruby and selenium: http://blog.josephwilk.net/cucumber/page-object-pattern.html https://code.google.com/p/selenium/wiki/PageObjects 回答1: Here is an exemple

How do I run casper from within the phantomjs shell?

假如想象 提交于 2019-11-30 16:31:42
Anyone know if and how it's possible to run casperjs from within the phantomjs shell (a.k.a InteractiveModeREPL )? I've also tried passing the direct path to the casper.js module and that has not worked either. Progress/Update: Tried phantomjs.injectJs('C:/casperjs/module/casper.js'); but got Error: Cannot find module 'colorizer' I guess I'm getting close. This gets me closer but still missing path: phantomjs.injectJs('C:/casperjs/module/bin/bootstrap.js') errors out with Cannot find package.json at C:/package.json OK, looks like I can pass the --casper-path option when starting phantomjs (see

Loop through list of clickable elements and write out the html to respective files

只谈情不闲聊 提交于 2019-11-30 16:06:05
问题 I'm using jQuery to get a list of elements that contain certain key words. I'm able to get the list of elements but I don't know how to loop through each element, click on its child element and download the newly loaded page. Here's the casperjs code I have so far: var casper = require('casper').create({ clientScripts: ["/var/www/html/project/public/js/jquery-3.3.1.min.js"] }); var fs = require('fs'); casper.start('https://m.1xbet.co.ke/en/line/Football/', function () { var links = casper

Pass parameter from php to casperjs/phantomjs

孤者浪人 提交于 2019-11-30 16:04:50
问题 Edit: I answered my own question, see edit below. ORIGINAL: I have phantomjs and casperjs installed on my web server and they both run fine. The script I am planning on creating relise on a user input from my website, which is then passed on to the casperjs script. After fiddling around a bit, I noticed that I am stuck on the very basic task of the user input. How would pass the variable from php to casperjs? Please note, the following are just test scripts. My php script $user_input = $_POST

CasperJS File Download Times Out After 30 Seconds

牧云@^-^@ 提交于 2019-11-30 15:45:07
问题 I'm using CasperJS to download a 15 MB file. In the browser, the download takes about 3 minutes to complete. With Casper, the .download function for the same url returns after exactly 30 seconds, and the file written to disk is 0 bytes. I've tried setting longer timeouts like this: var casper = require("casper").create({ pageSettings: { webSecurityEnabled: false }, waitTimeout: 500000, stepTimeout: 500000 }); But they have no effect. Here's my download function: casper.on('resource.received',

Cannot find module 'casper' when invoking through PhantomJS

被刻印的时光 ゝ 提交于 2019-11-30 15:05:57
问题 I installed PhantomJS in C:\xampp\htdocs\phantom and also I installed CasperJS in this folder C:\xampp\htdocs\casper When I tried to run these sample code on casper site using phantomjs test.js command: var casper=require('casper').create(); casper.start('http://google.fr/'); casper.thenEvaluate(function(term) { document.querySelector('input[name="q"]').setAttribute('value', term); document.querySelector('form[name="f"]').submit(); }, 'CasperJS'); casper.then(function() { // Click on 1st