[python-win32] win32com getElementsByClassName error

Mark Hammond skippy.hammond at gmail.com
Fri May 24 07:36:03 CEST 2013


Are you using IE9?  It looks like that is causing some problems which 
I've not dug into.  See https://sourceforge.net/p/pywin32/bugs/608/ for 
another example of a very similar error...

On 24/05/2013 9:46 AM, Anthony Andriano wrote:
> I'm trying to navigate through in intranet site using python. Everything
> works as expected until I try to get an element.
>
>  >>> import win32com.client
>  >>> ie = win32com.client.DispatchEx("InternetExplorer.Application")
>  >>> ie.visible = 1
>  >>> ie.Navigate(url)
> # I waited long enough by inspection
>  >>> toButton = ie.Document.getElementsByClassName(className)[1]
>
> Which results in:
>      TypeError: getElementsByClassName() takes exactly 1 argument (2 given)
>
> Is it passing self to the function? I don't even know what self is in
> this context. Trying to get an element by ID works just fine with
> getElementByID, but the element I need to click doesn't have an ID.
>
> I also can't get the click() method to work even when I can get the
> right object. Is it supposed to be as easy as obj.click()?
>
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>



More information about the python-win32 mailing list