Manaysah
Manaysah

Reputation: 383

how to click on WebArea from QTP ?

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.

Upvotes: 0

Views: 1645

Answers (2)

Motti
Motti

Reputation: 114695

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).

Upvotes: 0

AutomatedChaos
AutomatedChaos

Reputation: 7500

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")

Upvotes: 2

Related Questions