Skip to content

Creating a custom Browser Driver

heynemann edited this page Sep 13, 2010 · 4 revisions

A browser driver is the class responsible for actually doing the heavy-lifting for your tests. It will be the responsible for sending commands to the browser to interpret.

Pyccuracy has an “interface” for browser driver to follow. You just have to inherit from BaseDriver and override the methods provided by Pyccuracy’s base class. If you don’t (or can’t) override one of the methods, there’s no problem. If you use that method (or an action that uses it) in your tests you will get a NotImplementedException in the scenario that used it.

Overriding Browser Driver

In order to implement your browser driver you have to inherit from BaseDriver like this:

from pyccuracy.drivers import BaseDriver

class MyBrowserDriver(BaseDriver):
    def click_element(self, element_selector):
        #do something

    #override many more methods

That should be it. For more information check the browser driver interface.