OpenScript has rich features to identify xpath. Below are various ways that can be leveraged in openscript spy objects and get their properties.
- 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:
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 .
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’.
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.
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’.
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’.
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.
d. Press F10 and click on ‘OK’ button. The attributes along with corresponding values of the element are seen in ‘Object Test’.
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.
Sample Xpath derivation:
DOM Structure
- Find the title of the window from head section in DOM structure.
- Find the form attributes from body section.
- 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’]
Wow i just knew about the First one. Thanks for Sharing.
Hi Akash,
Good to know that you are now aware of more ways 🙂 continue reading
I am not getting full path using inspect getting only element level details. How to get full path ,is there any set up
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
Will MouseOver work in Openscript recording?
I don’t think openscript recording can capture the mouse over operations.
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….
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.
Srinivas,
Is there a way to use contains text() in Opens Script like we do in Selenium scripts?
I think there is something like “.*” which you can give , so something like “.*Order Number.*” for the text attribute of the xpath