SAP locator and Robot with python

Hi all!
I hope anyone using SAP here with robot, namely this is the SapGuiLibrary.
I have managed to store some variables encapsulated in a class, then referencing those across different files.
The point is that our SAP application has kind of long locators, which are including the connection, session and window count.
They looks like this: f'/app/con[{con}]/ses[{ses}]/wnd[{wnd}]{appendix}'
where the appendix is the element_id of the SAP GUI element.
So all good, except when opening a new window, the test is exiting with an error, saying it doesnt find the element with correct locator . The locator sure good, according to the scripting tracker.
Thanks in advance

Hi Tamás,

I don’t do much SAP GUI testing myself, but I I’ll suggest you have a look at the robosapiens Library from what I understand it’s designed to make things like this easier.

Otherwise, almost everything in Robot framework can be constructed with variables, so you could create variables like this:

VAR    ${SAP_Connection}     /app/con[{con}]/ses[{ses}]
VAR    ${my_SAP_Window}      ${SAP_Connection}/wnd[1]{appendix}

Click Element    ${my_SAP_Window}/elementid1

VAR    ${next_SAP_Window}    ${SAP_Connection}/wnd[2]{appendix}

Click Element    ${next_SAP_Window}/elementid2

Hope that helps,

Dave.

Thanks Dave,
as I said the path is ok. it was ok. found the issue, let it here in case anyone interested:
self.session = self.connection.children(0)
where the children is set according to the opened window count, so in my case, 1 was the solution, using that session the locator worked just fine.

1 Like