[wtr-general] Re: Trouble Locating elements using PageObject

2018-07-03 Thread NaviHan
Hi Titus

Job done. used "elements" instead of "element" as below.

nav_divs_elements[index].span_element

Thanks a million

On Tuesday, 3 July 2018 21:48:19 UTC+10, NaviHan wrote:
>
> This is my first post here. Apologies if there is a mistake.
>
> I have a section of a page as attached in the pic.
>
>
> The html code for the section is as follows
> Enter code here...
> 
> 
> 9830318220466018
> 
>  
>  data-gift-id="9830318220466018">
> 
> Remove
> 
> 
> 
> 
> 
> 
> 9831228610400260
> 
>  
>  data-gift-id="9831228610400260">
> 
> Remove
> 
> 
> 
> 
> 
>
> I need to assert two value here
>
> 1. The vouchers applied, which are 9830318220466018 & 9831228610400260
> 2. The span "Remove"
>
> The issue Im facing is as these two divs are identical and 1 & 2 doesnt 
> have a unique identifier I cannt locate them using PageObjects.
>
> I can locate the element using the following Java script
> document.getElementsByClassName('applied-voucers-list')[0].innerText;
> This returns 
> Enter code here..."9830318220466018
> Remove
> "
>
> I tried to capture this with the code
> Enter code here...@var = 
> @browser.execute_script("document.getElementsByClassName('applied-voucers-list')[0].innerText;")
>
> This isnt working
>
> Any clue?
>
>

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
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.


[wtr-general] Re: Trouble Locating elements using PageObject

2018-07-03 Thread NaviHan
Hi Titus

I have declared the element as 

divs(:nav_divs, class: "row applied-voucers-list")



and accessing span as 

nav_divs_element[index].span_element

index = 0

Error is 

NoMethodError: undefined method `nav_divs_element' for 
#


On Tuesday, 3 July 2018 21:48:19 UTC+10, NaviHan wrote:
>
> This is my first post here. Apologies if there is a mistake.
>
> I have a section of a page as attached in the pic.
>
>
> The html code for the section is as follows
> Enter code here...
> 
> 
> 9830318220466018
> 
>  
>  data-gift-id="9830318220466018">
> 
> Remove
> 
> 
> 
> 
> 
> 
> 9831228610400260
> 
>  
>  data-gift-id="9831228610400260">
> 
> Remove
> 
> 
> 
> 
> 
>
> I need to assert two value here
>
> 1. The vouchers applied, which are 9830318220466018 & 9831228610400260
> 2. The span "Remove"
>
> The issue Im facing is as these two divs are identical and 1 & 2 doesnt 
> have a unique identifier I cannt locate them using PageObjects.
>
> I can locate the element using the following Java script
> document.getElementsByClassName('applied-voucers-list')[0].innerText;
> This returns 
> Enter code here..."9830318220466018
> Remove
> "
>
> I tried to capture this with the code
> Enter code here...@var = 
> @browser.execute_script("document.getElementsByClassName('applied-voucers-list')[0].innerText;")
>
> This isnt working
>
> Any clue?
>
>

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
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.


[wtr-general] Re: Trouble Locating elements using PageObject

2018-07-03 Thread Titus Fortner
Yeah, wow, your code is kind of all over the place. What are you actually 
trying to do?

Notes:
1. Don't use multiple classes as a string value in a class locator
2. innerText isn't an attribute
3. did you include PageObject module?
4. Did you define `nav_divs`?
5. Using `Watir::Wait` directly is not recommended
6. Ugh, PO gem makes all of this so much harder than it needs to be



On Tuesday, July 3, 2018 at 10:14:13 AM UTC-5, NaviHan wrote:
>
> Hi Titus
>
> Tried this
>
> Enter code here...divs(:nav_divs, class: "row applied-voucers-list")
>
> and
>
> Enter code here...@voucher_val = Watir::Wait.until {nav_divs_element[index
> ].span_element}.attribute_value("innerText")
>
> index = 0 as passed by the caller
>
> However Im getting the error
> Enter code here...NoMethodError: undefined method `nav_divs_element' for 
> #
>
>
> Any clue?
>
> On Tuesday, 3 July 2018 23:56:26 UTC+10, Titus Fortner wrote:
>>
>> Yes, how Page Object provides for the ability to manage dynamic 
>> references is one of my major frustrations with the gem's API.
>>
>> Firstly, Watir (and Page Object) allow you to pass in multiple parameters 
>> in a hash format:
>> div(:nav_div, {class: 'applied-vouchers-list', index: 1})
>> nav_div_element
>>
>> This can also be done with less hard coding using collections:
>> divs(:nav_divs, {class: 'applied-vouchers-list')
>> nav_divs_element[1]
>>
>> Note that you can't put multiple classes (space separated values) into 
>> the class locator, without using an array.
>>
>> What it appears you actually want is to find if a specific value is 
>> present, though, which is poorly suited for hard coding an element in the 
>> PO gem. So I'd recommend creating a separate method for it:
>>
>> def code_removable?(id)
>>   button_element(data_gift_id: id)
>>   el.exists? && el.parent.text == 'Remove'
>> end
>>
>>
>>
>>
>>
>> On Tuesday, July 3, 2018 at 7:06:15 AM UTC-5, NaviHan wrote:
>>>
>>> Hi All
>>>
>>> In fact I nailed it in parts by using
>>>
>>>   div(:nav_div, class: "row applied-voucers-list")
>>>   span (:applied_voucher) do |page|
>>> page.nav_div_element.span_element
>>>   end
>>>
>>>
>>> This gives me the first div.
>>>
>>> But how do I access the second div using index parameter?
>>>
>>> On Tuesday, 3 July 2018 21:48:19 UTC+10, NaviHan wrote:

 This is my first post here. Apologies if there is a mistake.

 I have a section of a page as attached in the pic.


 The html code for the section is as follows
 Enter code here...
 
 
 9830318220466018
 
  
 >>> data-gift-id="9830318220466018">
 
 Remove
 
 
 
 
 
 
 9831228610400260
 
  
 >>> data-gift-id="9831228610400260">
 
 Remove
 
 
 
 
 

 I need to assert two value here

 1. The vouchers applied, which are 9830318220466018 & 9831228610400260
 2. The span "Remove"

 The issue Im facing is as these two divs are identical and 1 & 2 doesnt 
 have a unique identifier I cannt locate them using PageObjects.

 I can locate the element using the following Java script
 document.getElementsByClassName('applied-voucers-list')[0].innerText;
 This returns 
 Enter code here..."9830318220466018
 Remove
 "

 I tried to capture this with the code
 Enter code here...@var = 
 @browser.execute_script("document.getElementsByClassName('applied-voucers-list')[0].innerText;")

 This isnt working

 Any clue?



-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
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.


[wtr-general] Re: Trouble Locating elements using PageObject

2018-07-03 Thread NaviHan
Hi Titus

Tried this

Enter code here...divs(:nav_divs, class: "row applied-voucers-list")

and

Enter code here...@voucher_val = Watir::Wait.until {nav_divs_element[index].
span_element}.attribute_value("innerText")

index = 0 as passed by the caller

However Im getting the error
Enter code here...NoMethodError: undefined method `nav_divs_element' for 
#


Any clue?

On Tuesday, 3 July 2018 23:56:26 UTC+10, Titus Fortner wrote:
>
> Yes, how Page Object provides for the ability to manage dynamic references 
> is one of my major frustrations with the gem's API.
>
> Firstly, Watir (and Page Object) allow you to pass in multiple parameters 
> in a hash format:
> div(:nav_div, {class: 'applied-vouchers-list', index: 1})
> nav_div_element
>
> This can also be done with less hard coding using collections:
> divs(:nav_divs, {class: 'applied-vouchers-list')
> nav_divs_element[1]
>
> Note that you can't put multiple classes (space separated values) into the 
> class locator, without using an array.
>
> What it appears you actually want is to find if a specific value is 
> present, though, which is poorly suited for hard coding an element in the 
> PO gem. So I'd recommend creating a separate method for it:
>
> def code_removable?(id)
>   button_element(data_gift_id: id)
>   el.exists? && el.parent.text == 'Remove'
> end
>
>
>
>
>
> On Tuesday, July 3, 2018 at 7:06:15 AM UTC-5, NaviHan wrote:
>>
>> Hi All
>>
>> In fact I nailed it in parts by using
>>
>>   div(:nav_div, class: "row applied-voucers-list")
>>   span (:applied_voucher) do |page|
>> page.nav_div_element.span_element
>>   end
>>
>>
>> This gives me the first div.
>>
>> But how do I access the second div using index parameter?
>>
>> On Tuesday, 3 July 2018 21:48:19 UTC+10, NaviHan wrote:
>>>
>>> This is my first post here. Apologies if there is a mistake.
>>>
>>> I have a section of a page as attached in the pic.
>>>
>>>
>>> The html code for the section is as follows
>>> Enter code here...
>>> 
>>> 
>>> 9830318220466018
>>> 
>>>  
>>> >> data-gift-id="9830318220466018">
>>> 
>>> Remove
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 9831228610400260
>>> 
>>>  
>>> >> data-gift-id="9831228610400260">
>>> 
>>> Remove
>>> 
>>> 
>>> 
>>> 
>>> 
>>>
>>> I need to assert two value here
>>>
>>> 1. The vouchers applied, which are 9830318220466018 & 9831228610400260
>>> 2. The span "Remove"
>>>
>>> The issue Im facing is as these two divs are identical and 1 & 2 doesnt 
>>> have a unique identifier I cannt locate them using PageObjects.
>>>
>>> I can locate the element using the following Java script
>>> document.getElementsByClassName('applied-voucers-list')[0].innerText;
>>> This returns 
>>> Enter code here..."9830318220466018
>>> Remove
>>> "
>>>
>>> I tried to capture this with the code
>>> Enter code here...@var = 
>>> @browser.execute_script("document.getElementsByClassName('applied-voucers-list')[0].innerText;")
>>>
>>> This isnt working
>>>
>>> Any clue?
>>>
>>>

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
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.


[wtr-general] Re: Trouble Locating elements using PageObject

2018-07-03 Thread Titus Fortner
Yes, how Page Object provides for the ability to manage dynamic references 
is one of my major frustrations with the gem's API.

Firstly, Watir (and Page Object) allow you to pass in multiple parameters 
in a hash format:
div(:nav_div, {class: 'applied-vouchers-list', index: 1})
nav_div_element

This can also be done with less hard coding using collections:
divs(:nav_divs, {class: 'applied-vouchers-list')
nav_divs_element[1]

Note that you can't put multiple classes (space separated values) into the 
class locator, without using an array.

What it appears you actually want is to find if a specific value is 
present, though, which is poorly suited for hard coding an element in the 
PO gem. So I'd recommend creating a separate method for it:

def code_removable?(id)
  button_element(data_gift_id: id)
  el.exists? && el.parent.text == 'Remove'
end





On Tuesday, July 3, 2018 at 7:06:15 AM UTC-5, NaviHan wrote:
>
> Hi All
>
> In fact I nailed it in parts by using
>
>   div(:nav_div, class: "row applied-voucers-list")
>   span (:applied_voucher) do |page|
> page.nav_div_element.span_element
>   end
>
>
> This gives me the first div.
>
> But how do I access the second div using index parameter?
>
> On Tuesday, 3 July 2018 21:48:19 UTC+10, NaviHan wrote:
>>
>> This is my first post here. Apologies if there is a mistake.
>>
>> I have a section of a page as attached in the pic.
>>
>>
>> The html code for the section is as follows
>> Enter code here...
>> 
>> 
>> 9830318220466018
>> 
>>  
>> > data-gift-id="9830318220466018">
>> 
>> Remove
>> 
>> 
>> 
>> 
>> 
>> 
>> 9831228610400260
>> 
>>  
>> > data-gift-id="9831228610400260">
>> 
>> Remove
>> 
>> 
>> 
>> 
>> 
>>
>> I need to assert two value here
>>
>> 1. The vouchers applied, which are 9830318220466018 & 9831228610400260
>> 2. The span "Remove"
>>
>> The issue Im facing is as these two divs are identical and 1 & 2 doesnt 
>> have a unique identifier I cannt locate them using PageObjects.
>>
>> I can locate the element using the following Java script
>> document.getElementsByClassName('applied-voucers-list')[0].innerText;
>> This returns 
>> Enter code here..."9830318220466018
>> Remove
>> "
>>
>> I tried to capture this with the code
>> Enter code here...@var = 
>> @browser.execute_script("document.getElementsByClassName('applied-voucers-list')[0].innerText;")
>>
>> This isnt working
>>
>> Any clue?
>>
>>

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
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.


Re: [wtr-general] Re: Trouble Locating elements using PageObject

2018-07-03 Thread rajagopalan madasami
Kindly wait for sometime there is an another guy here named JustinKo, he
will come here soon he knows page object. If he doesn't come here please
post your question on stackoverflow he will surely answer. Sorry to say I
am not using Page object .

On Tue 3 Jul, 2018, 6:20 PM NaviHan,  wrote:

> Here is a reference to where Im coming from
> https://github.com/cheezy/page-object/wiki/Nested-Elements
>
> On Tuesday, 3 July 2018 22:38:58 UTC+10, NaviHan wrote:
>>
>> Will try that.
>>
>> But how to use the index parameter. To explain further
>>
>> Im defining the div element as
>>
>> div(:nav_div, class: "row applied-voucers-list")
>>
>> And the span element as
>>
>> span (:applied_voucher) do |page|
>> page.nav_div_element.span_element
>>   end
>>
>> This gives the span element using default index of 0
>> How do I identify the second span element with index of 1?
>>
>> Cheers
>>
>>
>> On Tue, Jul 3, 2018 at 10:31 PM,  wrote:
>>
>>> I am not stopping you, I asked you to convert that into your model.
>>>
>>> On Tuesday, July 3, 2018 at 5:57:35 PM UTC+5:30, NaviHan wrote:

 I would like to use the PageObject gem..

 On Tue, Jul 3, 2018 at 10:24 PM,  wrote:

> What are you saying me? I gave you the answer, did you try?
>
> On Tuesday, July 3, 2018 at 5:51:20 PM UTC+5:30, NaviHan wrote:
>>
>> Thanks.
>> The query is posted in the group now.
>> https://groups.google.com/forum/#!topic/watir-general/mJ1IhrQWCxg
>>
>> Hi Raja
>>
>> In fact I nailed it in parts by using
>>
>>   div(:nav_div, class: "row applied-voucers-list")
>>   span (:applied_voucher) do |page|
>> page.nav_div_element.span_element
>>   end
>>
>>
>> This gives me the first div.
>>
>> But how do I access the second div using index parameter?
>>
>> Cheers
>> Navi
>>
>> On Tue, Jul 3, 2018 at 10:18 PM,  wrote:
>>
>>> Ah sorry, I made a small mistake in last mail
>>>
>>> Use this
>>>
>>>
>>> p b.divs(class: "row applied-voucers-list".split).map {|div| div.div
 .span.text}
>>>
>>>
>>> On Tuesday, July 3, 2018 at 5:36:15 PM UTC+5:30, NaviHan wrote:

 Hi All

 In fact I nailed it in parts by using

   div(:nav_div, class: "row applied-voucers-list")
   span (:applied_voucher) do |page|
 page.nav_div_element.span_element
   end


 This gives me the first div.

 But how do I access the second div using index parameter?

 On Tuesday, 3 July 2018 21:48:19 UTC+10, NaviHan wrote:
>
> This is my first post here. Apologies if there is a mistake.
>
> I have a section of a page as attached in the pic.
>
>
> The html code for the section is as follows
> Enter code here...
> 
> 
> 9830318220466018
> 
> 
>  data-gift-id="9830318220466018">
> 
> Remove
> 
> 
> 
> 
> 
> 
> 9831228610400260
> 
> 
>  data-gift-id="9831228610400260">
> 
> Remove
> 
> 
> 
> 
> 
>
> I need to assert two value here
>
> 1. The vouchers applied, which are 9830318220466018 &
> 9831228610400260
> 2. The span "Remove"
>
> The issue Im facing is as these two divs are identical and 1 & 2
> doesnt have a unique identifier I cannt locate them using PageObjects.
>
> I can locate the element using the following Java script
>
> document.getElementsByClassName('applied-voucers-list')[0].innerText;
> This returns
> Enter code here..."9830318220466018
> Remove
> "
>
> I tried to capture this with the code
> Enter code here...@var =
> @browser.execute_script("document.getElementsByClassName('applied-voucers-list')[0].innerText;")
>
> This isnt working
>
> Any clue?
>
> --
>>> --
>>> Before posting, please read
>>> https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
>>>
>>> In short: search before you ask, be nice.
>>>
>>> watir-...@googlegroups.com
>>> http://groups.google.com/group/watir-general
>>> watir-genera...@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-genera...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> --
> Before posting, please read
> 

Re: [wtr-general] Re: Trouble Locating elements using PageObject

2018-07-03 Thread NaviHan
Here is a reference to where Im coming from
https://github.com/cheezy/page-object/wiki/Nested-Elements

On Tuesday, 3 July 2018 22:38:58 UTC+10, NaviHan wrote:
>
> Will try that.
>
> But how to use the index parameter. To explain further
>
> Im defining the div element as
>
> div(:nav_div, class: "row applied-voucers-list")
>
> And the span element as
>
> span (:applied_voucher) do |page|
> page.nav_div_element.span_element
>   end
>
> This gives the span element using default index of 0
> How do I identify the second span element with index of 1?
>
> Cheers
>
>
> On Tue, Jul 3, 2018 at 10:31 PM,  wrote:
>
>> I am not stopping you, I asked you to convert that into your model. 
>>
>> On Tuesday, July 3, 2018 at 5:57:35 PM UTC+5:30, NaviHan wrote:
>>>
>>> I would like to use the PageObject gem..
>>>
>>> On Tue, Jul 3, 2018 at 10:24 PM,  wrote:
>>>
 What are you saying me? I gave you the answer, did you try? 

 On Tuesday, July 3, 2018 at 5:51:20 PM UTC+5:30, NaviHan wrote:
>
> Thanks.
> The query is posted in the group now.
> https://groups.google.com/forum/#!topic/watir-general/mJ1IhrQWCxg
>
> Hi Raja
>
> In fact I nailed it in parts by using
>
>   div(:nav_div, class: "row applied-voucers-list")
>   span (:applied_voucher) do |page|
> page.nav_div_element.span_element
>   end
>
>
> This gives me the first div.
>
> But how do I access the second div using index parameter?
>
> Cheers
> Navi
>
> On Tue, Jul 3, 2018 at 10:18 PM,  wrote:
>
>> Ah sorry, I made a small mistake in last mail 
>>
>> Use this
>>
>>
>> p b.divs(class: "row applied-voucers-list".split).map {|div| div.div.
>>> span.text}
>>
>>
>> On Tuesday, July 3, 2018 at 5:36:15 PM UTC+5:30, NaviHan wrote:
>>>
>>> Hi All
>>>
>>> In fact I nailed it in parts by using
>>>
>>>   div(:nav_div, class: "row applied-voucers-list")
>>>   span (:applied_voucher) do |page|
>>> page.nav_div_element.span_element
>>>   end
>>>
>>>
>>> This gives me the first div.
>>>
>>> But how do I access the second div using index parameter?
>>>
>>> On Tuesday, 3 July 2018 21:48:19 UTC+10, NaviHan wrote:

 This is my first post here. Apologies if there is a mistake.

 I have a section of a page as attached in the pic.


 The html code for the section is as follows
 Enter code here...
 
 
 9830318220466018
 
  
 >>> data-gift-id="9830318220466018">
 
 Remove
 
 
 
 
 
 
 9831228610400260
 
  
 >>> data-gift-id="9831228610400260">
 
 Remove
 
 
 
 
 

 I need to assert two value here

 1. The vouchers applied, which are 9830318220466018 & 
 9831228610400260
 2. The span "Remove"

 The issue Im facing is as these two divs are identical and 1 & 2 
 doesnt have a unique identifier I cannt locate them using PageObjects.

 I can locate the element using the following Java script

 document.getElementsByClassName('applied-voucers-list')[0].innerText;
 This returns 
 Enter code here..."9830318220466018
 Remove
 "

 I tried to capture this with the code
 Enter code here...@var = 
 @browser.execute_script("document.getElementsByClassName('applied-voucers-list')[0].innerText;")

 This isnt working

 Any clue?

 -- 
>> -- 
>> Before posting, please read 
>> https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
>>  
>>
>> In short: search before you ask, be nice.
>>  
>> watir-...@googlegroups.com
>> http://groups.google.com/group/watir-general
>> watir-genera...@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-genera...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> -- 
 -- 
 Before posting, please read 
 https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
  

 In short: search before you ask, be nice.
  
 watir-...@googlegroups.com
 http://groups.google.com/group/watir-general
 watir-genera...@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 

Re: [wtr-general] Re: Trouble Locating elements using PageObject

2018-07-03 Thread Navi
Will try that.

But how to use the index parameter. To explain further

Im defining the div element as

div(:nav_div, class: "row applied-voucers-list")

And the span element as

span (:applied_voucher) do |page|
page.nav_div_element.span_element
  end

This gives the span element using default index of 0
How do I identify the second span element with index of 1?

Cheers


On Tue, Jul 3, 2018 at 10:31 PM,  wrote:

> I am not stopping you, I asked you to convert that into your model.
>
> On Tuesday, July 3, 2018 at 5:57:35 PM UTC+5:30, NaviHan wrote:
>>
>> I would like to use the PageObject gem..
>>
>> On Tue, Jul 3, 2018 at 10:24 PM,  wrote:
>>
>>> What are you saying me? I gave you the answer, did you try?
>>>
>>> On Tuesday, July 3, 2018 at 5:51:20 PM UTC+5:30, NaviHan wrote:

 Thanks.
 The query is posted in the group now.
 https://groups.google.com/forum/#!topic/watir-general/mJ1IhrQWCxg

 Hi Raja

 In fact I nailed it in parts by using

   div(:nav_div, class: "row applied-voucers-list")
   span (:applied_voucher) do |page|
 page.nav_div_element.span_element
   end


 This gives me the first div.

 But how do I access the second div using index parameter?

 Cheers
 Navi

 On Tue, Jul 3, 2018 at 10:18 PM,  wrote:

> Ah sorry, I made a small mistake in last mail
>
> Use this
>
>
> p b.divs(class: "row applied-voucers-list".split).map {|div| div.div.
>> span.text}
>
>
> On Tuesday, July 3, 2018 at 5:36:15 PM UTC+5:30, NaviHan wrote:
>>
>> Hi All
>>
>> In fact I nailed it in parts by using
>>
>>   div(:nav_div, class: "row applied-voucers-list")
>>   span (:applied_voucher) do |page|
>> page.nav_div_element.span_element
>>   end
>>
>>
>> This gives me the first div.
>>
>> But how do I access the second div using index parameter?
>>
>> On Tuesday, 3 July 2018 21:48:19 UTC+10, NaviHan wrote:
>>>
>>> This is my first post here. Apologies if there is a mistake.
>>>
>>> I have a section of a page as attached in the pic.
>>>
>>>
>>> The html code for the section is as follows
>>> Enter code here...
>>> 
>>> 
>>> 9830318220466018
>>> 
>>> 
>>> >> data-gift-id="9830318220466018">
>>> 
>>> Remove
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 9831228610400260
>>> 
>>> 
>>> >> data-gift-id="9831228610400260">
>>> 
>>> Remove
>>> 
>>> 
>>> 
>>> 
>>> 
>>>
>>> I need to assert two value here
>>>
>>> 1. The vouchers applied, which are 9830318220466018 &
>>> 9831228610400260
>>> 2. The span "Remove"
>>>
>>> The issue Im facing is as these two divs are identical and 1 & 2
>>> doesnt have a unique identifier I cannt locate them using PageObjects.
>>>
>>> I can locate the element using the following Java script
>>> document.getElementsByClassName('applied-voucers-list')[0].i
>>> nnerText;
>>> This returns
>>> Enter code here..."9830318220466018
>>> Remove
>>> "
>>>
>>> I tried to capture this with the code
>>> Enter code here...@var = @browser.execute_script("docum
>>> ent.getElementsByClassName('applied-voucers-list')[0].innerText;")
>>>
>>> This isnt working
>>>
>>> Any clue?
>>>
>>> --
> --
> Before posting, please read https://github.com/watir/watir
> _meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
> In short: search before you ask, be nice.
>
> watir-...@googlegroups.com
> http://groups.google.com/group/watir-general
> watir-genera...@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-genera...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

 --
>>> --
>>> Before posting, please read https://github.com/watir/watir
>>> _meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
>>> In short: search before you ask, be nice.
>>>
>>> watir-...@googlegroups.com
>>> http://groups.google.com/group/watir-general
>>> watir-genera...@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-genera...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> --
> Before posting, please read https://github.com/watir/
> watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
> In short: search before you ask, be nice.
>
> watir-general@googlegroups.com
> 

Re: [wtr-general] Re: Trouble Locating elements using PageObject

2018-07-03 Thread rajagopalanmadasami
I am not stopping you, I asked you to convert that into your model. 

On Tuesday, July 3, 2018 at 5:57:35 PM UTC+5:30, NaviHan wrote:
>
> I would like to use the PageObject gem..
>
> On Tue, Jul 3, 2018 at 10:24 PM, > 
> wrote:
>
>> What are you saying me? I gave you the answer, did you try? 
>>
>> On Tuesday, July 3, 2018 at 5:51:20 PM UTC+5:30, NaviHan wrote:
>>>
>>> Thanks.
>>> The query is posted in the group now.
>>> https://groups.google.com/forum/#!topic/watir-general/mJ1IhrQWCxg
>>>
>>> Hi Raja
>>>
>>> In fact I nailed it in parts by using
>>>
>>>   div(:nav_div, class: "row applied-voucers-list")
>>>   span (:applied_voucher) do |page|
>>> page.nav_div_element.span_element
>>>   end
>>>
>>>
>>> This gives me the first div.
>>>
>>> But how do I access the second div using index parameter?
>>>
>>> Cheers
>>> Navi
>>>
>>> On Tue, Jul 3, 2018 at 10:18 PM,  wrote:
>>>
 Ah sorry, I made a small mistake in last mail 

 Use this


 p b.divs(class: "row applied-voucers-list".split).map {|div| div.div.
> span.text}


 On Tuesday, July 3, 2018 at 5:36:15 PM UTC+5:30, NaviHan wrote:
>
> Hi All
>
> In fact I nailed it in parts by using
>
>   div(:nav_div, class: "row applied-voucers-list")
>   span (:applied_voucher) do |page|
> page.nav_div_element.span_element
>   end
>
>
> This gives me the first div.
>
> But how do I access the second div using index parameter?
>
> On Tuesday, 3 July 2018 21:48:19 UTC+10, NaviHan wrote:
>>
>> This is my first post here. Apologies if there is a mistake.
>>
>> I have a section of a page as attached in the pic.
>>
>>
>> The html code for the section is as follows
>> Enter code here...
>> 
>> 
>> 9830318220466018
>> 
>>  
>> > data-gift-id="9830318220466018">
>> 
>> Remove
>> 
>> 
>> 
>> 
>> 
>> 
>> 9831228610400260
>> 
>>  
>> > data-gift-id="9831228610400260">
>> 
>> Remove
>> 
>> 
>> 
>> 
>> 
>>
>> I need to assert two value here
>>
>> 1. The vouchers applied, which are 9830318220466018 & 9831228610400260
>> 2. The span "Remove"
>>
>> The issue Im facing is as these two divs are identical and 1 & 2 
>> doesnt have a unique identifier I cannt locate them using PageObjects.
>>
>> I can locate the element using the following Java script
>> document.getElementsByClassName('applied-voucers-list')[0].innerText;
>> This returns 
>> Enter code here..."9830318220466018
>> Remove
>> "
>>
>> I tried to capture this with the code
>> Enter code here...@var = 
>> @browser.execute_script("document.getElementsByClassName('applied-voucers-list')[0].innerText;")
>>
>> This isnt working
>>
>> Any clue?
>>
>> -- 
 -- 
 Before posting, please read 
 https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
  

 In short: search before you ask, be nice.
  
 watir-...@googlegroups.com
 http://groups.google.com/group/watir-general
 watir-genera...@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-genera...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> -- 
>> -- 
>> Before posting, please read 
>> https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
>>  
>>
>> In short: search before you ask, be nice.
>>  
>> watir-...@googlegroups.com 
>> http://groups.google.com/group/watir-general
>> watir-genera...@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-genera...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
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.


Re: [wtr-general] Re: Trouble Locating elements using PageObject

2018-07-03 Thread Navi
I would like to use the PageObject gem..

On Tue, Jul 3, 2018 at 10:24 PM,  wrote:

> What are you saying me? I gave you the answer, did you try?
>
> On Tuesday, July 3, 2018 at 5:51:20 PM UTC+5:30, NaviHan wrote:
>>
>> Thanks.
>> The query is posted in the group now.
>> https://groups.google.com/forum/#!topic/watir-general/mJ1IhrQWCxg
>>
>> Hi Raja
>>
>> In fact I nailed it in parts by using
>>
>>   div(:nav_div, class: "row applied-voucers-list")
>>   span (:applied_voucher) do |page|
>> page.nav_div_element.span_element
>>   end
>>
>>
>> This gives me the first div.
>>
>> But how do I access the second div using index parameter?
>>
>> Cheers
>> Navi
>>
>> On Tue, Jul 3, 2018 at 10:18 PM,  wrote:
>>
>>> Ah sorry, I made a small mistake in last mail
>>>
>>> Use this
>>>
>>>
>>> p b.divs(class: "row applied-voucers-list".split).map {|div| div.div.
 span.text}
>>>
>>>
>>> On Tuesday, July 3, 2018 at 5:36:15 PM UTC+5:30, NaviHan wrote:

 Hi All

 In fact I nailed it in parts by using

   div(:nav_div, class: "row applied-voucers-list")
   span (:applied_voucher) do |page|
 page.nav_div_element.span_element
   end


 This gives me the first div.

 But how do I access the second div using index parameter?

 On Tuesday, 3 July 2018 21:48:19 UTC+10, NaviHan wrote:
>
> This is my first post here. Apologies if there is a mistake.
>
> I have a section of a page as attached in the pic.
>
>
> The html code for the section is as follows
> Enter code here...
> 
> 
> 9830318220466018
> 
> 
>  data-gift-id="9830318220466018">
> 
> Remove
> 
> 
> 
> 
> 
> 
> 9831228610400260
> 
> 
>  data-gift-id="9831228610400260">
> 
> Remove
> 
> 
> 
> 
> 
>
> I need to assert two value here
>
> 1. The vouchers applied, which are 9830318220466018 & 9831228610400260
> 2. The span "Remove"
>
> The issue Im facing is as these two divs are identical and 1 & 2
> doesnt have a unique identifier I cannt locate them using PageObjects.
>
> I can locate the element using the following Java script
> document.getElementsByClassName('applied-voucers-list')[0].innerText;
> This returns
> Enter code here..."9830318220466018
> Remove
> "
>
> I tried to capture this with the code
> Enter code here...@var = @browser.execute_script("docum
> ent.getElementsByClassName('applied-voucers-list')[0].innerText;")
>
> This isnt working
>
> Any clue?
>
> --
>>> --
>>> Before posting, please read https://github.com/watir/watir
>>> _meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
>>> In short: search before you ask, be nice.
>>>
>>> watir-...@googlegroups.com
>>> http://groups.google.com/group/watir-general
>>> watir-genera...@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-genera...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> --
> Before posting, please read https://github.com/watir/
> watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
> 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 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
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.


Re: [wtr-general] Re: Trouble Locating elements using PageObject

2018-07-03 Thread rajagopalanmadasami
What are you saying me? I gave you the answer, did you try? 

On Tuesday, July 3, 2018 at 5:51:20 PM UTC+5:30, NaviHan wrote:
>
> Thanks.
> The query is posted in the group now.
> https://groups.google.com/forum/#!topic/watir-general/mJ1IhrQWCxg
>
> Hi Raja
>
> In fact I nailed it in parts by using
>
>   div(:nav_div, class: "row applied-voucers-list")
>   span (:applied_voucher) do |page|
> page.nav_div_element.span_element
>   end
>
>
> This gives me the first div.
>
> But how do I access the second div using index parameter?
>
> Cheers
> Navi
>
> On Tue, Jul 3, 2018 at 10:18 PM, > 
> wrote:
>
>> Ah sorry, I made a small mistake in last mail 
>>
>> Use this
>>
>>
>> p b.divs(class: "row applied-voucers-list".split).map {|div| div.div.span
>>> .text}
>>
>>
>> On Tuesday, July 3, 2018 at 5:36:15 PM UTC+5:30, NaviHan wrote:
>>>
>>> Hi All
>>>
>>> In fact I nailed it in parts by using
>>>
>>>   div(:nav_div, class: "row applied-voucers-list")
>>>   span (:applied_voucher) do |page|
>>> page.nav_div_element.span_element
>>>   end
>>>
>>>
>>> This gives me the first div.
>>>
>>> But how do I access the second div using index parameter?
>>>
>>> On Tuesday, 3 July 2018 21:48:19 UTC+10, NaviHan wrote:

 This is my first post here. Apologies if there is a mistake.

 I have a section of a page as attached in the pic.


 The html code for the section is as follows
 Enter code here...
 
 
 9830318220466018
 
  
 >>> data-gift-id="9830318220466018">
 
 Remove
 
 
 
 
 
 
 9831228610400260
 
  
 >>> data-gift-id="9831228610400260">
 
 Remove
 
 
 
 
 

 I need to assert two value here

 1. The vouchers applied, which are 9830318220466018 & 9831228610400260
 2. The span "Remove"

 The issue Im facing is as these two divs are identical and 1 & 2 doesnt 
 have a unique identifier I cannt locate them using PageObjects.

 I can locate the element using the following Java script
 document.getElementsByClassName('applied-voucers-list')[0].innerText;
 This returns 
 Enter code here..."9830318220466018
 Remove
 "

 I tried to capture this with the code
 Enter code here...@var = 
 @browser.execute_script("document.getElementsByClassName('applied-voucers-list')[0].innerText;")

 This isnt working

 Any clue?

 -- 
>> -- 
>> Before posting, please read 
>> https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
>>  
>>
>> In short: search before you ask, be nice.
>>  
>> watir-...@googlegroups.com 
>> http://groups.google.com/group/watir-general
>> watir-genera...@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-genera...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
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.


Re: [wtr-general] Re: Trouble Locating elements using PageObject

2018-07-03 Thread Navi
Thanks.
The query is posted in the group now.
https://groups.google.com/forum/#!topic/watir-general/mJ1IhrQWCxg

Hi Raja

In fact I nailed it in parts by using

  div(:nav_div, class: "row applied-voucers-list")
  span (:applied_voucher) do |page|
page.nav_div_element.span_element
  end


This gives me the first div.

But how do I access the second div using index parameter?

Cheers
Navi

On Tue, Jul 3, 2018 at 10:18 PM,  wrote:

> Ah sorry, I made a small mistake in last mail
>
> Use this
>
>
> p b.divs(class: "row applied-voucers-list".split).map {|div| div.div.span.
>> text}
>
>
> On Tuesday, July 3, 2018 at 5:36:15 PM UTC+5:30, NaviHan wrote:
>>
>> Hi All
>>
>> In fact I nailed it in parts by using
>>
>>   div(:nav_div, class: "row applied-voucers-list")
>>   span (:applied_voucher) do |page|
>> page.nav_div_element.span_element
>>   end
>>
>>
>> This gives me the first div.
>>
>> But how do I access the second div using index parameter?
>>
>> On Tuesday, 3 July 2018 21:48:19 UTC+10, NaviHan wrote:
>>>
>>> This is my first post here. Apologies if there is a mistake.
>>>
>>> I have a section of a page as attached in the pic.
>>>
>>>
>>> The html code for the section is as follows
>>> Enter code here...
>>> 
>>> 
>>> 9830318220466018
>>> 
>>> 
>>> >> data-gift-id="9830318220466018">
>>> 
>>> Remove
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 9831228610400260
>>> 
>>> 
>>> >> data-gift-id="9831228610400260">
>>> 
>>> Remove
>>> 
>>> 
>>> 
>>> 
>>> 
>>>
>>> I need to assert two value here
>>>
>>> 1. The vouchers applied, which are 9830318220466018 & 9831228610400260
>>> 2. The span "Remove"
>>>
>>> The issue Im facing is as these two divs are identical and 1 & 2 doesnt
>>> have a unique identifier I cannt locate them using PageObjects.
>>>
>>> I can locate the element using the following Java script
>>> document.getElementsByClassName('applied-voucers-list')[0].innerText;
>>> This returns
>>> Enter code here..."9830318220466018
>>> Remove
>>> "
>>>
>>> I tried to capture this with the code
>>> Enter code here...@var = @browser.execute_script("docum
>>> ent.getElementsByClassName('applied-voucers-list')[0].innerText;")
>>>
>>> This isnt working
>>>
>>> Any clue?
>>>
>>> --
> --
> Before posting, please read https://github.com/watir/
> watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
> 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 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
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.


[wtr-general] Re: Trouble Locating elements using PageObject

2018-07-03 Thread rajagopalanmadasami
Ah sorry, I made a small mistake in last mail 

Use this


p b.divs(class: "row applied-voucers-list".split).map {|div| div.div.span.
> text}


On Tuesday, July 3, 2018 at 5:36:15 PM UTC+5:30, NaviHan wrote:
>
> Hi All
>
> In fact I nailed it in parts by using
>
>   div(:nav_div, class: "row applied-voucers-list")
>   span (:applied_voucher) do |page|
> page.nav_div_element.span_element
>   end
>
>
> This gives me the first div.
>
> But how do I access the second div using index parameter?
>
> On Tuesday, 3 July 2018 21:48:19 UTC+10, NaviHan wrote:
>>
>> This is my first post here. Apologies if there is a mistake.
>>
>> I have a section of a page as attached in the pic.
>>
>>
>> The html code for the section is as follows
>> Enter code here...
>> 
>> 
>> 9830318220466018
>> 
>>  
>> > data-gift-id="9830318220466018">
>> 
>> Remove
>> 
>> 
>> 
>> 
>> 
>> 
>> 9831228610400260
>> 
>>  
>> > data-gift-id="9831228610400260">
>> 
>> Remove
>> 
>> 
>> 
>> 
>> 
>>
>> I need to assert two value here
>>
>> 1. The vouchers applied, which are 9830318220466018 & 9831228610400260
>> 2. The span "Remove"
>>
>> The issue Im facing is as these two divs are identical and 1 & 2 doesnt 
>> have a unique identifier I cannt locate them using PageObjects.
>>
>> I can locate the element using the following Java script
>> document.getElementsByClassName('applied-voucers-list')[0].innerText;
>> This returns 
>> Enter code here..."9830318220466018
>> Remove
>> "
>>
>> I tried to capture this with the code
>> Enter code here...@var = 
>> @browser.execute_script("document.getElementsByClassName('applied-voucers-list')[0].innerText;")
>>
>> This isnt working
>>
>> Any clue?
>>
>>

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
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.


[wtr-general] Re: Trouble Locating elements using PageObject

2018-07-03 Thread rajagopalanmadasami
I will write in watir and then you may convert that code into your 
pageobject code

p b.divs(class: "row applied-voucers-list").map {|div| div.div.span.text}




This will print two span text, look at carefully I used b.divs not b.div

On Tuesday, July 3, 2018 at 5:36:15 PM UTC+5:30, NaviHan wrote:
>
> Hi All
>
> In fact I nailed it in parts by using
>
>   div(:nav_div, class: "row applied-voucers-list")
>   span (:applied_voucher) do |page|
> page.nav_div_element.span_element
>   end
>
>
> This gives me the first div.
>
> But how do I access the second div using index parameter?
>
> On Tuesday, 3 July 2018 21:48:19 UTC+10, NaviHan wrote:
>>
>> This is my first post here. Apologies if there is a mistake.
>>
>> I have a section of a page as attached in the pic.
>>
>>
>> The html code for the section is as follows
>> Enter code here...
>> 
>> 
>> 9830318220466018
>> 
>>  
>> > data-gift-id="9830318220466018">
>> 
>> Remove
>> 
>> 
>> 
>> 
>> 
>> 
>> 9831228610400260
>> 
>>  
>> > data-gift-id="9831228610400260">
>> 
>> Remove
>> 
>> 
>> 
>> 
>> 
>>
>> I need to assert two value here
>>
>> 1. The vouchers applied, which are 9830318220466018 & 9831228610400260
>> 2. The span "Remove"
>>
>> The issue Im facing is as these two divs are identical and 1 & 2 doesnt 
>> have a unique identifier I cannt locate them using PageObjects.
>>
>> I can locate the element using the following Java script
>> document.getElementsByClassName('applied-voucers-list')[0].innerText;
>> This returns 
>> Enter code here..."9830318220466018
>> Remove
>> "
>>
>> I tried to capture this with the code
>> Enter code here...@var = 
>> @browser.execute_script("document.getElementsByClassName('applied-voucers-list')[0].innerText;")
>>
>> This isnt working
>>
>> Any clue?
>>
>>

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
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.


[wtr-general] Re: Trouble Locating elements using PageObject

2018-07-03 Thread NaviHan
Hi All

In fact I nailed it in parts by using

  div(:nav_div, class: "row applied-voucers-list")
  span (:applied_voucher) do |page|
page.nav_div_element.span_element
  end


This gives me the first div.

But how do I access the second div using index parameter?

On Tuesday, 3 July 2018 21:48:19 UTC+10, NaviHan wrote:
>
> This is my first post here. Apologies if there is a mistake.
>
> I have a section of a page as attached in the pic.
>
>
> The html code for the section is as follows
> Enter code here...
> 
> 
> 9830318220466018
> 
>  
>  data-gift-id="9830318220466018">
> 
> Remove
> 
> 
> 
> 
> 
> 
> 9831228610400260
> 
>  
>  data-gift-id="9831228610400260">
> 
> Remove
> 
> 
> 
> 
> 
>
> I need to assert two value here
>
> 1. The vouchers applied, which are 9830318220466018 & 9831228610400260
> 2. The span "Remove"
>
> The issue Im facing is as these two divs are identical and 1 & 2 doesnt 
> have a unique identifier I cannt locate them using PageObjects.
>
> I can locate the element using the following Java script
> document.getElementsByClassName('applied-voucers-list')[0].innerText;
> This returns 
> Enter code here..."9830318220466018
> Remove
> "
>
> I tried to capture this with the code
> Enter code here...@var = 
> @browser.execute_script("document.getElementsByClassName('applied-voucers-list')[0].innerText;")
>
> This isnt working
>
> Any clue?
>
>

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
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.


[wtr-general] Trouble Locating elements using PageObject

2018-07-03 Thread Navi
This is my first post here. Apologies if there is a mistake.

I have a section of a page as attached in the pic.


The html code for the section is as follows
Enter code here...


9830318220466018




Remove






9831228610400260




Remove






I need to assert two value here

1. The vouchers applied, which are 9830318220466018 & 9831228610400260
2. The span "Remove"

The issue Im facing is as these two divs are identical and 1 & 2 doesnt
have a unique identifier I cannt locate them using PageObjects.

I can locate the element using the following Java script
document.getElementsByClassName('applied-voucers-list')[0].innerText;
This returns
Enter code here..."9830318220466018
Remove
"

I tried to capture this with the code
Enter code here...@var =
@browser.execute_script("document.getElementsByClassName('applied-voucers-list')[0].innerText;")

This isnt working

Any clue?

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
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.