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

1,160 views
Skip to first unread message

Usman Akhtar

unread,
Jan 4, 2015, 2:11:04 AM1/4/15
to selenium-...@googlegroups.com
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 Python, I would like to register a listener with the current session so I can capture user interaction with the WebDriver's launched browser. 

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? And also captures the events when i press the buttons and interact the rest of the elements on the page?

I appreciate your help.

darrell

unread,
Jan 5, 2015, 7:51:22 PM1/5/15
to selenium-...@googlegroups.com
It sounds like you are trying to create an event_firing_webdriver. If yes, you would implement http://selenium.googlecode.com/svn/trunk/docs/api/py/webdriver_support/selenium.webdriver.support.abstract_event_listener.html. Once you have a listener class you would launch a browser then use the browser instance and the event listener as a parameter to http://selenium.googlecode.com/svn/trunk/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html.

I think this is what you are looking for. Not really about developing Selenium. This is really about using an existing feature of Selenium. If you have more questions about this you probably want to ask in https://groups.google.com/forum/#!forum/webdriver.

Seva Lo

unread,
Jan 5, 2015, 8:13:20 PM1/5/15
to selenium-...@googlegroups.com
What Darrel said will help you if you do the actions (e.g. navigation to a website) using WebDriver API, not if you literally, manually "type www.google.com in this browser and press enter. The browser navigates me to google.com". I don't know of a piece of Selenium other than Selenium IDE that would capture your *manual* actions.

Hope this helps.

--
You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-develo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-developers/f5d54f91-77a8-41e4-ab9f-1dc2e8225e71%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Xiang Dong

unread,
Jan 6, 2015, 3:19:47 PM1/6/15
to selenium-...@googlegroups.com
You can develop some javascript to capture user action on web page, such as left/right click, input or others and calculate the web element which the action on. If you have such javascript, inject it into web page via webdriver, The left you should do how to transfer back the capture actions from javascript side to you favorite place, Ajax maybe a solution but it requires a web server behind. 
As I known, there is no solution to capture manual actions and call Java/Ruby callback method. Those actions happened on browser side, not on your java/ruby side.

--david 


From: vlotos...@gmail.com
Date: Mon, 5 Jan 2015 17:13:02 -0800
Subject: Re: [selenium-developers] Re: Selenium:Webdriver: Is there a listener to capture user actions in the browser session launched by WebDriver?
To: selenium-...@googlegroups.com

PeterJef...@hotmail.co.uk

unread,
Jan 6, 2015, 4:06:06 PM1/6/15
to selenium-...@googlegroups.com
What's wrong with just using the current IDE, or even the new "Sauce Builder". Even if you could build a WebDriver based recording tool that could be used to record manual actions from ANY of the supported browsers, there's no guarantee that the coded versions of the actions you record would play back in ALL the browsers without some tweaking so you wouldn't seem to have anything better than what is already available, I think.
Reply all
Reply to author
Forward
0 new messages