Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var casper = require('casper').create()
- , system = require('system');
- var marketId = casper.cli.options['market-id'];
- casper.start('http://market.yandex.ru/shop-info.xml?shop_id='+marketId, function() {
- this.capture('page.png');
- if( this.exists('img.image.form__captcha') ) {
- this.captureSelector('captcha.png', 'img.image.form__captcha');
- system.stdout.write('введите капчу: ');
- var captcha = system.stdin.readLine();
- this.sendKeys('#rep', captcha);
- this.fill('form[action="/checkcaptcha"]', { rep: captcha }, true);
- }
- });
- casper.then(function() {
- this.waitForSelector('.b-old-shop-info__table', function() {
- this.capture('page.png');
- this.echo(this.evaluate(function() {
- return document.querySelector('.b-old-shop-info__table tr:last-child td:last-child').textContent;
- }));
- });
- });
- casper.run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement