Click element on browser

We are creating a robot that completes a web form to obtain the coordinates of a site based on the address

we are using the following website:

and we need to click on the button “get gps coordinates”

We are trying to make a click element but it does not work, we dont have “ID” on html, the html code of the button is the following:

Get GPS Coordinates


I assume you meant the site:

One way to click the element is to make an XPath that targets a button with the correct text:

Click element    //button[text()='Get GPS Coordinates']

However, there’s a shorthand for this in Selenium:

Click button    Get GPS Coordinates

This will automatically click a button that has either the id, name, or value of “Get GPS Coordinates”.


1 Like

thanks osrjv… works fine,

after that I need to get the coordinates of the field shown in the image and save it in a variable, but I am not finding the correct command.


input id=“latlong” class=“form-control selectall” type=“text”

Hi, @Mike_Caruso!

Here is one possible solution. Still some optimization possibilities such as replacing the sleeps with logical waits:

*** Settings ***
Library           RPA.Browser.Selenium
Task Teardown     Close All Browsers

*** Tasks ***
Get coordinates using
    Open Available Browser
    Wait until geolocation and the map is active
    ${coordinates}=    Get coordinates    Chicago
    Log To Console    ${coordinates}

*** Keywords ***
Wait until geolocation and the map is active
    Wait Until Page Contains    Geolocation on
    # Scrolling activates the map.
    Scroll Element Into View    id:latitude_degres
    Sleep    1 second

*** Keywords ***
Get coordinates
    [Arguments]    ${address}
    Input Text    id:address    ${address}
    Click Button    Get GPS Coordinates
    Sleep    3 seconds
    ${coordinates}=    Get Value    id:latlong
    [Return]    ${coordinates}

If you are planning on using the coordinates often, check out the service providers API at So instead of using that website, you can connect to the API.

1 Like

Perfect!!! thanks a lot!

1 Like