Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var wd = require('wd'),
- assert = require('assert'),
- colors = require('colors'),
- browser = wd.promiseRemote();
- browser.on('status', function(info) {
- console.log(info.cyan);
- });
- browser.on('command', function(meth, path, data) {
- console.log(' > ' + meth.yellow, path.grey, data || '');
- });
- browser.init({
- browserName: 'chrome',
- tags: ["examples"],
- name: "This is an example test"
- }).then(function() {
- return browser.get('http://yandex.ru');
- }).then(function() {
- return browser.title();
- }).then(function(title) {
- assert.ok(~title.indexOf("Яндекс"), 'Wrong title!');
- return browser.elementById('text');
- }).then(function(el) {
- el.type("новосибирск");
- return browser.elementByCssSelector('form.b-morda-search-form input[type="submit"]');
- }).then(function(el) {
- return browser.clickElement(el);
- }).then(function(err) {
- browser.title(function(err, title) {
- console.log(title);
- });
- }).fin(function() {
- browser.quit();
- }).done();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement