Maps inside webPage

Dear Community,

I am currently facing an issue in my automation process due to an embedded Google Maps component, where I need to select a specific address.

I have attempted enabling and setting specific coordinates, but these approaches have not resolved the problem.

I have attached the URL of the webpage and a screenshot illustrating how the map should be displayed. Any guidance or recommendations on how to proceed would be greatly appreciated.

URL

Code :slight_smile:
*** Settings ***
Library SeleniumLibrary

*** Variables ***
${BROWSER} safari
${URL} SafeQ

*** Test Cases ***
Abrir Página con JavaScript Activado
Open Browser about:blank ${BROWSER} options=add_argument(“–enable-javascript”)
Maximize Browser Window

# Inyectar un script para asegurarse de que JavaScript está activado
Execute JavaScript    return navigator.javaEnabled();

# Cargar la página
Go To    ${URL}

Sleep    15s

# Esperar hasta que la página termine de cargar
Wait Until Page Contains Element    css=body    timeout=10s

# Validar que Google Maps se cargĂł correctamente
Wait Until Keyword Succeeds    5x    30s    Verificar Carga de Google Maps

Close Browser

*** Keywords ***
Verificar Carga de Google Maps
${maps_cargado} = Execute JavaScript return typeof google !== “undefined” && typeof google.maps !== “undefined”;
Should Be True ${maps_cargado} Google Maps no se ha cargado aún, reintentando…

Best regards,

Best thing here is to use screenshot comparison
there is a library called robotframework-imagecompare ( made by @Many )

take a reference screenshot ( preferrably using selenium when the page is working correctly and make it your reference screenshot ) then perform the test steps until you reach that page , capture page screenshot , compare it against the reference

I just understood that you need to click on the map right , maybe in specific location at the map ?

I recommend that you

  • simulate a geolocation when you launch the test so that the map load on needed address
  • get the map location on the window and click on coordinates by percentage
  • do the test manually and calculate in percentage your click will be where in terms of percentage of that map
  • recalculate that coordinates and click

i didn’t try it before , but it is worth trying ( maybe you need to add it in python code then import it on top of robot framework ) :

    driver.execute_cdp_cmd("Emulation.setGeolocationOverride", {
    "latitude": 48.8566, 
    "longitude": 2.3522,  
    "accuracy": 100 })

Hello Hassieneadb

Thank you for your support, at the end what I did was continue with Chrome browser instead Safari browser and refresh after 10s if not apprears the maps.

Br.

1 Like