DX Unified Infrastructure Management

 View Only
  • 1.  e2e basic string capture

    Posted Jul 16, 2018 04:12 PM

    Hello, I'm trying to capture a specific string on a page after some interactions (kind of like url_response probe). However my syntax for this tool is not very good. From the documentation I can see I need the following variables to kick of this alarm;

     

    nimWaitForWindowText(winid$,textstr$,load_timeout)

    and

    nimAlarmSimple(severity,msg$)

     

    However, I am not sure how to frame it to send out an alarm if for example the string "Success" is not found after a page load,.

     

    IS it an if/else statement I need to frame beforehand? Or how do I get the string search to alarm if its not found?

     

    any suggestions or advice is appreciated.

     

    A



  • 2.  Re: e2e basic string capture

    Posted Jul 18, 2018 11:35 AM

    Hi Alberto,

     

    I have yet to test the function myself successfully, but you can write something like

     

    ' Required for NimBUS system calls (like sending QoS)
    include "Nimbus-functions.src"

     

    #ActionTimeout = 60
    #ignoreerrors=1

     

    StartBrowser("FF", "https://lipsum.com/", 3)


    pause 2 sec

    text$="is simply dummy text"
    rc = nimWaitForWindowText("FIREFOX.EXE|MozillaWindowClass|Lorem Ipsum - All the facts - Lipsum generator",text$,20)

    'rc = nimWaitForWindow("FIREFOX.EXE|MozillaWindowClass|Lorem Ipsum - All the facts - Lipsum generator",20)

     

    'convert the number to a string to append to message

    err$=str$(rc)

     

    if rc > 0 then
         msg$ = "Success with nimWaitForWindowText: "+err$
         'MsgBox(msg$)
         nimAlarm(2,msg$,"e2e-Support.ca.com","E2E-appmon")
    else
         msg$ = "Failure with nimWaitForWindowText: "+err$
         nimAlarm(2,msg$,"e2e-Support.ca.com","E2E-appmon")
         'MsgBox(msg$)
    endif

    Pause 2 secs
    CloseBrowser()

     

     

    Oddly though I have not been having luck in getting it to successfully match. I can successfully match the 

       window using the nimWaitForWindow call though. Perhaps you might have better luck.

     

    Greg



  • 3.  Re: e2e basic string capture

    Posted Jul 19, 2018 01:17 PM

    Hi Alberto,

    Greg has provided you with an example of the correct syntax using the nimWaitForWindowText function as it will return 1 if the string is found and a 0 if it isn't. I think the problem you may encounter is that there are very few webpages that actually have text strings any longer. I would suggest you explore using one of the Capture functions.

    Here is an example of using the CaptureTableHTML function

     

    Dim tabcell_0$(100)

    Include "NimBUS-functions.src"

    .

    .

    .

    .

    .

     

    UsePage("View Location")
    ret = CaptureTableHTML("TABLE[CONTENT='5F, Palace Building, 1-1-1 Marunouchi', INDEX='2']", "R1C1:R1C1", tabcell_0$())

    'msgbox(tabcell_0$(0))
    if Instr(tabcell_0$(0),"Chiyoda-ku") > 0 then
     'msgbox("Good to go Tokyo")
    else
     'msgbox(" Oh Oh")
     nimAlarmSimple(3,"The application "+application$+" location detail page for Tokyo failed to render")
     'MsgBox("'Wait for' at line " + #ErrorLine$ + " has failed !")
     nimQoSStop()
     nimQoSSendNull(target$)
     cleanup()
     nimEnd()
     End
    endif

     

    Also, if you continue to have issues and need some help, please open a support case as we do have support personnel that can assist.