Forum Discussion

kjadhavkunal's avatar
kjadhavkunal
Contributor
8 years ago

Unable to find the object Sys.Browser("iexplore")

       I am trying to run same set of scripts multiple times on my machine with TestComplete. But sometimes it gets failed with the mentioned error. I tried to execute the same with TestExecute it was working fine.

And if I restart the machine they get executed as before.

 

 

Attaching few screenshots for your reference. Please reply with your suggestions.

1: Once this error occurred while launching TestComplete. (In 1st screenshot).

2: Scripts failed with 'Tearing paper' symbol. (In 2nd screenshot).

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Have you tried doing an install of TestComplete using the Repair option? What it sounds like is the hook into IE is not working correctly.

     

  •        I upgraded to latest version (i.e. 12.10.602.7 ).

    I found 3 new isseus as below, 

    • I deleted browser cache, history and everything. Then I tried to execute the same it is still showing same kind of error with ‘IExplorer’. If I write the same code for Chrome browser it is working as expected(Closes existing browser and opens new). Also I am not able to use run methods(Run/Navigate etc.) for Chrome browser. It is saying unable to navigate null ‘url’, though I am passing it in the method itself.
    • I am able to achieve ‘Closing of Browser(if already open) and launching a new browser’ with below code.  [Fails if no browser is open.] In the example This line is not getting executed until we run it in debug mode->  “ Browsers.Item("iexplore").Run();”  [Whenever 2nd mentioned scripts in debug mode(i.e. step by step execution using ‘F10’ key) It works well with both the situations opened browser and closed browser.]
    • Also able to achieve ‘Launching a new window(if browser is closed)’ with below code [Fails if browser is already open.]

    Attached are the screenshots for more understanding.

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      I'm confused?!?!?

       

      In your initial post, I'm in agreement with tristaanogre, it looks like the hook into IE is broken/corrupted/missing.

       

      But in your second post ..... I'm not sure whats going on?

       

      Screenshot 1 - Chrome - You close Chrome then try and navigate to page on it? That's not going to work! (Log and code both show this)

       

      Screenshot 2 - IE - Not sure what's happening here. It looks like the "Run" method didn't work on your browser object? I just tried it and it worked fine.

       

      Screenshot 3 - IE - Suggests it isn't killing the process properly. Which may mean you have two IE processes present. Which will cause problems if one is hidden. I thought this might be the case with screenshot 2, but the log for that said no IE process found ...

       

      Ahhhhh! Hang on. On screenshot 2, it says it didn't kill the process as it couldn't find the window. Are you sure you don't have a second (invisible) IE process floating around in the background during all this?

       

      Beyond that guess, I'm not sure what's happening here .... 

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Something else I noticed... you're using it a appears to be either JScript or JavaScript and you're calling Navigate("http:\\smartbear.com")

        First of all, proper URL's use the "slash" not the "backslash" so it should be as Navigate("http://smartbear.com").  However, most browsers are "smart" enough to autocorrect to the correct slash.

        If, however, you ARE going to use backslash, because you are using JScript/JavaScript, the "backslash" character in JavaScript strings is used for special codes.  So, anytime you want it to "print", you actually need to double it up.

        So, make sure you're URL's look like Navigate("http:\\\\smartbear.com\\") in order to properly send the correct characters.

        Other than that... yeah, as Colin_McCrae points out your log shows what your code is doing,  that you're closing the browser and THEN calling the "Navigate" function.  If you are closing the browser, you need to make sure that you either re-open it or, instead of Navigate use "Run".  So, your code would be,

         

        Browsers(btChrome).Run(url);