Archive

Posts Tagged ‘watir’

pay attention to attach the IE window when elements not found by watir

October 11th, 2009 No comments

Several times I spend several hours to identify an element, the element is there, but watir can not find it.

I click a link and a new IE window comes up, and forget to attach the new IE window, so watir and me are looking for elements on different windows.

Categories: watir Tags: ,

Refresh a browser using watir

November 1st, 2008 No comments

Bellow is the code to refresh a browser using watir:

ie77.refresh

Related Blogs

Categories: watir Tags: ,

Choose a value from select box by watir

October 31st, 2008 No comments

Bellow is the code to choose the second option from a select box:

ie77.select_list(:class,’inputboxb’).select_item_in_select_list(:index,1)

Related Blogs

  • Related Blogs on select_list
Categories: watir Tags: ,

Send data into an inner html of iframe by watir

October 25th, 2008 No comments

I tried to input data to the inner html of iframe by watir for several months, and posted questions to many forums but got no answer.

Yesterday an idea came into my mind, and I found a solution, following is the code:

ie77.frame(:id, /Editor/).document.body.innertext = “good and better”

Related Blogs

  • Related Blogs on innerpage
Categories: watir Tags: , ,

$ Use the text property to locate a link in watir $

October 13th, 2008 No comments

I found by chance that we can use the text property to locate a link in watir, the following is the syntax I used:

ie77.link(:text => /the text in a link/).click

Related Blogs

Categories: watir Tags: ,

Close all other browser in watir

October 8th, 2008 No comments

I used to close some browsers by following code:

puts “to close a certain previous browser”
Watir::IE.attach(:title, /google/).close
puts “to close a certain previous browser”
Watir::IE.attach(:title, /Internet/).close
puts “to close a certain previous browser”
Watir::IE.attach(:title, /Internet/).close

but when 2 or more watir programs run together, they stalled there. I don’t know the reason, so I tried the following code which worked ok:

sleep 1
puts “to close all the other browsers”
ie77.close_others
sleep 1
puts “to close current browser”
ie77.close

Categories: watir Tags: