package main.test.org.seleniummonster.com.demo.eventlistenerdemo;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.events.AbstractWebDriverEventListener;
public class EventListenerType2 extends AbstractWebDriverEventListener {
/**
* @author ritesh
*/
@Override
public void onException(Throwable arg0, WebDriver arg1)
{
System.out.println("There is an exception in the script, please find the below error description" );
arg0.printStackTrace();
}
}
===============================================
package main.test.org.seleniummonster.com.demo.eventlistenerdemo;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.events.EventFiringWebDriver;
public class EventFiringWebdriverExample
{ /**
* @author Selenium ritesh
*/
public static void main(String[] args) {
// Creating webdriver instance
WebDriver driver = new FirefoxDriver();
// Creating EventFiringWebDriver instance
EventFiringWebDriver eventFiringWD= new EventFiringWebDriver(driver);
// Creating instance of eventListener, that we just defined
EventListenerType2 eventListener1=new EventListenerType2();
// Register the Listener with the event firing driver
eventFiringWD.register(eventListener1);
eventFiringWD.get("https://www.google.co.in/");
eventFiringWD.findElement(By.className("nosuchclassName"));
}
}
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.events.AbstractWebDriverEventListener;
public class EventListenerType2 extends AbstractWebDriverEventListener {
/**
* @author ritesh
*/
@Override
public void onException(Throwable arg0, WebDriver arg1)
{
System.out.println("There is an exception in the script, please find the below error description" );
arg0.printStackTrace();
}
}
===============================================
package main.test.org.seleniummonster.com.demo.eventlistenerdemo;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.events.EventFiringWebDriver;
public class EventFiringWebdriverExample
{ /**
* @author Selenium ritesh
*/
public static void main(String[] args) {
// Creating webdriver instance
WebDriver driver = new FirefoxDriver();
// Creating EventFiringWebDriver instance
EventFiringWebDriver eventFiringWD= new EventFiringWebDriver(driver);
// Creating instance of eventListener, that we just defined
EventListenerType2 eventListener1=new EventListenerType2();
// Register the Listener with the event firing driver
eventFiringWD.register(eventListener1);
eventFiringWD.get("https://www.google.co.in/");
eventFiringWD.findElement(By.className("nosuchclassName"));
}
}
Donate:
Please
Donate the some money (anything do you want) for my
blog
if you beneficial for this, I will provide more real example for the
latest
technique for whom who wants to make a carrier in IT field or solved
some
problem, My Name is – RITESH KUMAR SINGH A/C number- 913010044116345 AXIS
Bank
LTD :- Vaishali NCR, India-001
No comments:
Post a Comment