Exception getting DIV "class"

37 views
Skip to first unread message

TangoNetworks

unread,
Dec 20, 2010, 5:25:31 PM12/20/10
to watij
Here's my code:

count = self.ie.find().div().all().length()
for x in range(count):
print "\n\nx [%d]"%x
print "Name [%s]"%self.ie.find().div(x).get("name")
print "Id [%s]"%self.ie.find().div(x).get("id")
print "Class [%s]"%self.ie.find().div(x).get("class")

The get("name") and get("id") works fine. Some of the DIVs have names,
some IDs and some CLASS. The get("class") throws this exception:

x [0]
Name [None]
Id [main]
- An error has occurs during execution JavaScript code with the
following content: elementForWatix =
watix237[0];elementForWatix.class;
com.jniwrapper.win32.com.ComException: COM object method returns error
code: 0x80020101; Description: Could not complete the operation due
to error 80020101.
at
com.jniwrapper.win32.com.impl.IUnknownImpl.invokeStandardVirtualMethod(SourceFile:
743)
at
com.jniwrapper.win32.com.impl.IUnknownImpl.invokeStandardVirtualMethod(SourceFile:
722)
at
com.jniwrapper.win32.mshtml.impl.IHTMLWindow2Impl.execScript(Unknown
Source)
at com.jniwrapper.win32.ie.gj.execute(Unknown Source)
at com.jniwrapper.win32.ie.cv.run(Unknown Source)
at com.jniwrapper.win32.MessageLoopThread
$ThreadSynchronizedAction.run(MessageLoopThread.java:566)
at com.jniwrapper.win32.MessageLoopThread
$LoopThread.run(MessageLoopThread.java:508)
Class [None]

Here's the HTML for the DIV I'm trying to find:

<div class="tabheader">
<span id="tab_geninfo" onclick="showTab('geninfo')"
class="selected"><span><a href="#">General Info</a></span></span>
<span id="tab_activation" onclick="showTab('activation')"><span><a
href="#">Activation</a></span></span>
<span id="tab_svcpolicy" onclick="showTab('svcpolicy')"><span><a
href="#">Carrier Dial Strings</a></span></span>
<span id="tab_carrftrs" onclick="showTab('carrftrs')"><span><a
href="#">Carrier Features</a></span></span>
<span id="tab_contactinfo" onclick="showTab('contactinfo')"><span><a
href="#">Contact Information</a></span></span>
</div>

Thoughts?
-C

Brian Knorr

unread,
Dec 20, 2010, 5:39:51 PM12/20/10
to watij
Please use className instead of class...it's good to remember that
under the hood you are calling properties and methods on the
javascript html object. Here is a good reference
http://www.w3schools.com/jsref/dom_obj_all.asp

TangoNetworks

unread,
Dec 21, 2010, 8:55:28 AM12/21/10
to watij
Thanks!

On Dec 20, 4:39 pm, Brian Knorr <btkn...@gmail.com> wrote:
> Please use className instead of class...it's good to remember that
> under the hood you are calling properties and methods on the
> javascript html object.  Here is a good referencehttp://www.w3schools.com/jsref/dom_obj_all.asp
Reply all
Reply to author
Forward
0 new messages