views:

297

answers:

1

Hi, I want to add some features to webdriver, but since I don't know Java at all, I want to understand the way it works first. So as I get it, there is a firefox plugin (javascript) and there is java code that starts firefox with that extension installed, then this java code listens to a local port and when it gets some command, java signals it to the firefox plugin, which does the actual job. And the python code is just a set of shortcuts to the port interface. It this correct?

Update:

Thanks for the response, malatio. But could anyone please explain, why when I add alert('Hello world!'); after FirefoxDriver.prototype.deleteCookie = function(respond, cookieString) { in D:\webdriver-read-only\firefox\src\extension\components\firefoxDriver.js and then run

from webdriver_firefox.webdriver import WebDriver

wd = WebDriver()
wd.delete_all_cookies()

I still don't see the Hello world! alert (and get an error, by the way)

+3  A: 

Yeah you've got it. The Java server controls a browser with a special JavaScript environment that allows the server to control it. The server listens for commands given to it through http, when it receives commands, it pulls the strings on the browser to make it do stuff. The Python API for webdriver is code that constructs the right http commands to send to the webdriver server. There may or may not be good descriptions or diagrams for this for Webdriver, but the architecture is very similar for Selenium (in fact, Webdriver and Selenium are being merged into each other as "Selenium 2"). Here's a rundown of the same architecture from the Selenium docs: how-selenium-rc-works

alt text

perrierism