'How to get the title attribute and innerHTML from a <a> link tag in robot framework

I have an HTML link

<a class="product-name" href="http://automationpractice.com/index.php?id_product=7&amp;controller=product" title="Printed Chiffon Dress" itemprop="url" style="user-select: auto;">Printed Chiffon Dress</a>

I want to get the value of the title or innerHTML "Printed Chiffon Dress"

        Verify Best Sellers functionality
        Click Link  //ul[@id='home-page-tabs']//child::li[2]//a
        @{links}=  Get WebElements  //div[@class='right-block']//h5//a
        ${cnt}=    Get length    ${links}
        Log  There are ${cnt} lines in the description
    
        FOR    ${a}  IN  @{links}
              ${text}=  Get Text    ${a}
              Log  ${text}
        END


Solution 1:[1]

First, you need to debug whether you get any output in @{links} if yes, then try following code

FOR ${a} IN @{links}
    Log to Console  ${a.text}
END

Solution 2:[2]

Try Get Element Attribute from SeleniumLibrary

 FOR    ${a}  IN  @{links}
              ${text}=  Get Element Attribute    ${a}   title
              Log  ${text}
 END

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 buzzbuzz