Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium:Webdriver: Is there a listener to capture user actions in the browser session launched by WebDriver?

I am trying to create a basic recording tool using Selenium2/Webdriver and I am aware that Selenium Already provides an IDE, but I want to build a more generic one.

More specifically, once I launch the browser using WebDiver API in java, I would like to register a listener with the current session so I can capture user interaction with the WebDriver's launched browser. Basically if I were to write record user interactions in Java, how can I do it? Very similar to EventFiringWebDriver class, but this class notifies the listener when the driver initiates the command and not the borwser session.

For example say I launch a browser with the following commands:

WebDriver driver = new FirefoxDriver();

Now there is a blank firefox browser open which says WebDriver on the bottom in red color. Now suppose I type www.google.com in this browser and press enter. The browser navigates me to google.com. Can I register a listener that notifies me on events that occurs on this browser session?

I appreciate your help.

like image 598
Rex Avatar asked Oct 05 '22 01:10

Rex


1 Answers

I'm not familiar with the listeners. I know that people have tended to use something like BrowserMob Proxy to act as a man-in-the-middle to capture and replay HTTP actions. Since WebDriver runs using the JSON Wire Protocol, I think this may be more suited for what you're looking for.

Also, Simon Stewart (the creator of WebDriver) has a detailed write-up on the philosophies and architecture of the Selenium WebDriver project. You can see that here.

Cheers, Dave H

like image 93
Dave Haeffner Avatar answered Oct 13 '22 12:10

Dave Haeffner