Automated web testing on IE with Python jQuery win32com.client/selenium
===

I have automated test wrote in python. It runs well on Fire Fox but fails miserably on IE, so I'm trying to use java script scripts (using jQuery) for the site manipulation.
I tried to use the Python for windows extension, using the following code to inject the jQuery into the HTML 

    from win32com.client import Dispatch
    ie = Dispatch('InternetExplorer.Application')
    ie.Visible = 1
    ie.Navigate(GlobalSettings.website_url)
    while ie.ReadyState != 4:    
        sleep(1)
    while ie.Document.readyState != "complete": 
        sleep(1)

    def addJQuery(self, browser):
        url="http://jqueryjs.googlecode.com/files/jquery-1.2.4.js"
        document = browser.Document
        window = document.parentWindow
        head = document.getElementsByTagName("head")[0]
        script = document.createElement("script")
        script.type = "text/javascript"
        script.src = url
        head.appendChild(script)
        while not window.jQuery: 
            sleep(0.1)
        return window.jQuery

but I get the error "TypeError: getElementsByTagName() takes exactly 1 argument (2 given)"
on the line head = document.getElementsByTagName("head")[0]. I also tried win32api from pywin32 but I'm getting Unresolved import on

    import win32api

I saw similar questions here and all around Google but couldn't find anything helpfull. 

I will appreciate any help on how to solve the problems mentioned above, how to do it with selenium webdriver or any other suggestion to how to be able to use the scripts.

I'm using Python 2.7 on eclipse and windows vista  


  