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, <[email protected] <javascript:>> > 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...<div class="small-12 applied-evouchers"> >>>> <div class="row applied-voucers-list"> >>>> <div class="small-6"> >>>> <span>9830318220466018</span> >>>> </div> >>>> <div class="small-6 small-text-right"> >>>> <button type="button" class="remove-gift-cert" >>>> data-gift-id="9830318220466018"> >>>> <span class="icon icon-cross-standard-small-black"></span> >>>> <span class="underline remove-evoucher-button-text">Remove</span> >>>> </button> >>>> </div> >>>> </div> >>>> <hr> >>>> <div class="row applied-voucers-list"> >>>> <div class="small-6"> >>>> <span>9831228610400260</span> >>>> </div> >>>> <div class="small-6 small-text-right"> >>>> <button type="button" class="remove-gift-cert" >>>> data-gift-id="9831228610400260"> >>>> <span class="icon icon-cross-standard-small-black"></span> >>>> <span class="underline remove-evoucher-button-text">Remove</span> >>>> </button> >>>> </div> >>>> </div> >>>> <hr> >>>> </div> >>>> >>>> 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. >> >> [email protected] <javascript:> >> http://groups.google.com/group/watir-general >> [email protected] <javascript:> >> --- >> 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 [email protected] <javascript:>. >> 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. [email protected] http://groups.google.com/group/watir-general [email protected] --- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
