Welcome to the Question and Answer site for Software Testing Professionals

You can get your queries resolved from Software Testing Professionals.

Ask a Question

Get answers and give answers to questions from other members.

View All Questions

Get votes and earn points to build your reputation in community.

View Hot Questions

1
Why is not my console printing anything when I am trying to run the event listener class with the Selenium Webdriver?

Solved 2 Answers 41 Views Selenium
1 2

Here is the code.


*EventListener Class*
public class Register {

PSVM(String[] args) {

WebDriver driver = new FirefoxDriver();

EventFiringWebDriver EFWD = new EventFiringWebDriver(driver);

EventListener el = new EventListener();

EFWD.register(el);

driver.get("Google");

driver.get("facebook,com");

driver.navigate().back();

}


*MainClass*

public class EventListener extends AbstractWebDriverEventListener{

public void afterNavigateBack(WebDriver arg0) {

System.out.println("after navigate "+arg0.getCurrentUrl());

}

}

2 Answers

0
Best answer
0

Also you should be using EFWD instead of driver.

 

ex.

public class Register {

PSVM(String[] args) {

WebDriver driver = new FirefoxDriver();

EventFiringWebDriver EFWD = new EventFiringWebDriver(driver);

EventListener el = new EventListener();

EFWD.register(el);

EFWD.get("Google");

EFWD.get("facebook,com");

EFWD.navigate().back();

}

hope it helps.

answered Apr 10, 2016 by stbadmin (192 points)
selected Mar 7, 2017 by stbadmin
0
0

I guess you will need to add @Override above afterNavigateBack method.

 

 

public class EventListener extends AbstractWebDriverEventListener{

@Override

public void afterNavigateBack(WebDriver arg0) {

System.out.println("after navigate "+arg0.getCurrentUrl());

}

}

 

Let me know.

answered Apr 10, 2016 by stbadmin (192 points)

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

We have resolved 1.2k+ Software Testing queries!

Software Testing Board Weekly update

We will send you handpicked questions that you would love to answer.

View previous campaigns.

Top Contributors

...