Friday, July 30, 2010

Solved (eval):3:in `invoke': unknown property or method `readOnly' (WIN32OLERuntimeError)

I used to run my Waitr script in order to set the text field with a value and get the error:

(eval):3:in `invoke': unknown property or method `readOnly' (WIN32OLERuntimeError)

The problem had a simple solution.

These were the two elements in my html source.
<td valign="middle" align="center" id="textValue">
<input type="text" name="textValue" id="textValue">

I wanted to set the textfield to a specific value and my line in my Watir code looked like this
ie.text_field(:id,"textValue").set("awww")

This resulted in Watir trying to set the first element with the value as both had the same id(it had a recognition problem), which was not actually a textfield and threw the error:

(eval):3:in `invoke': unknown property or method `readOnly' (WIN32OLERuntimeError)
HRESULT error code:0x80020006
Unknown name.
from (eval):3:in `readonly?'

Thus I had to find another unique recognition parameter and instead of 'id', and used 'name' instead

Changed my code in Watir to
ie.text_field(:name,"textValue").set("haha")

Now it worked just fine!

~joviano_dias@hotmail.com

No comments:

Post a Comment