I am sharing the code, what exactly I want to achieve with Selenium Event Listener
I have followed this blog and really love this approach for better debugging and tried it.
Now I want to implement this with the page object and page factory pattern in selenium.
public class Pages {
public WebDriver driver;
public Pages(WebDriver driver){
this.driver = driver;
}
@FindBy(how=How.NAME,using="q")
public static WebElement searchTextBox;
@FindBy(how=How.NAME,using="btnG")
public static WebElement clickSearchButton;
}
BASECLASS:
public class SelTestCase {
public WebDriver driver;
@BeforeTest
public void setUp(){
driver = new FirefoxDriver();
}
@AfterTest
public void tearDown(){
driver.close();
driver.quit();
}
ACTION:
public class Action extends SelTestCase{
public void searchItem(){
EventFiringWebDriver event = new EventFiringWebDriver(driver);
WebDriverListerners eventListener = new WebDriverListerners();
event.register(eventListener);
event._________________________
}
In the above example the gray highlighted filed is showing error, I want to call the event in the Action class then in to @Test. Which I do not understand how to do.
Please guide me. I want to implement this approach in my project.
Please help me sir.