Jump to content

Search the Community

Showing results for tags '_ffgetposition'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hello :), I am developing a script with AutoIt for Firefox, to automate performance tests. I have a map, that I have to wait to be loaded, and then I have to click at the center of this map. In order to do this, I get the position of the HTML element representing the map, then I perform a few calculations to find center coordinates. But I have a problem. I use the FF.au3 library, and the function _FFGetPosition to get the coordinates. My function call is $CoordCarte = _FFGetPosition(".getElementById('OpenLayers.Layer.Annotation_3_svgRoot')") and AutoIt gives me this error : "C:\Program Files\AutoIt3\Include\FF.au3" (1928) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: Local $aRet[6] = [$aElement[0], $aElement[1], $aContent[0], $aContent[1], $aContent[2], $aContent[3]] Local $aRet[6] = [$aElement[0], ^ ERROR I checked the HTML id of the element, and it is correct (I checked in Firefox with Javascript console). I really can't figure out what is my mistake. Could you help me please ? If this can help you, here is my script (comments are in French) : ; ########## ; INCLUSIONS ; ########## #include <Array.au3> #include <FF.au3> #include <String.au3> ; ################## ; PARAMETRES GLOBAUX ; ################## Opt("SendKeyDownDelay",80) ; pas trop rapide pour éviter que des frappes soient perdues Opt("WinTitleMatchMode", 3) ; Noms des fenêtres correspondant exactement Opt("GUIEventOptions", 1) ; ################################################ ; ######## FONCTIONS POUR TESTS DE PERF. ######### ; ################################################ Func FaireUnTest() ; Faire un test de performance pour ArcMap ; ; Return : ; Une chaine de caractères avec les temps de chaque tâche, séparés par des point-virgules Local $LigneTemps = "" ; Contient le temps de chaque tâche, séparés par des point-virgules ; Démarrer Firefox _FFStart() ; Handle de la fenêtre Firefox ouverte $hFirefox = _FFWindowGetHandle() ; Connexion MozRepl _FFConnect() ; ########################### ; ########################### ; ######### TACHE 1 ######### ; ########################### ; ########################### ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Connexion au site de Carmen ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Initialisation nouveau timer $hTimer = TimerInit() ; Aller à l'URL de Carmen et attendre son chargement _FFOpenURL("http://carmen.carmencarto.fr/179/OSUR.map#") ; Attendre le chargement de la carte AttendreChargementCarte() ; Ajout temps de la tâche $LigneTemps = $LigneTemps & ";" & TimerDiff($hTimer) / 1000 ; ########################### ; ########################### ; ######### TACHE 2 ######### ; ########################### ; ########################### ;;;;;;;;;;;;;;;;;;;;; ; Localiser 'ACHUN' ; ;;;;;;;;;;;;;;;;;;;;; ; Initialisation nouveau timer $hTimer = TimerInit() ; L'échelle avant le zoom $queryEchelle = ".getElementsByClassName('DescartesGraphicScale')[1].textContent" $EchelleAvantZoom = _FFCmd($queryEchelle) ; On écrit 'ACHUN' dans le champ de commune $InputCommune = _FFObjGet("combo2", "id") _FFObj($InputCommune, "value", "ACHUN") ; Il faut ensuite sélectionner l'élément 'ACHUN' dans la liste déroulante ControlSend($hFirefox, "", "", _StringRepeat("{TAB}", 27)) ; focus sur liste déroulante 'Commune' ControlSend($hFirefox, "", "", _StringRepeat("{DOWN}", 7)) ; sélection élément 'ACHUN' ControlSend($hFirefox, "", "", "{ENTER}") ; validation ; Clic bouton 'Localiser' _FFClick("button", "tag", 0) ; Attendre que le zoom soit fait (ie un changement d'échelle) While _FFCmd($queryEchelle) = $EchelleAvantZoom WEnd ; Attendre le chargement de la carte AttendreChargementCarte() ; Ajout temps de la tâche $LigneTemps = $LigneTemps & ";" & TimerDiff($hTimer) / 1000 ; ########################### ; ########################### ; ######### TACHE 3 ######### ; ########################### ; ########################### ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Sélection d'une station ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;########## NE COMPTE PAS DANS LES MESURES ########## ; Inputs 'x' et 'y' de la page web $InputX = _FFObjGet("x", "id") $InputY = _FFObjGet("y", "id") ; Saisie de la position géographique (dans la carte) de la station '04023310' _FFObj($InputX, "value", "747562") _FFObj($InputY, "value", "6667893") ; Centrage de la carte sur la station '04023310' ControlSend($hFirefox, "", "", _StringRepeat("{TAB}", 7)) ; focus sur bouton 'Centrer' ControlSend($hFirefox, "", "", "{ENTER}") ; validation ; On attend le chargement AttendreChargementCarte() ;########## LA SUITE COMPTE MAINTENANT POUR LES MESURES ########## ; Initialisation nouveau timer $hTimer = TimerInit() ; Clic bouton "Interroger les couches" (après navigation avec {TAB} car cela aurait ouvert une fenêtre non voulue) _FFClick("button", "tag", 9) ;$x = _FFObjGet("OpenLayers.Layer.Annotation_3_svgRoot", "id") ;MsgBox(0, $x, $x) ; Coordonnées de la carte, relativement à l'écran d'ordinateur $CoordCarte = _FFGetPosition(".getElementById('OpenLayers.Layer.Annotation_3_svgRoot')") ; Coordonnées coin supérieur gauche $XDebCarte = $CoordCarte[2] $YDebCarte = $CoordCarte[3] MsgBox(0, "$XDebCarte = ", $XDebCarte) MsgBox(0, "$YDebCarte = ", $YDebCarte) ; Coordonnées coin inférieur droit $XFinCarte = $XDebCarte + $CoordCarte[4] $YFinCarte = $YDebCarte + $CoordCarte[5] MsgBox(0, "$XFinCarte = ", $XDebCarte) MsgBox(0, "$YFinCarte = ", $YDebCarte) ; Coordonnées du centre de la carte, relativement à l'écran d'ordinateur $XMilieuCarte = ($XDebCarte + $XFinCarte) / 2 $YMilieuCarte = ($YDebCarte + $YFinCarte) / 2 MsgBox(0, "$XMilieuCarte = ", $XDebCarte) MsgBox(0, "$YMilieuCarte = ", $YDebCarte) ; Cliquer au milieu de la carte MouseClick("left", $XMilieuCarte, $YMilieuCarte, 1, 1) EndFunc FaireUnTest() Func AttendreChargementCarte() ; Met le script en pause jusqu'au chargement complet ; de la carte de l'application Carmen ; Code JavaScript pour récupérer les images de la carte $imagesQuery = ".getElementsByClassName('olTileImage')" ; Le nombre d'images de la carte $NbImages = _FFCmd($imagesQuery & ".length") ; On attend que toutes les images de la carte soit chargées For $i = 0 To $NbImages - 1 ; Le code JavaScript pour savoir si la i-ème image est chargée $imageCompleteQuery = $imagesQuery & "[" & $i & "].complete" ; Et on attend qu'elle soit chargée While Not _FFCmd($imageCompleteQuery) WEnd Next EndFunc
×
×
  • Create New...