Skip to Content
avatar image
Former Member

how to handle status bar using QTP/UFT

If i want to store numeric value from the status bar massage which is alphanumeric text how to do that using vb scripting

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Feb 07 at 05:33 PM

    Hello Soumojyoti,

    welcome in the SAP Community.

    Your question is a little bit unclear. Please describe your environment and your problem in more detail in the future. Help us to help you.

    Unified Functional Testing (UFT), formerly known as QuickTest Professional (QFT), is an automation functional testing tool originally from Mercury Interactive which was acquired by Hewlett Packard. UFT is primarily used for functional, regression and service testing.

    You can get the status bar text in VBScript like this

    StatusBarText = session.findById("wnd[0]/sbar/pane[0]").Text
    

    Now you can find the content of the status bar in the variable StatusBarText.

    Best regards
    Stefan

    Add comment
    10|10000 characters needed characters exceeded

    • further to the text, you can retrieve several other interesting attributes from the SBAR

      ErrNumber = session.FindById("wnd[0]/sbar/").MessageNumber 

      (this is the Message Number)

      ErrType = session.FindById("wnd[0]/sbar/").MessageType

      (this is the Message class keep in mind, this will include all the whitespace at the end)

       ErrText = session.FindById("wnd[0]/sbar/").text

      (this is the short text that gets displayed in the status bar whenever a feedback message is presented)

      using these attributes you can test for specific message ID / Numbers.

  • avatar image
    Former Member
    Feb 08 at 07:15 AM

    I am giving you a sample satus text

    "The materiel 123456 is saved "

    Now I want to store "123456" value to my data table.

    Plz explaine me how to do

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 08 at 07:17 AM

    Hello Soumojyoti,

    try this to extract a numeric value from the status bar text:

    StatusBarText = session.findById("wnd[0]/sbar/pane[0]").Text
    'StatusBarText is: The material 123456 is saved
    Set RegEx = CreateObject("vbscript.regexp") 
    RegEx.Pattern = "[^\d]"
    RegEx.IgnoreCase = True 
    RegEx.Global = True 
    NumberInStatusBarText = RegEx.Replace(StatusBarText, "") 
    'Now you can find the number 123456 in the variable NumberInStatusBarText
    MsgBox NumberInStatusBarText
    

    Cheers
    Stefan

    Add comment
    10|10000 characters needed characters exceeded