I am loosing my mind over trying to do something inherently seemingly banal, but it seems almost hopeless. For a thesis project I need to collect flight prices. This code should just fill in "zurich" to the departure box. But it doesn't. This code works normally with any text imput box, but on this simple page its hopeless. I really would appreciate someones wisdom here:
// variables
var casper = require("casper").create();
var x = require('casper').selectXPath;
var url = 'http://www.statravel.ch';
var depart_box_x = '//*[@id="qbtb_2_0_id_0"]/div/div[1]/div[2]/div[2]/form/fieldset[2]/div[1]/p/input';
// init casper
casper.userAgent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1');
casper.start(url);
// run through page
casper.then(function() {
this.click(x(depart_box_x));
this.sendKeys(x(depart_box_x), 'ZURICH', { reset: true} );
console.log('sending keys...');
});
casper.then(function() {
console.log('screenshot...');
casper.capture('cap.png');
});
// run command for casperjs
casper.run();
If you look at the screenshot, the field is blank. But no errors pop up. If you do the same but instead of the departure box you select the email box at the top of the page, it fills it in. It feels like they on purpose made this impossible.
Thank you for any help!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…