How to verify if element exist in SAP GUI RoboSAPiens Library

Hi,

I am trying to automate work in SAP GUI with RoboSAPiens library, but I’m having a blocker. I want to reset the interface before I run my GUI recording scripting. to have all the sub button being collapsed in ME23N

For the reset, I need to check if collapsed header button exist, as if does not exist need to press button.

Is there a way to check for that element exist or not? Before this for SAP Fiori I am using keyword “Page Should Contain Element” from SeleniumLibrary.

@Marduk I found that RoboSAPiens library is very helpfull and makes our automation script simpler.

is there a keyword as " Element Should Be Present" as in SAPGUILibrary.
Would you be able to guide me on this?

@shirae-sys I’m glad to hear that RoboSAPiens is being helpful :slight_smile:

There are no keywords for assertions because that is the job of a testing framework. RoboSAPiens is an automation library. However, since it builds a cache of the elements in the window, it can answer questions like “is this element present?” or “is this element changeable?”. Currently those questions can only be answered indirectly. That means, if you try to act on an element and the element is not present a NotFound exception will be thrown. I just published version 2.8.0, which does that. In addition, the documentation now provides a helper keyword that you can use to define your own assertions. I provided an example for asserting that a text field is present. For a button you can pass the keyword Highlight Button. I hope that helps :slight_smile:

1 Like

@shirae-sys Note that in your case you could do something like

Run Keyword and Ignore Error    Push Button   Collapse header

If the header is collapsed the button will have a different tooltip and the error will be ignored.

2 Likes

Thank you so much sir! this keyword works for my automation test case.

1 Like