Posts

Showing posts with the label QTP

Locating elements using DOM, Css and Xpath

 Refer the below example Whole web page xpath=/html css=html document.documentElement Whole web page body xpath=/html/body css=body document.body All text nodes of web page //text() Element <E> by absolute reference xpath=/html/body/.../.../.../E css=body>…>…>…>E document.body.childNodes[i]...childNodes[j] Element <E> by relative reference //E css=E document.gEBTN('E')[0] Second <E> element anywhere on page xpath=(//E)[2] document.gEBTN('E')[1] Image element //img css=img document.images[0] Element <E> with attribute A //E[@A] css=E[A] dom=for each (e in document.gEBTN('E')) if (e.A) e Œ Element <E> with attribute A containing text 't' exactly //E[@A='t'] css=E[A='t']  Element <E> with attribute A containing text 't' //E[contains(@A,'t')]  Element <E> whose attribute A begins with 't' ...

Tips to Optimize QTP Scripts to Yield Better Performance

Tips to Optimize QTP Scripts to Yield Better Performance We use Automated-testing tools to optimize our manual testing processes. But in order to reap full benefits of any automated testing tool, we must know the complete ins and outs of the tool otherwise it would be a huge waste of money spent on automation. We have to learn the automation tool very thoroughly. We also need to learn the language of the automation tool to do coding more effectively and efficiently. I believe that a software testing tool is as good as the person who is actually using it. I have been getting so many emails from my esteemed readers asking about HP QuickTest Professional tutorials, QTP tips and tricks etc. Some readers even complain that their QTP scripts are too slow to execute. This time I decided to write a post on how to use QTP more effectively which means how to make our QTP scripts perform better. In order words, this post will throw light on some points, which will optimize your QTP scripts...

QTP : object is Visible OR Not on Web Page

Hi All, Some times we have to  check that a object(WebElement) is  exist on page or not. For this we use object exist = False  property but when we run the script it gets failed While object is not showing in the Page. We think that there is  something  wrong. The reason behind why QTP  is giving this because object is present in the page but not visible means it not displaying while it exist in HTML code. So for this we have to be understand the object property( object.currentstyle.display) there will be case some time object inherit the property from its parent or another parent element property to display in page . First we have to identify that object when it not showing/displaying in page.We have to check its display property Display property value we can get through like this  rem disvalue disvalue =Browser(“Google”).Page(“Google”).Image(“Happy Holidays from Google!”).Object.currentStyle.display if disvalue =”block” then print...

Close All Browsers Except OLD One QTP VB

Hi All, Some times we required that Only OLD open Browser Window( Only for IE) will remain Open and rest of all should be closed during QTP scripting . Here is the Function which will close all the open Browsers except OLD Open browser (Work only for Internet Explorer using QTP) Public function fn_CloseAllBrowsersExceptOLD       rem create Browser description object          Set brwsr=Description.Create          brwsr(“micclass”).value=”Browser”          Set obj=Desktop.ChildObjects(brwsr)           browserCount= obj.count          Set obj=nothing          If  browserCount >1  Then          do             Browser(“CreationTime:=1″).Close             Set obj=Desktop.ChildObjects(brwsr)     ...