cancel
Showing results for 
Search instead for 
Did you mean: 

CBTA check existence

Former Member
0 Kudos

Good day.

I would like to ask you if there is a way to check by CBTA components if some element, for example button or label on html page, already exists? I try to automate a process with a lot of different variants of process flow and this functionality would definitely help. So far I tried to use CBTA component for getProperty but I always fail because URI cannot be found if element does not exist on page. So my question is if there is a way to determine whether element from URI can be found or not. Therefore I could be able to alter automatic script flow.

Thank you in advance for your help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jan,

When you are automating using CBTA you can check existence of any objects only if that object has "exist" property.

During recording you check while adding checkpoint if that particular object has "exist" property.

If it has, you can select this and object existence can be validated.

You can use CheckProperty and GetProperty components for these purpose.

But the challenge is that all objects don't have exist property for them.

I have seen "exist" property was available for portal application we were automating but not came across of this property for R3 objects.

In document "CBTA3.0 SP05 - Runtime Library and Default Components.pdf" you can find following Default components which have mentioned about this property:

-> CBTA_GUI_CheckProperty

-> CBTA_CRM_CheckProperty

-> CBTA_WEB_CheckProperty

You can try to find more information with these components.

Regards,

Sachin Sawant

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I have the same doubt. I am not getting how to set value to a variable which I can use while using IF statement. While using 'getProperty' default component, the script fails as URI is not found.

Please help me if anyone used IF statement.

Hi Kravciv,

Did u get any resolution to your problem.

Thanks in advance.

Former Member
0 Kudos

Hi Archana,

As replied to Jan, if you are checking existence of an object even if that object doesn't have "exist", your script will fail for not finding the URI.

So first of all you need to check the availability of "exist" property for that object.


If its available you can use combination of "GetProperty" and "IF" condition to resolve your issues.

Document "CBTA3.0 SP05 - Runtime Library and Default Components.pdf" has mentioned about this on Page.26.

Please check if it can help you.

Former Member
0 Kudos

Hi Sachin,

Eventhough I use Checkproperty with 'exist' as propertyname, the next statements will execute and fail.

In the given screenshot, we need to initialize 'EXISTENCE_OK' variable using getproperty. But in getproperty URI is required which will fail if URI doesn't exist.

My issue is - How to check some element/button/text is present in the screen or not and according to that my execution flow will change. It will not fail if the element doesn't exist.

Former Member
0 Kudos

Hi Archana.

I was able to make a custom component that check if element from provided URI is available or not. My component returns true or false and now I am able to use it in IF component.

When I analyzed standard components I noticed that for example in GUI component there is this code:

GuiScripting().FindGuiControlByUri(Uri)


So basically in the end I check if this line is OK or return error.

I still hope there is a better solution but this also works fine.

Hope it helps

Bye.

Former Member
0 Kudos

Hello Jan,

I tried using your code mentioned, but receiving a Error: 13 type mismatch error. Perhaps you can point out what is wrong with my code?

'==================================================================

Sub SAPWindowExists ()

  On Error Resume Next    ' Important - Exception Handling for SAPGUI - Do not change it!

  EventComponentBegin()

  If ConditionsManager().CheckConditions() Then

    SAPWindowExists = SAPWindowExists_Impl ()

  End If

  EventComponentEnd()      ' Important - Exception Handling for SAPGUI- Do not change it!

End Sub

Sub SAPWindowExists_Impl () 'internal

Uri = "label=wnd[1]; type=GuiModalWindow; id=/app/con[1]/ses[0]/wnd[1]"

Expand_Impl Uri

                

End Sub

'==================================================================

Sub Expand_Impl ( Uri )  'internal

  Set GS_guiControl = Nothing

 

  On Error Resume Next ' Switching ON a local error handling

  Set GS_guiControl = GuiScripting().FindGuiControlByUri(Uri)   ' Raises an exception when the      'control is not found

  On Error Goto 0 ' Switching OFF the local error handling

 

If GS_guiControl Is Nothing Then ' Control not found

'ReportLog "INFO", "Yes Button", "Operation skipped - the button does not exists"

  Else

If GS_guiControl.Text = "Yes"  Then

GS_guiControl.Press ' Control has been found - let's click on it

End If

  End If

 

End Sub

'==================================================================