Identify Object using DOM Elements -Open Script (OATS)

 

Sometimes we face issues while recording/play back using Open script (Oracle Application Testing Suite). What are the alternate solution

  1. Try regularising objects?
  2. Try with other object elements?
  3. Try to raise defect against dev team ? ;) most of the cases devolopment teams won’t fixes issues related to automation script

So what is the solution you would try from Tool? one of the solution is using DOM Elements .

What is DOM?

The DOM is the way Javascript sees its containing pages’ data. It is an object that includes how the HTML/XHTML/XML is formatted, as well as the browser state. A DOM element is something like a DIV, HTML, BODY element on a page.

How to Use in Open Script?

Open your application in any browser, click your key board F12 key

Highlight the object using spy, browser will point exact tree view of that object.

Identify Button in Open script using DOM.

PropertyTestList ptl = new PropertyTestList();

            ptl.add("value", "Submit");

            oracle.oats.scripting.modules.webdom.api.elements.DOMElement button = web.document("/web:window[@index='0' or @title='Page Title here']/web:document[@index='0']").getElementById("uploadButton");

            button.click();

Identify Link in Open Script using DOM.

PropertyTestList ptl = new PropertyTestList();

            ptl.add("text", linkname);

            List list = web.document(docpath).getElementsByTagName("a",ptl);

            // assuming single object

            if(list.size()==1)

            {

            DOMLink link = (DOMLink) list.get(0);

            System.out.println("Link name:" + link.getAttribute("text"));

            link.click(); // this would click the object in the web page.

            }

            else

            {

            System.out.println("Link not found with name:" + linkname);

            }

1 thought on “Identify Object using DOM Elements -Open Script (OATS)”

Leave a Reply

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

seventeen − nine =