Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 99411

Automation testing using wd library

$
0
0

I am working with wd library for automation testing that includes mocha as well.

Here is my code

require('colors');
var chai = require("chai");
var chaiAsPromised = require("chai-as-promised");
chai.use(chaiAsPromised);
chai.should();

var header = require('../pages/header.js');

var wd;
try {
  wd = require('wd');
} catch( err ) {
  wd = require('../../lib/main');
}
chaiAsPromised.transferPromiseness = wd.transferPromiseness;

describe('mocha spec examples', function() {
  this.timeout(10000);

  // returning promises and chai-as-promised is the best way
  describe("using promises and chai-as-promised", function() {
    var browser;

    before(function() {
      browser = wd.promiseChainRemote();
      return browser
        .init({browserName:'chrome'})

        .setWindowSize(1366, 1024, function(err){
       });
    });

    beforeEach(function() {
      return browser.get("http://admc.io/wd/test-pages/guinea-pig.html");
     // return browser.get("http://google.com.au");
    });

    after(function() {
    });


it("Validate the Location of Header image", function() {

         return console.log(browser.elementByClassName('i_am_a_class')
                .parentElement.getAttribute("outerHTML"));
                //.getAttribute("outerHTML")
                //.then(console.log.bind(console));           
    });


  });
});

I am able to get the element by class name, but I need to get the parent element of the element found as well.


Viewing all articles
Browse latest Browse all 99411

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>