SAP GUI Functions (SAPGUI) > Alphabetical List of Functions > sapgui_htmlviewer_dom_get_property

sapgui_htmlviewer_dom_get_property

Example: sapgui_htmlviewer_dom_get_property General Object Functions

Evaluates a DOM query on the web page contained inside the SAP application.

int sapgui_htmlviewer_dom_get_property( const char *htmlViewerID, const char *DOMPath, const char* paramName, LAST );
htmlViewerID The SAP GUI object ID string.
DOMPath The DOM expression.
paramName The parameter to which to save the value of the DOM expression.

sapgui_htmlviewer_dom_get_property evaluates a DOM expression on the page in the embedded browser and saves the results to a parameter.

SAP has a browser control, or HTML container, that allows the user to work on a web page that appears to be embedded in the SAP application. SAP is aware of much of the activity in the embedded browser, but you may need to get information that cannot be retrieved by the SAP functions. You may, for example, need a session ID or some other dynamic value from the HTML response for use in correlating a sapgui_htmlviewer_send_event call. sapgui_htmlviewer_dom_get_property enables you to get information from the DOM of the page in the browser control using standard DOM syntax.

To get the htmlViewerID, right click on the HTML container in a SAP GUI snapshot and select Copy Control ID. Delete the first characters (corresponding to the current session ID) and the current window id ("ses[0]/wnd[0]/").

To create your expression for the DOMPath, use any DHTML viewer to explore the DOM of the page displayed in the HTML container. If the path to the property you want contains a period that is not part of the DOM expression, escape the period with a backslash (\.).

When working with the WEB protocol together with the SAPGUI protocol, it is important to avoid duplicate HTML requests. The SAP application sends HTML events that are recorded, and the WEB protocol recorder may catch the same calls coming from the embedded browser. It is recommended that during recording, when you change focus from the SAP application to the embedded browser, you enter a comment using the recording toolbar. After the script is generated, delete WEB protocol requests before that comment. Make another comment when you resume working with the containing SAP application, and delete WEB requests after the comment, leaving the SAP HTML requests.

Return Values

This function returns LR_PASS (0) on success or LR_FAIL (1) on failure.

Parameterization

You can parameterize all string (char type) arguments.