EvereBuddy
EvereBuddy

Reputation: 205

DOM usage in QTP

During script execution a pop up won't go away, and it happens only through QTP(v12.02).

I am trying DOM to bypass the problem, the pop up event was on selection of a drop down value, so I used some code to find the correct index and use DOM to select the value

Browser().Page().WebList().Object.selectedIndex = itmindx

With this the pop up issue got resolved, but now to complete the process,I need to click the Save button which is disabled as the page didn't refreshed when the value was selected ( tried refreshing through QTP, tab out etc--didn't worked as it loads the previous value).So I used the fire event method

Browser().Page().WebList().Fireevent "onchange"

with this I ran in to the same issue of multiple pop ups. Used the following

Browser().Page().WebList().Object.onchange()

but then QTP won't executes the next line unless I hit enter externally on the pop up(multiple pop up is resovled but now QTP is stuck. I don't want to use RS.... Any solutions?

Upvotes: 1

Views: 353

Answers (1)

vins
vins

Reputation: 15370

To enable the button

Browser().Page().WebButton().Object.disabled = false

Or

To hit enter for the popup

CreateObject("WScript.Shell").SendKeys("{ENTER}")

[ http://ss64.com/vb/sendkeys.html ]

Go for hitting the Enter button using SendKeys. It is not a good idea accessing DOM and change the state ourselves. There is a chance that you might miss potential defects!

Upvotes: 1

Related Questions