How can I get All Text in robot framework

+1 vote

I have written this following source code,

<div id="groupContainer" class="abcdef">

<ul id="GroupContactListWrapper" class="list-wrapper">
    <li class="contactNameItemContainer">

        <div class="contactNameItem">
            <span class="name">Name</span>
        </div>

    </li>
    <li class="contactNameItemContainer">

        <div class="contactNameItem">
            <span class="name">Name1</span>
        </div>

    </li>
</ul>

</div>

How can I retrieve the names (Name, Name1) in a list variable? I tried using the XPath to "Get Text" keyword but only returns the first one.

//div[@id='groupContainer']//li[@class='contactNameItemContainer']//span

Please help me with a suitable answer.

Jul 1, 2019 in Selenium by Vaishnavi
• 1,180 points
12,624 views

1 answer to this question.

+1 vote
${elem} =   Get WebElements      xpath://div[@id='groupContainer']//li[@class='contactNameItemContainer']//span

FOR  ${item}  IN  @{elem}
   log to console  Item: ${item.text}

END
answered Jan 29, 2020 by Abhishek
• 160 points

Related Questions In Selenium

0 votes
1 answer

How can I clear the text in a text box using Selenium WebDriver?

Hello Akriti, you can clear the text ...READ MORE

answered May 29, 2019 in Selenium by Anvi
• 14,150 points
6,791 views
0 votes
1 answer
0 votes
1 answer

How can I get Webdriver Session ID in Selenium?

Hey Nargis, you can use following methods ...READ MORE

answered Jun 21, 2019 in Selenium by Abha
• 28,140 points
13,541 views
0 votes
1 answer
0 votes
1 answer

How can I run test cases in parallel using Keyword Driven Framework?

One solution to try for executing test ...READ MORE

answered Jun 29, 2020 in Selenium by Alexander
2,866 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,686 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,149 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,227 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,879 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP