0

In My test I want to click on object of Type WebArea which opens a webelement popup includes some fields that i need to test.

the problem that the popup not open after I click on WebArea object through the code.

the code I use as below.

Browser("WW").page("assessment").WebArea("areaassessment").Click

nothing hapens after the above line excuted.

Manaysah
  • 375
  • 5
  • 15
  • 29
  • Source code? Object identification config? GUI component property values? Error message in run result? Can the web area be identified successfully? What does the recorder record? Does recorded code work? – TheBlastOne Mar 27 '13 at 09:21
  • yes it works, the webarea is a web object like a webElement, it looks like an image in the GUI but upon recording it from qtp it will be recorded as oobject of type "webArea" – Manaysah Mar 27 '13 at 09:27
  • 1
    Ah so it DOES work? What is the difference between the code line you´ve shown (which does not work) and the code QTP records (which works)? – TheBlastOne Mar 27 '13 at 09:29
  • the mentioned above code are the recorded code from QTP, the issue that the recorded code does not work on replay as recorded. – Manaysah Mar 27 '13 at 09:39
  • 1
    Does the `WebArea` exists? Check this by executing `msgbox Browser("WW").page("assessment").WebArea("areaassessment").Exist(0)`. If it exist, can you put a pause on the code that doesn't work and Spy the object? – AutomatedChaos Mar 27 '13 at 12:00
  • The object is exist, and the click action is performed but no thing happened.. which is the problem that I talking about. – Manaysah Mar 27 '13 at 16:28

2 Answers2

2

Look into the HTML of the WebArea and see what action is triggering the popup. Normally it has something like onclick='showPopup();', but in other cases it is onmousedown or onmouseup.

If this is the case, you have to setup QTP accordingly. There are multiple roads to walk here, one is to see how you advanced web settings are configured. Go to Tools>Options>Web>Advanced and look in the Run Settings.
Setting the Replay Type to Event will replay your scripts by events (by default mousedown, mouseup and then mouseclick) or by mouse (You'll see your mouse pointer moving in this mode, QTP will replay by sending WM_* messages through the Windows api for movement to the correct screenlocation and triggering the click).
Allthough it replays a bit faster, if Run only click is checked, it is better to uncheck this to trigger all events / messages.

Events can also be fired by the FireEvent method:

Browser("WW").page("assessment").WebArea("areaassessment").FireEvent("onclick")

or through the object native methods:

call Browser("WW").page("assessment").WebArea("areaassessment").Object.click()
call Browser("WW").page("assessment").WebArea("areaassessment").Object.FireEvent("onclick")
AutomatedChaos
  • 7,267
  • 2
  • 27
  • 47
0

As @AutomateChaos said there is probably an event that QTP isn't simulating, one way to work around this is to do as @AutomateChaos suggests and simulate the needed event. A simpler way is to change to device replay (as I described here and here).

Community
  • 1
  • 1
Motti
  • 110,860
  • 49
  • 189
  • 262