HomeOATS

3 Simple Ways in Openscript to Spy Objects and Properties

Like Tweet Pin it Share Share Email

OpenScript has rich features to identify xpath. Below are various ways that can be leveraged in openscript spy objects and get their properties.

  1. Inspect Path : This is an option available in openscript spy objects and get property values

a. Open openscript IDE and then navigate to Script >Inspect Path as below:

Inspect Path

b. A pop up appears for selecting object.Browser opens up. Objects are highlighted with green on mouse hover. The respective xpath is visible in ‘Path’ in ‘Select Object’. Press F10 when you mouse hover on the desired object .

Inspect Path -Select Object

c. Copy and paste the xpath in ‘Path ‘ text area. This is the required xpath of the selected object.

2. Object Details :

a. Open openscript IDE and then navigate to View >Object Details as below:

b. In the Object Details panel,click on ‘Connect to Browser’.

Object Details -Connect To Browser

c. Browser opens up.Traverse to the desired object.

d. Click on ‘Find a node to inspect object by selecting object in browser’ in Object Details panel.

Object Details -Find a node

e. Pop up appears for selecting object.Object is highlighted with green on mouse hover. Press F10 and capture the xpath in ‘Path’ in ‘Select Object’.

Object Details -Select Object

3. Object Test :

a. Open openscript IDE  and go to ‘Tree View’

b. Right click on any node.(e.g Run) and Click on Add -> Other  on context menu. Expand ‘Web Test’, select ‘Object Test’ and click on ‘OK’.

Object Test

c. Enter test name in ‘Object Test’ pop up.Click on ‘Capture object in browser’. Browser opens.Move your mouse position to the required object. It appears in green.

Object Test-Capture Object in Browser

 

Object Test -Select Object

d. Press F10 and click on ‘OK’ button. The attributes along with corresponding values of the element are seen in ‘Object Test’.

Object Test -Object Attributes

 

Note: Above are the 3 ways to spy objects from  openscript  and now you can see how to get details without openscript, if it is a web based application. One can simply do from browser itself and here is the solution.

4. Developer Tools :

In Internet explorer press F12 ,one can see the  developer tool pane down in the page. Click on ‘Select Element’ and move the cursor to the  element. The attributes of the same are seen under ‘DOM Explorer’. One can customize the xpath using these parameters and can use in scripting.

 

Developer Tools-F12

Sample Xpath derivation:

DOM Structure

  • Find the title of the window from head section in DOM structure.

 

Window Xpath

  • Find the form attributes from body section.

Form and Element Xpath

  • Find  parameters of the element from body of the DOM structure.

Note : Most of the times, document index is 0.

Xpath is derived as below:

/web:window[@title=’Google’]/web:document[@index=’0′]/web:form[@id=’tsf’ or @name=’f’ ]/web:input_text[@id=’lst-ib’ or @name=’q’]

 

Comments (2)

Leave a Reply

Your email address will not be published. Required fields are marked *