I would suggest you take some time and learn how ruby works, and how to
manage strings.

On Fri, Jan 2, 2015 at 10:23 AM, Sohail Mirza <mrz...@gmail.com> wrote:

> Hi Joe
>
> I am getting the following error.
>
> *Code:*
> $rowCount = @browser.table(:class, 'table table-hover table-condensed
> table-bordered table-striped ng-scope ng-table').rows.size
> @browser.text_field(:xpath,'/html/body/div/div[4]/div/div[2]/div/lookup-grid/div/div/div[1]/div/table/tbody/tr[$rowCount-2]/td[1]/input[1]').when_present.set
> 'w1'
>
> puts $rowCount // This print 6. if i inspect the last row and copy xpath
>
> *xpath:*
>
> /html/body/div/div[4]/div/div[2]/div/lookup-grid/div/div/div[1]/div/table/tbody/
> *tr[4]*/td[1]/input[1]
>
> so, i just replaced xpath as following ....
>
>
> /html/body/div/div[4]/div/div[2]/div/lookup-grid/div/div/div[1]/div/table/tbody/
> *tr[4]*/td[1]/input[1]
>
> /html/body/div/div[4]/div/div[2]/div/lookup-grid/div/div/div[1]/div/table/tbody/
> *tr[$rowCount-2*]/td[1]/input[1]')
>
> Note: my table has 6 rows .. 2 rows are being considered from header.
>
> *Error*
>       timed out after 30 seconds, waiting for
> {:xpath=>"/html/body/div/div[4]/di
> v/div[2]/div/lookup-grid/div/div/div[1]/div/table/tbody/tr*[$rowCount-2*
> ]/td[1]/in
> put[1]", :tag_name=>"input or textarea", :type=>"(any text type)"} to
> become pre
> sent (Watir::Wait::TimeoutError)
>       ./features/step_definitions/ManageConsumables.rb:23:in `/^I enter
> required
>  information$/'
>       features\ManageConsumables.feature:4:in `When I enter required
> information
>
> On Wed, Dec 31, 2014 at 9:14 PM, Joe Fleck <joeflec...@gmail.com> wrote:
>
>> Hi,
>>
>> What is the error you are receiving?
>>
>> Joe
>> On Dec 31, 2014 4:08 AM, "Sohail Mirza" <mrz...@gmail.com> wrote:
>>
>>> Can we use variable for XPath property?
>>>
>>> The following line of codes failing
>>>
>>> $rowCount = @browser.table(:class, 'table table-hover table-condensed
>>> table-bordered table-striped ng-scope ng-table').rows.size
>>>
>>>
>>> @browser.text_field(:xpath,'/html/body/div/div[4]/div/div[2]/div/lookup-grid/div/div/div[1]/div/table/tbody/
>>> tr[*$rowCount*-2]/td[1]/input[1]').when_present.set 'test'
>>>
>>> Any comments?
>>>
>>>  --
>>> --
>>> Before posting, please read http://watir.com/support. In short: search
>>> before you ask, be nice.
>>>
>>> watir-general@googlegroups.com
>>> http://groups.google.com/group/watir-general
>>> watir-general+unsubscr...@googlegroups.com
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Watir General" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to watir-general+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
>> --
>> Before posting, please read http://watir.com/support. In short: search
>> before you ask, be nice.
>>
>> watir-general@googlegroups.com
>> http://groups.google.com/group/watir-general
>> watir-general+unsubscr...@googlegroups.com
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Watir General" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to watir-general+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> watir-general@googlegroups.com
> http://groups.google.com/group/watir-general
> watir-general+unsubscr...@googlegroups.com
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Watir General" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to watir-general+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to