Highlighted
Absent Member.
Absent Member.
328 views

can QTP record JavaScript?


Greetings,

QTP web newbie and I'm having a hard time recording web href's that invoke a Javascript function. I'm clicking a .gif with JS behind it but nothing gets recorded by QTP.

e.g.
href = "javascript:doPageAction('onAdPlace_Categories','formCategories','RESRE')"

I looked around this and other forums but have found little help. Anybody know what I'm doing wrong?

Using QTP 9.5 with Web and Java Extensibility kits.

Thanks in advance.
0 Likes
8 Replies
Highlighted
Absent Member.
Absent Member.

If you have a gif that you are clicking on. You then most likely have to use the fireevent method to get the js script to work.

ie

Browser().Page().WebElement().Fireevent onclick

You might have to play with the event to get the right one. Just look in the help for QTP fro fireevent
0 Likes
Highlighted
Absent Member.
Absent Member.

That's what I thought, too.
But I cannot tell the WebElement name because it's buried in nested tables. See attachment.



0 Likes
Highlighted
Absent Member.
Absent Member.

Why are you looking at the html code. You do know that QTP deal on the application layer, meaning that QTP works on IE/Firefox so however the browser interprets the html is how QTP will respond.

So in this case, you said you need to click on a gif. So maybe you code should be

Browser().Page().Image().Fireevent "onclick"

or

Browser().Page().Webelement().Fireevent "onclick"



0 Likes
Highlighted
Absent Member.
Absent Member.

Got it!

I had to manually create an object in the Repository (don't know why) but once I did, I was able to click right through.

Thanks Henry. You were a huge help.

Now can you tell me where my Menu bar has gone? It's nowhere to be found...
0 Likes
Highlighted
Absent Member.
Absent Member.

The qtp menu?
0 Likes
Highlighted
Absent Member.
Absent Member.

Yes, the QTP menu with File, Edit, Insert, Automation etc...

I lost it sometime yesterday and have not been able to get it back.

0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

What about View n Tools bars??

go n check in view->tool bars OR

tools->make resote layout n check if you can roll back and get those missing menu bars.

~~Shivaram
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.