Dismiss
InnovationQ will be updated on Sunday, Oct. 22, from 10am ET - noon. You may experience brief service interruptions during that time.
Browse Prior Art Database

Algorithm for Determining Strongest XPath for a Web Element in an HTML Web Page

IP.com Disclosure Number: IPCOM000243892D
Publication Date: 2015-Oct-27
Document File: 4 page(s) / 60K

Publishing Venue

The IP.com Prior Art Database

Abstract

Disclosed is an algorithm that identifies the strongest unique XPaths of web elements for use with an automation tool, which saves an automation developer a significant amount of investigation time. The novel algorithm identifies the most unique XPath through an iterative process, assigns a strength score for the level of uniqueness, and assists the developer in determining the attributes of a web element (e.g., XPath, frame, window, etc.) to aid in web based application automated testing.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 52% of the total text.

Page 01 of 4

Algorithm for Determining Strongest XPath for a Web Element in an HTML Web Page

To automate web applications, automation developers must be able to provide the automation tool with XPaths of web elements so that the testing tool can interact with the elements. Because of the nature of XPaths, one web element in a web page can have many possible XPaths. For automation, developers can consider certain XPaths for a web element stronger. A stronger XPath not only returns a unique element, but also has fewer dependencies on other elements. For example, the XPath "//div[@id='button1']" is stronger than "html/body/div/div[2]/div/div".

The novel solution is an algorithm that allows only the strongest unique XPaths to be returned, which saves the automation developer a significant amount of investigation time.

This algorithm is implemented in a tool that helps determine the attributes of a web element (e.g., XPath, frame, window, etc.) to aid in web based application automated testing. When a user attempts to extract an XPath of an element from a web page , the novel algorithm extracts a user-defined number of the strongest XPaths for the same element , and then returns the XPaths sorted by strength. The tool then displays the XPaths to the user in order of strength (possibly color-coded). In addition, a user can add special rules that can affect the strength score of an XPath. For example, if the user's company web page has dynamically generated identifiers (IDs), then the user can set a rule to prevent the consideration of anything using one of these IDs .

Figure: Process flow

1


Page 02 of 4

2


Page 03 of 4

The input to the algorithm includes the Hypertext Markup Language (HTML) of the web page and the element for which the user needs to generate an XPath. The process checks each of the attributes of that element to determine whether it is unique to that element. If it finds an attribute that is unique, then it returns an XPath. If it does not, then it then moves to the element's sibling, and checks all of the sibling's attributes. Again, if it finds a unique attribute, then it generates an XPath using the sibling functionality. Once it has no more siblings, the process then moves to the element's parent and begins the process again, always tracking the path from the element that is being checked to the element desired .

This process is followed until it identifies the path that is: //,,,/element. The check-all-attributes functionality is affected by any user defined rules, and when the XPath is r...