Sign in to follow this  
Followers 0
wagner1308

tests for web application

11 posts in this topic

hi,

I would like to create tests for web application, can someone help me?

my browser is Firefox.

thanks!!!

Share this post


Link to post
Share on other sites



what do you mean with "test"... and you should do a more specific question

Share this post


Link to post
Share on other sites

what do you mean with "test"... and you should do a more specific question

hi oMBRa,

I'm creating the script for testing web applications with autoit, automating the testing of my application.

But I'm having trouble creating this test because it is an application that runs in the browser, I found a library called FF.au3 and I am trying to use some functions that exist in that library.I use the function _FFclick ($ sElement, $ sMode = "elements", $ iIndex = 0) but I see the following error message:_FFClick ==> No match: $sElement: window.content.document.getElementById('kindOfbutton_button_10_divExt')

I'm using Firebug to get id, class, name, tag

But still I get this error message

thanks!!!

Share this post


Link to post
Share on other sites

hi oMBRa,

I'm creating the script for testing web applications with autoit, automating the testing of my application.

But I'm having trouble creating this test because it is an application that runs in the browser, I found a library called FF.au3 and I am trying to use some functions that exist in that library.I use the function _FFclick ($ sElement, $ sMode = "elements", $ iIndex = 0) but I see the following error message:_FFClick ==> No match: $sElement: window.content.document.getElementById('kindOfbutton_button_10_divExt')

I'm using Firebug to get id, class, name, tag

But still I get this error message

thanks!!!

never thought about posting some code?

Share this post


Link to post
Share on other sites

never thought about posting some code?

I can not post the code, but I will try to explain what I do:

I have a web application, I access this application via browser "that I do, now I try to click buttons, fill out forms that can not. For that I'm using libraries that I found here as FF.au3 and web.au3

you can imagine a site try clicking on their buttons, fill out your form among other things

thanks!!

Share this post


Link to post
Share on other sites

what do you want from us?

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

what do you want from us?

I am using this function, try to click a button.

but I am not able to make him do his job.

; #FUNCTION# ===================================================================
; Name ..........: _FFClick
; Description ...: Simulates a click on an element.
; Beschreibung ..: Simuliert einen Klick auf ein Element.
; AutoIt Version : V3.3.0.0
; Syntax ........: _FFClick($sElement[, $sMode = "elements"[, $iIndex = 0]])
; Parameter(s): .: $sElement    - Element to click on
;                 $sMode       - Optional: (Default = "elements") :
;                              | elements
;                              | id
;                              | name
;                              | class
;                              | tag
;                 $iIndex     - Optional: (Default = 0) : Index if $sMode = elements, name, tag
; Return Value ..: Success    - 1
;                 Failure     - 0
;                 @ERROR       -
; Author(s) .....: Thorsten Willert
; Date ..........: Thu Apr 09 21:18:33 CEST 2009 @846 /Internet Time/
; Link ..........:
; Related .......: _FFClickXY, _FFImageClick, _FFLinkClick, _FFObjGet
; Example .......: Yes
; ==============================================================================
Func _FFClick($sElement, $sMode = "elements", $iIndex = 0)
    Local $sFuncName = "_FFClick"

    If Not IsInt($iIndex) Then
        SetError(__FFError($sFuncName, $_FF_ERROR_InvalidDataType, "(int) $iIndex: " & $iIndex))
        Return 0
    EndIf

    Switch StringLower($sMode)
        Case "elements"
            If StringLeft($sElement, 7) = "OBJECT|" Then $sElement = StringMid($sElement, 8)
        Case "id"
            $sElement = ".getElementById('" & $sElement & "')"
        Case "name"
            $sElement = ".getElementsByName('" & $sElement & "')[" & $iIndex & "]"
        Case "class"
            $sElement = ".getElementsByClassName('" & $sElement & "')[" & $iIndex & "]"
        Case "tag"
            $sElement = ".getElementsByTagName('" & $sElement & "')[" & $iIndex & "]"
        Case Else
            SetError(__FFError($sFuncName, $_FF_ERROR_InvalidValue, "(elements|id|name|class|tag) $sMode: " & $sMode))
            Return 0
    EndSwitch

    If StringLeft($sElement, 1) = "." Then $sElement = "window.content.document" & $sElement

    Local $RetVal = _FFCmd("FFau3.simulateClick(" & $sElement & ",0,0);")
    If Not @error And $RetVal <> "_FFCmd_Err" And $RetVal = 1 Then
        Sleep(25)
        Return $RetVal
    Else
        SetError(__FFError($sFuncName, $_FF_ERROR_NoMatch, "$sElement: " & $sElement))
        Return 0
    EndIf

EndFunc ;==>_FFClick

can you explain me this function _FFClick?

Edited by wagner1308

Share this post


Link to post
Share on other sites

If you wanna click e.g. on the button "Pesquisa Google" in your example:

_FFClick('btnG','name')

or in this case:

_FFFormSubmit()

without any parameters, because it is the first form on this page.

If you wanna fill in something to search:

_FFSetValueByName('q', 'StringToSearch')

Share this post


Link to post
Share on other sites

If you wanna click e.g. on the button "Pesquisa Google" in your example:

_FFClick('btnG','name')

or in this case:

_FFFormSubmit()

without any parameters, because it is the first form on this page.

If you wanna fill in something to search:

_FFSetValueByName('q', 'StringToSearch')

The Autoit Window Info tool does not work very well for implementation web. I am trying to use the functions of this library FF.au3 to aplication web. I do not know if this would be the best library for use with web, if anyone has one for me to say thank you. Because these functions do not really work for me

Share this post


Link to post
Share on other sites

The Autoit Window Info tool does not work very well for implementation web. I am trying to use the functions of this library FF.au3 to aplication web. I do not know if this would be the best library for use with web, if anyone has one for me to say thank you. Because these functions do not really work for me

Why doesn't the functions work for you?

"Doesn't work" isn't a really an exact error description :D

e.g a search in google looks like this:

#include <FF.au3>

_FFConnect() ; connect to FF

_FFOpenURL("google.com") ; open google

_FFSetValueByName('q', 'StringToSearch') ; fill in the search-string
_FFFormSubmit(); submit the formular

is this to complitcated?

OK its simpler to use the google-search-API, but it works with all other forms the same way.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0