Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Click" not working
#1
Solved: 11 Years, 4 Months ago
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
Reply
#2
Solved: 11 Years, 4 Months ago
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.
Reply
#3
Solved: 11 Years, 4 Months ago
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.
Reply
#4
Solved: 11 Years, 4 Months ago
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
Reply
#5
Solved: 11 Years, 4 Months ago
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Exclamation WebElement("WebElement").Click is not working sia sharma 7 23,954 09-28-2016, 08:58 PM
Last Post: supputuri
  Right Click On a Image and Click on a Link in WebElement RameshKrishnan 4 5,404 07-10-2013, 04:13 PM
Last Post: RameshKrishnan
  How do I left click on the right click menu in WinTreeView? RandomGrin 0 3,918 12-22-2012, 04:22 AM
Last Post: RandomGrin
  How do I left click on the Right click menu? RandomGrin 2 4,214 12-18-2012, 09:47 PM
Last Post: RandomGrin
  link click not working sia sharma 3 3,852 08-03-2012, 06:20 PM
Last Post: SteveS

Forum Jump:


Users browsing this thread: 1 Guest(s)