title: Javascript gauge - webdriverjs execution hook inside a class
body: <p>New to javascript and gauge . </p>
  
  <p>Here is my what I am trying to do using webdriverJs, gauge</p>
  
  <p>I have 2 classes</p>
  
  <ul>
  <li><p>base - for initiating driver</p></li>
  <li><p>home page - which has elements and methods for home page</p></li>
  <li><p>then my test file which will have my step implementations</p></li>
  </ul>
  
  <p>Similar to java, here is my base class</p>
  
  <pre><code>webdriver = require('selenium-webdriver');
  let driver;
  class BasePage {
  
  "beforeScenario hook here to initialize driver"
  //{
      //this.driver=   new webdriver.Builder().forBrowser("chrome").build();  
  //}
  getDriver (){
      return this.driver;
  }
  navigate (){
  
      await  this.driver.get('https://google.com');
  }
  }
  
  module.exports = BasePage;
  
  </code></pre>
  
  <ul>
  <li>And my HomePage which extends BasePage</li>
  </ul>
  
  <pre><code>let basePage= require('./basePage')
  
  class HomePage extends basePage {
  
  
  //other home page functions
  {driver.findElement(element).click}
  
  }
  
  module.exports = HomePage;
  </code></pre>
  
  <ul>
  <li>here is my test</li>
  </ul>
  
  <pre><code>let homePage = require('./HomePage')
  step("open &lt;site&gt;", async function(){
  
      let h1 = new homePage();
     await  h1.navigate();
  
  
  });
  </code></pre>
  
  <p>The idea is to initiate the driver in the baseclass and have it available to all the classes which extend base class . At the end, I should be able to run the tests parallel . <strong>But the challenge is that I am not able to successfully write the execution hooks inside the base class.</strong>
  Can somebody help me understand if I am trying to do something which i conceptually wrong . Are there better way to achieve what I am trying?
  Any help is appreciated. </p>