# Question on watir

**URL:** <https://www.ruby-forum.com/t/question-on-watir/224437>\
**Category:** Ruby\
**Created:** [November 12, 2012, 5:45am UTC](https://www.ruby-forum.com/t/question-on-watir/224437 "2012-11-12T05:45:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [November 12, 2012, 5:45am UTC](https://www.ruby-forum.com/t/question-on-watir/224437/1 "2012-11-12T05:45:39Z")

</div>

I am automating Idit application using Ruby, at one screen I can’t feed  
the input to one of the text box using the code  
$browser.select\_field(:id,"").set() what could be the reason.?

Raj

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 12, 2012, 9:53am UTC](https://www.ruby-forum.com/t/question-on-watir/224437/2 "2012-11-12T09:53:52Z")

</div>

I think it’s usually select\_list, and you haven’t entered an id to look  
for. You also haven’t given a value to set to.

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 12, 2012, 10:30am UTC](https://www.ruby-forum.com/t/question-on-watir/224437/3 "2012-11-12T10:30:52Z")

</div>

hi thanks for reply.  
I just place the syntax, My original line is this  
“$browser.text\_field(:id,‘IDITForm@pmlPercentage’).set(23)”

it gives the error

“Unable to locate element, using {:tag\_name=\>[“text”, “password”,  
“textarea”], :id=\>“IDITForm@pmlPercentage”}”

But I can manually enter the value into this text box. while I am  
writing this line “puts  
$browser.text\_field(:id,‘IDITForm@pmlPercentage’).exists?” it prints  
false. But that element is present there.

If so, what would be the solution?

Raj

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 12, 2012, 8:40pm UTC](https://www.ruby-forum.com/t/question-on-watir/224437/4 "2012-11-12T20:40:24Z")

</div>

There are a few reasons it might not work.

Try navigating to the page using a Watir browser running through  
Interactive Ruby so you can do some live experimentation.

Try using longer paths, like specifying any parent elements (frames in  
particular):  
thisfield =  
$browser.frame(:index,0).text\_field(:id,‘IDITForm@pmlPercentage’)

Ensure that the page is fully loaded before looking for the field, In  
order to do this, I use Watir-Webdriver rather than just Watir alone, so  
I tend to use when\_present:  
$browser.text\_field(:id,‘IDITForm@pmlPercentage’).when\_present.set(23)

Otherwise, try locating all (or some of) the text fields and iterating  
through them to make sure you have the details exactly right (name, id,  
value, etc.):  
$browser.text\_fields.each {|el| puts el.id }

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 14, 2012, 2:14pm UTC](https://www.ruby-forum.com/t/question-on-watir/224437/5 "2012-11-14T14:14:03Z")

</div>

No problem, I struggled to find documentation when starting out with  
Watir, but it’s getting better all the time.

These are handy resources:

[http://watirwebdriver.com/](http://watirwebdriver.com/)

[http://www.rubydoc.info/github/jarib/watir-webdriver/](http://www.rubydoc.info/github/jarib/watir-webdriver/)

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 14, 2012, 11:24am UTC](https://www.ruby-forum.com/t/question-on-watir/224437/6 "2012-11-14T11:24:32Z")

</div>

Hi,

Really so much thank you for your reply, Actually I have already solved  
the problem, I solved the problem by executing via IRB mode in dos mode,  
But confusion still reamins because I was not able to identified what  
that problem was. But after i went through the IRB mode,scripts is also  
working fine, i haven’t done any changes in scripts. . And some of your  
codings(give below) are useful for me for further work. Thank you so  
much for you reply.

“$browser.text\_field(:id,‘IDITForm@pmlPercentage’).when\_present.set(23)”  
“$browser.text\_fields.each {|el| puts el.id }”

Thanks,  
Raj

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 15, 2012, 6:09am UTC](https://www.ruby-forum.com/t/question-on-watir/224437/7 "2012-11-15T06:09:24Z")

</div>

Hi Joel P.

Thank you so much.

RAJ

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 15, 2012, 11:13am UTC](https://www.ruby-forum.com/t/question-on-watir/224437/8 "2012-11-15T11:13:50Z")

</div>

Hi Joel P.

I am using eclipse for automation,when i am executing the program using  
debug mode,Once i executed some lines, is it possible to bring the  
control back to some lines before, and continue execution from there or  
debugging from there?What i meant to ask was, can i bring back the  
control after execution happens,and then continue the execution from  
there on(from new place)?

Raj

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 15, 2012, 11:27am UTC](https://www.ruby-forum.com/t/question-on-watir/224437/9 "2012-11-15T11:27:20Z")

</div>

Hi Joel P.

please look at this error,

[15:51:13] [ERROR] : Error attaching: excelOpen: false , fileOpen:  
false, file:  
C:\work1\IDITTestAutomationProject\TestData\TestData\_MyCopy.xls error:  
Open  
OLE error code:800A03EC in Microsoft Office Excel  
‘TestData\_MyCopy.xls’ cannot be accessed. The file may be  
corrupted, located on a server that is not responding, or read-only.  
HRESULT error code:0x80020009  
Exception occurred.  
Open  
OLE error code:800A03EC in Microsoft Office Excel  
‘TestData\_MyCopy.xls’ cannot be accessed. The file may be  
corrupted, located on a server that is not responding, or read-only.  
HRESULT error code:0x80020009  
Exception occurred.

I encounter this error so often, I haven’t opened any Excel file during  
execution, But still i am encountering this error, what is the reason ?  
But if I close the eclipse and open again then this won’t be coming.How  
to solve this error without closing the eclipse?

Raj

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 15, 2012, 1:25pm UTC](https://www.ruby-forum.com/t/question-on-watir/224437/10 "2012-11-15T13:25:18Z")

</div>

Raj pal wrote in post #1084536:

> Hi Joel P.
> 
> please look at this error,
> 
> [15:51:13] [ERROR] : Error attaching: excelOpen: false , fileOpen:  
> false, file:  
> C:\work1\IDITTestAutomationProject\TestData\TestData\_MyCopy.xls error:  
> Open  
> OLE error code:800A03EC in Microsoft Office Excel  
> ‘TestData\_MyCopy.xls’ cannot be accessed. The file may be  
> corrupted, located on a server that is not responding, or read-only.  
> HRESULT error code:0x80020009  
> Exception occurred.  
> Open  
> OLE error code:800A03EC in Microsoft Office Excel  
> ‘TestData\_MyCopy.xls’ cannot be accessed. The file may be  
> corrupted, located on a server that is not responding, or read-only.  
> HRESULT error code:0x80020009  
> Exception occurred.
> 
> I encounter this error so often, I haven’t opened any Excel file during  
> execution, But still i am encountering this error, what is the reason ?  
> But if I close the eclipse and open again then this won’t be coming.How  
> to solve this error without closing the eclipse?
> 
> Raj

You may have crashed out without closing the process which is accessing  
the file. In that case, you might have an invisible process locking the  
file which is being terminated when you close Eclipse.  
Have a look at this for example:

* * *

begin  
excel = WIN32OLE::new(“excel.application”)  
#Do some stuff where excel might crash  
rescue  
excel.Quit()unless excel.nil?  
end

* * *

Within that code, if you experience an error inside the begin/end block,  
excel will close and therefore stop locking whichever file it’s  
accessing. You should probably do the same type of exception-based  
garbage collection with any object which might lock files.

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 15, 2012, 3:45pm UTC](https://www.ruby-forum.com/t/question-on-watir/224437/11 "2012-11-15T15:45:29Z")

</div>

Hi,

I got it, Thank you.

Raj

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 16, 2012, 6:18am UTC](https://www.ruby-forum.com/t/question-on-watir/224437/12 "2012-11-16T06:18:00Z")

</div>

i don’t understand, what do you mean by “unsubscribe”?

Raj

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 16, 2012, 1:19am UTC](https://www.ruby-forum.com/t/question-on-watir/224437/13 "2012-11-16T01:19:27Z")

</div>

unsubscribe

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 16, 2012, 6:28am UTC](https://www.ruby-forum.com/t/question-on-watir/224437/14 "2012-11-16T06:28:29Z")

</div>

Hi Raj,

People seem to have gotten the idea that they unsubscribe by sending the  
word “unsubscribe” to the list itself.

Unfortunately, this is mistaken; it’ll no sooner unsubscribe them than  
would shouting unsubscribe at the computer screen.

If they really want to unsubscribe, they can either use the form here:

[http://www.ruby-lang.org/en/community/mailing-lists/](http://www.ruby-lang.org/en/community/mailing-lists/)

Or they can mail the word “unsubscribe” to the list _controller_  
address, which for ruby-talk is:

removed\_email\_address@domain.invalid

Cheers,

Arlen

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 16, 2012, 6:52am UTC](https://www.ruby-forum.com/t/question-on-watir/224437/15 "2012-11-16T06:52:31Z")

</div>

Hi Arlen

Thank you , I was confused when i saw the word unsubscribe,because i  
thought somebody was asking me to unsubscribe. Now it’s clear .

Raj

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 20, 2012, 7:15am UTC](https://www.ruby-forum.com/t/question-on-watir/224437/16 "2012-11-20T07:15:33Z")

</div>

hi Joel P.

I have a question, For an example consider that I have to execute 10  
test case, but at the first attempt it is found that internet has been  
down, in such situation, it is not terminating the execution, but it  
tries to run the remaining test cases, any idea to stop this as soon as  
it realizes internet connection has been down.? It should not execute  
the remaining test cases as soon as it is found internet connection has  
been down.

Raj

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [November 20, 2012, 4:08pm UTC](https://www.ruby-forum.com/t/question-on-watir/224437/17 "2012-11-20T16:08:26Z")

</div>

Yeah I will start a new thread if i have question in future, Thank you  
so much.

Raj

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [January 21, 2013, 10:23am UTC](https://www.ruby-forum.com/t/question-on-watir/224437/18 "2013-01-21T10:23:34Z")

</div>

hi,

I couldn’t create a new thread, If press submit button, it came back to  
the preview window .So I am posting here.

I have installed Ruby 1.8.7 and while i was trying to install “gem  
install watir” it gives the error "ERROR: Error installing  
watir:win32-process requires Ruby version \> 1.9.0."But it was not the  
case when i installed the Ruby last time? Is there any way to install  
win32-process in version 1.8.7?Or is there any way can i able to install  
“gem install watir” without any error?

Raj

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [January 21, 2013, 10:39am UTC](https://www.ruby-forum.com/t/question-on-watir/224437/19 "2013-01-21T10:39:47Z")

</div>

You’d need to install a version compatible with 1.8.7:  
“gem install watir -v (version number here)”  
But a far better approach is to upgrade to Ruby 1.9.3.

---

<div class="post-metadata">

**Author:** ![rganapathy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee7513/32.png) [@rganapathy](https://www.ruby-forum.com/u/rganapathy)\
**Post date:** [January 21, 2013, 10:57am UTC](https://www.ruby-forum.com/t/question-on-watir/224437/20 "2013-01-21T10:57:30Z")

</div>

“gem install watir -v (version number here)”

I used this “gem install watir -v 3.0.0” (the reason I have used is,I  
have watir 3.0.0 for Ruby 1.8.7 in my computer already)Now i am  
installing into another system. But anyway i couldn’t succeed with  
installation using the above syntax.

Raj

[Next page](https://www.ruby-forum.com/t/question-on-watir/224437.md?page=2)
