Forum Discussion

QT_David's avatar
QT_David
Occasional Contributor
12 years ago

verify if object exists without error

Hi,



Can you please clearify how to verify if an object exists without getting an 'unable to find the object' error? Below jscript code will not be able to verify a non existing panel:



TestedApps["iexplore"].Params.SimpleParams.CommandLineParameters = "http://smartbear.com/";

TestedApps["iexplore"].Run();

var test1 = Sys.Browser("iexplore", 1).Exists; // => works

var test2 = Sys.Browser("iexplore", 1).Page("http://smartbear.com/").Panel(999).Exists; //=> Error: Unable to find the object Panel(999)



BR, David

(TC version 9.0.1312.7)

3 Replies

  • Hello David,



    Have you tried using the WaitPage method? This might work better than Exists?



    Something like this ...



    var test2 = Sys.Browser("iexplore", 1).WaitPage("http://smartbear.com/", 5000)
  • QT_David's avatar
    QT_David
    Occasional Contributor
    Thanks for trying to help out Mike but my problem to verify if an arbitrary object exists or not, in this case the panel. 'Exists' seems not to work properly as seen in my example, I expect it to return 'false'. Any workaround or other info on this would be appreciated.



    BR, David