List Icon
Mailing list Archive

2019 up to July 2022 | 20182017  |  2016  2015 2014 | 2013

The mailing list has been closed since July 2022, but continues to serve as an archive of information about QF-Test.
But if you want to stay informed about news about QF-Test, you can simply
Subscribe to Newsletter  

To get up-to-date information about each release - including minor releases - you can
subscribe to the RSS feed or follow us on social media.
Alternatively, QF-Test also provides release information itself.

Another source of information is our blog, where there are current articles on general topics, on the company QFS and also various "how-tos"
subscribe to blog

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [QF-Test] How to nicely iterate all DomNode such as Table Collection

  • Subject: Re: [QF-Test] How to nicely iterate all DomNode such as Table Collection
  • From: Martin Moser <martin.moser@?.de>
  • Date: Wed, 26 Feb 2014 14:29:51 +0100

Hi Gwen,

there are several ways for doing this:

1) Approach 1 - Simlpe SUT script:
You can record a click on the DIV element with the class list.
Afterwards you can use a SUT-script (Insert node -> Control structures ->
SUT script) like this:

node = rc.getComponent("COMPONENT-ID-OF-DIV-ELEMENT")
children = node.getChildren()
for child in children:
	if child.getAttribute("class") == "item":
		#asserts on child

2.) Approach 2 - Use CustomResolver and SUT script:
A more elegant approach could be that you tell QF-Test that a web object
with the attribute class="list" should act as list.
Therefore call the procedure "qfs.web.ajax.installCustomWebResolver" from
the standard library qfs.qft.
There you specify the argument "goodClasses" and set "item,list" as value.

Afterwards you record a click at the object with the list again and insert
a SUT-script, but with following code:

node = rc.getComponent("COMPONENT-ID-OF-DIV-ELEMENT")
children = node.getElementsByClassName("item")
for child in children:
	#asserts on child

Best Regards,

--On Dienstag, Februar 25, 2014 10:58:42 +0000 Gwenael Plantefeve
<gwen0504@?.com> wrote:


In Web testing, I have the following Web page structure:

<div class="list">
    <div class="item">value1</div>
    <div class="item">value2</div>
    <div class="item">value3</div>
    <div class="item">value4</div>

I would like to iterate all div elements with same class name (here
class="item"). And do some asserts on value of each div element.

What is the best way to handle this?

Thanks in advance for your help


Martin Moser
Development & Support

E: martin.moser@?.de
T: +49 (0)8171 38648-14
F: +49 (0)8171 38648-16

Quality First Software GmbH |
Tulpenstr. 41 | 82538 Geretsried | Germany
GF Gregor Schmid, Karlheinz Kellerer
HRB München 140833