import os
import webbrowser

class DriverAPI(object):
    @property
    def title(self):
        raise NotImplementedError

    @property
    def html(self):
        raise NotImplementedError

    @property
    def url(self):
        raise NotImplementedError

    def visit(self, url):
        raise NotImplementedError

    def open_in_browser(self, path):
        webbrowser.open(path)
        
    def save_and_open_page(self):
                
        if not os.path.exists('/tmp/splinter'):
            os.mkdir('/tmp/splinter')
            
        tempfile = open('/tmp/splinter/splinter.html', 'w')
        tempfile.write(self.html)
        tempfile.close()
        
        tempfile_path = os.path.abspath(tempfile.name)
        
        self.open_in_browser(tempfile_path)
         
    def find(self, css_selector=None,
                   xpath=None,
                   name=None,
                   id=None,
                   tag=None):
        raise NotImplementedError

    def find_link(self, text=None, href=None):
        raise NotImplementedError

    def fill_in(self, name, value):
        raise NotImplementedError

    def quit(self):
        raise NotImplementedError


class ElementAPI(object):

    def _get_value(self):
        raise NotImplementedError

    def _set_value(self, value):
        raise NotImplementedError

    value = property(_get_value, _set_value)

    def click(self):
        raise NotImplementedError

    def __getitem__(self, attribute):
        raise NotImplementedError

@@ -245,32 +245,40 @@
 mplementedError%0A
+        
 %0A    def visit(s
@@ -315,32 +315,187 @@
 plementedError%0A%0A
+    def execute_script(self, script):%0A        raise NotImplementedError%0A        %0A    def evaluate_script(self, script):%0A        raise NotImplementedError%0A%0A
     def open_in_
@@ -962,16 +962,32 @@
 def find
+_by_css_selector
 (self, c
@@ -997,22 +997,18 @@
 selector
-=None,
+):
 %0A       
@@ -1008,25 +1008,50 @@
         
- 
+raise NotImplementedError%0A
         
   xpath=
@@ -1046,107 +1046,317 @@
     
+%0A 
   
-xpath=None,%0A                   name=None,%0A                   id=None,%0A                   tag=None
+ def find_by_xpath(self, xpath):%0A        raise NotImplementedError%0A%0A    def find_by_name(self, name):%0A        raise NotImplementedError%0A%0A    def find_by_id(self, id):%0A        raise NotImplementedError%0A%0A    def find_by_tag(self, tag):%0A        raise NotImplementedError%0A%0A    def find_link_by_href(self, href
 ):%0A 
@@ -1406,16 +1406,24 @@
 ind_link
+_by_text
 (self, t
@@ -1429,24 +1429,8 @@
 text
-=None, href=None
 ):%0A 
@@ -1491,24 +1491,253 @@
 , name, valu
+e):%0A        raise NotImplementedError%0A        %0A    attacth_file = fill_in%0A%0A    def choose(self, name):%0A        raise NotImplementedError%0A    %0A    def check(self, name):%0A        raise NotImplementedError%0A%0A    def uncheck(self, nam
 e):%0A        
@@ -1818,17 +1818,16 @@
 dError%0A%0A
-%0A
 class El
@@ -2066,32 +2066,314 @@
 ImplementedError
+%0A        %0A    def check(self):%0A        raise NotImplementedError%0A        %0A    def uncheck(self):%0A        raise NotImplementedError%0A%0A    @property%0A    def checked(self):%0A        raise NotImplementedError%0A        %0A    @property%0A    def visible(self):%0A        raise NotImplementedError
 %0A%0A    def __geti
@@ -2409,29 +2409,28 @@
    raise NotImplementedError
-%0A

update base driverapi interface