Vishal,
I will rephrase your code in a pseudo code in a way that highlights the
problem with your code (since the error has gone unnoticed by others).
Go through each row in a table on this page,
if the row has a Booking ID,
Then click the search button (going to a new page)
then go to the next row (on the old page, which is no longer in
the browser -- hence your error)
This is a common problem that people run into. The problem, in short, is
that if you are iterating through elements on a page, you need to stop
iterating as soon as you click a button or do something that will cause
a new page to be loaded.
Is this clear?
Bret
Vishal wrote:
> I am encountering exception while iterating table. Below are the
> details. Let me know if anymore information is required
>
> Code:
> table3.each do |row|
> if table3[x][1].text =="Booking ID"
> while (input = f.gets)
> $ie.text_field(:index,2).set(input)
> $ie.button(:value,"Search").click
> report_page()
> end
> end
> if table3[x][1].text == "Booking Trading Partner Role and Code"
> sel_trading_partner()
> end
> x+=1
> end
> --------------------------------------------------------------------------------------------------------------------------------------------------
> Exception :
>
> d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/table.rb:159:in
> `invoke': u
> nknown property or method `rows' (WIN32OLERuntimeError)
> HRESULT error code:0x80070005
> Access is denied. from d:/ruby/lib/ruby/gems/1.8/gems/
> watir-1.6.2/lib/wati
> r/table.rb:159:in `_row'
> from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> table.rb:91:in
> `each'
> from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> table.rb:90:in
> `upto'
> from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> table.rb:90:in
> `each'
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> HTML Code:
>
> <TABLE col=2 width="100%" cellspacing=2 cellpadding=0>
> <COLGROUP>
> <COL width=1>
> <COL width=100%>
> </COLGROUP>
> <TR><TD colspan=2 class=rightPad>
> <input type=submit class=formbutton value="Search"
> name="Booking_Query449.My_Criteria_Panel3.layout0.override0.SearchButtons5"
>
>>
>>
> <input type=submit class=formbutton value="Clear"
> name="Booking_Query449.My_Criteria_Panel3.layout0.override0.SearchButtons5"
> id="resetButton" onClick="this.hasFocus=true" >
> <input type=submit class=formbutton value="Export to
> File"
> name="Booking_Query449.My_Criteria_Panel3.layout0.override0.SearchButtons5"
>
>> </TD>
>>
> </TR>
> <TR><TD class=rightPad>
> <FONT class="inputLabel">
> Booking ID
> </FONT></TD><TD class=rightPad><INPUT TYPE=TEXT
> VALUE=""
> NAME="Booking_Query449.My_Criteria_Panel3.layout0.override1.Booking_ID5"></
> TD>
> </TR>
> <TR><TD class=rightPad>
> <BR></TD><TD class=rightPad>
> <BR></TD>
> </TR>
> <TR><TD class=rightPad>
> <FONT class="inputLabel">
> Booking Trading Partner Role and Code
> </FONT></TD><TD class=rightPad><TABLE BORDER=1><TR
> valign='top'><TD><a name="go"></a>
> <TABLE BORDER=0 CELLSPACING=4>
> <TR>
> <TD VALIGN=CENTER >
> <SELECT
> NAME="Booking_Query449.My_Criteria_Panel3.layout0.override2.Trading_Partner5.tpAndRole10.roleList0"
> SIZE="1">
> <OPTION VALUE=-1>
> <OPTION VALUE=0>Bill To</OPTION>
> <OPTION VALUE=1>Carrier</OPTION>
> <OPTION VALUE=2>Consignee</OPTION>
> <OPTION VALUE=3>Forwarder</OPTION>
> <OPTION VALUE=4>Market</OPTION>
> <OPTION VALUE=5>NVO</OPTION>
> <OPTION VALUE=6>Ship From</OPTION>
> <OPTION VALUE=7>Ship To</OPTION>
> <OPTION VALUE=8>Supplier Contact</OPTION>
> </SELECT>
> </TD>
> <TD VALIGN=CENTER >
> <input type=submit class=formbutton value="Get
> Role-Codes"
> name="Booking_Query449.My_Criteria_Panel3.layout0.override2.Trading_Partner5.tpAndRole10.fetchTradePartners1"
>
> </TD>
> </TR>
> </TABLE></TD><TD>
> >
>
--
Bret Pettichord
Lead Developer, Watir, www.watir.com
Blog, www.io.com/~wazmo/blog
Twitter, www.twitter.com/bpettichord
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines:
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---