Duplicate Elements on the same page

10 views
Skip to first unread message

abrakh

unread,
Jun 7, 2011, 5:20:11 AM6/7/11
to Fitnium
Hi
Is there any way to check/verify duplicate elements on the same page?
Eg: I have a text '£100' 4 times at various locations on the same web
page. How can I verify '£100' is located at all the 4 locations?.
Currently using
| check | is text present | £100 | true|
is checking only the 1st occurrence of the text.
These tests needs to be developed from the UAT tests so do not have
any info on the xpath locators of the text/elements.

your help appreciated.

Many Thanks,
abrakh

Keith Sterling

unread,
Jun 7, 2011, 5:29:28 AM6/7/11
to Fitnium
The API | check | is text present | £100 | true | is a very generic
API in that it works if it finds any occurence of the test ANYWHERE on
the page

If you know exactly where the text is located then you need to look at
using XPath to locate the element with the text in it

lets say you have some <div> elements on the page somewhere each with
the text in it. You could use

| check | is element present | xpath=//div[text()='£100'] | true |

You would obviously have to make each of the xpath statements unique
to find the 4 but this is one way

If each of the divs, had a different id or class, you could use

| check | text of element | xpath=//div[@id='first'] | £100 |
| check | text of element | xpath=//div[@id='second'] | £100 |
| check | text of element | xpath=//div[@id='third'] | £100 |

The key here is that XPath or Css Locators can always be used to
unique identify an element on the page

abrakh

unread,
Jun 7, 2011, 6:04:26 AM6/7/11
to Fitnium
Thanks Keith for a swift response. As mentioned we do not have any
info on the xpath/css locators at this stage. I can imagine its
difficult to verify this situation with out locators. Having something
like check text with index 1 may wrongly pass if the 1st occurrence is
wrong but picks up the 2nd occurrence and thinks it as a 1st
occurrence.

As a broad check what will be good is to have a API on total number
of occurrences | Check | number of occurrences | value| true|. as a
thought ... :)
eg : | Check | 4 | £100 | true|

Many Thanks,
abdulRaheem

Keith Sterling

unread,
Jun 7, 2011, 6:07:11 AM6/7/11
to Fitnium
You should be able to work out the xpath yourselves. At the very min
just do a view source and work from there, but your best method is to
use firefox as you development browser and install Firebug and
XPather.

If you need help working out the Xpaths, and your company will alllow
you to share the HTML you can post it here, or email me directly on
keif...@gmail.com for better privacy

Keith

Abraham Ajao

unread,
Jun 14, 2011, 4:46:26 PM6/14/11
to fit...@googlegroups.com
Hi Keith,
 
I downloaded fitnium onto my E: drive, with the following path E:/fitnium/fitnium etc.
How do i lunch the application?
 
Regards
Abraham

--
You received this message because you are subscribed to the Google
Groups "Fitnium" group.
To post to this group, send email to fit...@googlegroups.com
To unsubscribe from this group, send email to
fitnium+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/fitnium?hl=en

Fitnium is hosted at http://www.magneticreason.com/tools/fitnium/fitnium.html

Keith Sterling

unread,
Jun 22, 2011, 4:58:53 AM6/22/11
to Fitnium
Go into the fitnium folder and look for the .cmd files, runAll.cmd
will execute all components of Fitnium

Or run them individually using runFitnesse.cmd, runSelenium.cmd and
runJetty.cmd

K

On Jun 14, 9:46 pm, Abraham Ajao <aba...@googlemail.com> wrote:
> Hi Keith,
>
> I downloaded fitnium onto my E: drive, with the following path
> E:/fitnium/fitnium etc.
> How do i lunch the application?
>
> Regards
> Abraham
>
>
>
>
>
>
>
> On Tue, Jun 7, 2011 at 11:07 AM, Keith Sterling <keiffs...@gmail.com> wrote:
> > You should be able to work out the xpath yourselves. At the very min
> > just do a view source and work from there, but your best method is to
> > use firefox as you development browser and install Firebug and
> > XPather.
>
> > If you need help working out the Xpaths, and your company will alllow
> > you to share the HTML you can post it here, or email me directly on
> > keiffs...@gmail.com for better privacy
Reply all
Reply to author
Forward
0 new messages