About Selenium WebElement

RPA.Browser.Selenium library has keywords Get WebElement and Get WebElements which can be used to interact and get information about Selenium Element.

    Open Available Browser    https://portal.robocorp.com    headless=True
    ${elements}=    Get WebElements    //a[contains(@href,"portal/")]

    # LIST WEBELEMENT PROPERTIES AND METHODS
    ${dir}=    Evaluate    dir($elements[0])
    Log To Console    ${dir}

    # USE WEBELEMENT AS A LOCATOR AND CLICK IT
    Click Element    ${elements}[1]

    # GET WEBELEMENT TEXT AND FONT
    ${text}=    Evaluate    $elements[1].text
    ${font}=    Evaluate    $elements[1].value_of_css_property("font")
    Log To Console    element text: ${text}
    Log To Console    element font: ${font}

    # SAVE SCREENSHOT OF WEBELEMENT
    Evaluate    $elements[1].screenshot("element.png")

Read more about WebElement at selenium.webdriver.remote.webelement — Selenium 4.0.0 documentation

3 Likes