Skip to main content
Version: 1.1.0

locateSID

Overview​

The locateSID locator allows you to target SAP GUI elements using their SID identifiers. These locators are extremely stable and reliable for SAP GUI automation, as they are based on the application's internal structure rather than the HTML DOM, which may change between versions.

SID locators are derived from the lsdata attribute in the HTML elements of SAP WebGUI, making them highly resilient to UI changes and updates.

note

In this context, "SID" does not refer to System ID. It refers specifically to the string value found in the lsdata attribute within the SAP WebGUI HTML DOM.

Example of a SID locator:

wnd[0]/usr/txtS_BUKRS-LOW

Here's how to interpret this SID:

  • wnd[0] - Main window (index 0)
  • /usr/ - User area of the window
  • txtS_BUKRS-LOW - Text field for company code input

Signature​

page.locateSID(sid: string): Locator

Common Examples​

Basic Actions​

Click the Execute button
await page.locateSID('wnd[0]/tbar[1]/btn[8]').click();
Fill company code field
await page.locateSID('wnd[0]/usr/txtS_BUKRS-LOW').fill('1000');
Check a checkbox
await page.locateSID('wnd[0]/usr/chkSEL_DATE').check();

Working with Multiple Windows​

Interact with element in second window
await page.locateSID('wnd[1]/usr/btnSPOP-OPTION1').click(); // Click 'Yes' in a popup

How This Works​

Example locateSID

In this example from the SE16 transaction:

  1. The blue highlighted HTML section is for the Table Name input field
  2. This HTML element has an attribute lsdata containing the SID: wnd[0]/usr/ctxtDATABROWSE-TABLENAME
  3. Using this SID ensures stable targeting regardless of HTML structure changes
Fill 'but000' Table Name field
// Using direct SID locator
await page.locateSID('wnd[0]/usr/ctxtDATABROWSE-TABLENAME').fill('but000');

// Equivalent using the more readable getByRoleSID
await page.getByRoleSID('textField', { name: 'DATABROWSE-TABLENAME' }).fill('but000');

See Also​