Micro Focus QTP (UFT) Forums
"Click" not working - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: "Click" not working (/Thread-Click-not-working)



"Click" not working - XeNoMoRpH - 06-29-2009

I have been developing a test using descriptive programming. Everything works fine up to a certain point. I'll get to that soon.

Pretty much, it is a web page with inputs and buttons at the top and a data table following those. The first and second buttons work just fine, but the third does not. It's weird because it will scroll over to the button and it has the active state, it just doesn't seem to click it most of the time. It has worked once or twice, so I added some wait loops with the same result.

I'm just curious if anyone else has had such an issue? Here is an example of the code. The problem is at the bottom. It actually opens a download dialog and is supposed to click through it...

Code:
With Browser(browser).Page(page).Frame(frame)
    .WebEdit("name:=input1").Set ""
    .WebEdit("name:=input2").Set "12345"
    .WebButton("name:=Find").Click
    Browser(browser).Sync
    Wait(2)
    .WebButton("name:=Export").Click
End With



RE: "Click" not working - ursvinod - 06-29-2009

Try using FireEvent
Code:
WebButton("name:=Export").FireEvent "onmouseover"
WebButton("name:=Export").FireEvent "onclick"

or

Try changing the mouse events settings

Code:
Setting.WebPackage("ReplayType") = 2
WebButton("name:=Export").Click


Setting Number Indicates how mouse operations should be run. The value can be one of the following:
1 - Runs mouse operations using browser events.
2 - Runs mouse operations using the mouse.


RE: "Click" not working - XeNoMoRpH - 06-29-2009

Well, I did end up adding the ReplayType parameter, but I also made sure my browser (IE) allowed downloads. I noticed it kept closing the window, but only some of the time. That seemed to help, except now sometimes it is having issues clicking "Save". I might just have to add some Wait functions here and there.

Thank you for your help though. I like actually seeing the mouse move around and click things.


RE: "Click" not working - Anshoo Arora - 06-30-2009

Instead of adding wait statements, you can use the .Exist method and wait for an object to appear before you move forward:

Code:
With Browser(browser).Page(page).Frame(frame)
    .WebEdit("name:=input1").Set ""
    .WebEdit("name:=input2").Set "12345"
    .WebButton("name:=Find").Click
    Browser(browser).Sync
    If .WebButton("name:=Export").Exist( 5 ) Then
        .WebButton("name:=Export").Click
    Else    
        Reporter.ReportEvent micWarning, "Export Button", "Object was not found"
    End If
End With



RE: "Click" not working - XeNoMoRpH - 07-01-2009

I ended up doing that. Most of the time it works, but sometimes it doesn't. So, I added Wait(2) before it for safe measures.