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 (10)

  • Wow i just knew about the First one. Thanks for Sharing.

    Reply
  • I am not getting full path using inspect getting only element level details. How to get full path ,is there any set up

    Reply
    • It might be hidden, inspect path always gives full path only. Just try to keep your cursor inside the inspect path text area and do a select all and paste in your notepad, you will get the full path.

      Or you can expand the window size and you can see the entire xpath

      Reply
  • Will MouseOver work in Openscript recording?

    Reply
  • Hi! If openscript can’t find uniq html tag and just give me XY coords to mouse click – can we solve this problem in some way ? (project : siebel CRM HI )
    Maby in siebel HI has some option, which turn on uniq id’s on elements?
    maby someone knows answer….

    Reply
    • Ideally its not good to go with the XY coordinates, as it will have a lot of issues when played back. I have not worked much with Siebel CRM’s custom components if any.
      May be you can log an SR with oracle and get a resolution for the same.

      Reply
  • Srinivas,

    Is there a way to use contains text() in Opens Script like we do in Selenium scripts?

    Reply
    • I think there is something like “.*” which you can give , so something like “.*Order Number.*” for the text attribute of the xpath

      Reply

Leave a Reply

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