Forum Discussion

arj0n_1's avatar
12 years ago

Unwanted error line automaticly created in log.

Here's a (jscript) function I use to check whether an object on a webpage does exist.

In this case the button with the specific name (name 'LocatieZoeken_1Button') does not exist so the 'if' part will run, not the 'else'part.



function exist(){

    var iexplore;

    var page;

    var all;



    iexplore = Aliases.iexplore;

    Browser = Sys.Process("iexplore");

    page = Browser.Page("*")

    all = page.document.all;

    A1 = all.Item("LocatieZoeken_1Button")



    if (A1.Exists == false){

      Log.warning ("Button Link(0) bestaat niet");

      }

    else{

      A1.Click();

      }

}



So, this object (button) does not exist and the log.warning is correct as expected.

But: before this log.warning an automatic log line is created:

"Unable to find the object Item ("LocatieZoeken_1Button"). See Additional Information for details."



Is it possible to let this line NOT be created? I only want my custom log line be shown/created.



Strange thing is when I create a keyword test that does the same thing, onle the log.warning is created.

The "Unable to find the object Item..." line is not created.



Thanx,

Arjon.
  • sastowe's avatar
    sastowe
    Super Contributor
    Repleace



    A1 = all.Item("LocatieZoeken_1Button") with



    A1 = all.WaitItem("LocatieZoeken_1Button", xxx) whre xxx is a time out value.



    If the desired button does not exist, the wait method will return a stub object with Exists property set to false.