Thanks to everyone who joined us last week for the first session in our QA Wizard Pro Lunch and Learn series. The recording is now available if you missed the training session or want to watch it again. Q&A from the session is also available.
1. Can you elaborate on the syntax of “//img/@src”?
“//” means “find all.” “img” is the name of the HTML element to find. “/” means “with” and “@” indicates attribute. “src” is the name of the attribute.
For example, “//a/img” means QA Wizard Pro would find all of the img elements that are immediate children of anchor elements (links).
The full XPath specification is available at http://www.w3.org/TR/xpath/ but we recommend Microsoft’s examples at http://msdn.microsoft.com/en-us/library/ms256086.aspx.
2. When the developer changes my window name or a field name, or moves an image position on the web page, what should I change in my script so I don’t have to re-record it?
You don’t have to change your script at all. All you have to do is change the expected value for the changed property in the referenced repository control. You make one change and all of your scripts will be fixed because they reference the repository control.
3. How can I find a control’s properties without needing to record a script?
Use the preview window. Drag and drop the control from the picture in the preview window. If the control is not already in the repository, it will be added to the repository. You can then right-click on the repository control and select Properties.
4. Is it possible to move controls from Local to Global?
Yes. Right-click on the repository application and choose Promote.
5. If the control properties have changed, for example a box moved or was renamed, is there an easy way to change those other than a one-by-one approach?
Yes. Right-click on the repository application version and click Find and Replace.
6. If we have multiple matches for a control, how do we refine our search?
QA Wizard Pro will automatically pick the ‘best’ control if there are multiple controls that match a specific repository control’s search criteria. But it will return a warning letting you know multiple matches were found.
Most of the time, the warning message will include a hyperlink that says, “Recommend repository changes.” If you click the hyperlink, QA Wizard Pro will automatically fix your repository by adding additional criteria (checking more of those property boxes) to be used to uniquely identify the control.
There are times the hyperlink is not available. In this case, if you don’t want those pesky warning messages, then you need to manually edit the repository control. By checking additional properties, you’re effectively performing a logical AND. For example, if I had two buttons in my window with a Name of “okButton”, I could also check the “Control Name Path” property instead to help disambiguate them.
If your application is a web application, we recommend using the id attribute on your HTML elements to uniquely identify them.
If you’re an advanced user and your application is a web application, you might want to write a custom XPath and using the XPath search method. For example, you could use “//input[@type=’text’ and @name=’username’]”.