Results 1 to 2 of 2
  1. #1

    Click Fails : Recognition Problem or Sync Problem?

    I am just not able to understand QTP behaviour with this Image.Click failing problem ...

    I posted about this: Here

    I tried using browser.page.frame.image.object.click ... not working.

    I have changed the click coordinates as 1,1 or 0,0... Click is happening but ... fails intermittently ...

    Here are my questions :

    When QTP fails to perform a click on a object (say a button or image) - there could be two possibilities ...

    1. QTP is not able locate the object (in this case it is OR). If this is the case - click should NEVER work. If click never works then we can think of helping QTP in locating - we can try things like getting child object from the parent then do click, get the element by DOM then do click and so on ...

    We would be investigating this path as we are sure that it is QTP control recognition problem

    2. Click works only when we go by debugging or out of several times of execution say out 10 times - click works on 4-5 times rest of time it fails to click the button and proceeds ....

    Now this is a freky situation... At one end .. it appears to me that Button recognition is not a problem (as there are instance where button click DID work) and other end is this "unpredictable" behaviour.

    Can this be a synchronization related issue ---

    Can be ... so, tried following :
    1. Clicked after checking the existence ... image.exist
    2. Can this be an enabled/disabled status issues - checked that too ... does not seem to be the case
    3. Tried various options of Wait ... before and after the click ...

    I would like stop QTP from proceeding (during execution)further beyond this control if click fails ... Unfortunately ...Click method does not return anything ... hence it appears that there is no way to figure out if click was succcessful. As per the test logic .. there is not point in continuing the test if click fails.

    In short ... Is this a control recognition problem or synchronisation problem ...or is there any other category of problem I am not thinking about?

    If it is synchronization problem - are there any other mechanisms of making QTP not go beyond this control if click fails ?

    Shrini Kulkarni
    Test Consultant

  2. #2
    Advanced Member gencke's Avatar
    Join Date
    Feb 2008
    Seattle, Washington, United States

    Re: Click Fails : Recognition Problem or Sync Problem?

    Here is a function we use and it works well for us.

    ' Clicks the object and syncs the browser
    Sub Click( str )

    Dim dialog, currentReportFilter
    Dim oDesc, ClickableObjects
    dialog = false

    ' disable reporting and sync browser
    currentReportFilter = Reporter.Filter
    Reporter.Filter = rfEnableErrorsAndWarnings

    ' handle special cases in local file
    str = ClickCaseString(str)
    dialog = ClickCaseDialog(str)

    ' get the clickable objects
    Set oDesc = Description.Create()
    oDesc("outerhtml").value = "(<a.*|<button.*|<input.*|<webarea.*|& lt;img.*)(=""|='|=|&gt" & str & "(""|'| |<|&gt.*"
    Set ClickableObjects = getPage().ChildObjects(oDesc)

    ' cycle through all objects matching the description
    For i=0 to ClickableObjects.count-1
    ' make sure object is not hidden
    If instr(ucase(ClickableObjects(i).getROProperty("out erhtml")), "DISPLAY: NONE") = 0 Then
    ' enable reporting, click and sync
    Reporter.Filter = currentReportFilter
    ReportInfo "Click", str
    If dialog Then
    If getDialog().WinButton("text:=OK").Exist Then
    End If
    End If
    Exit Sub
    End If
    Patience is like bread I say.... I ran out of that yesterday.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 04:13 PM.

Copyright BetaSoft Inc.