Forum Discussion

AMR013's avatar
AMR013
Contributor
2 years ago

Opening web browser then accessing URL not consistently working

Hello,

 

I'm having issues with opening a browser, then accessing a URL consistently. When I first run my lines, it works fine (Browser is opened, and URL is inputted/accessed). When I try to re-run the same line, not everything works (Browser opens, but URL is not inputted and TestComplete continues to "run"). At this point, I'm unable to stop the execution via the Stop button (clicking it doesn't do anything), so I have to close TestComplete via the Task Manager. Once I re-open TestComplete, I'm able to run the line again. From various tests, it appears I have one attempt at running the line before I have to close TestComplete, and re-open in order to run again. Would anyone have any suggestions on how to ensure TestComplete consistently opens the browser and accesses the specified URL? Note that I'm using Google Chrome, but this issue is occurring for any other browser. Below is an example of my code:

 

// Define URL
var testURL = 'https://www.myURL.com';

// Launch browser and access testURL
Browsers.Item(btChrome).Run(testURL);
  • Hi ! 

     

    you can try this : 
    Browsers.Item(btChrome).RunOptions = "url";
    Browsers.Item(btChrome).Run();

     

    instead of opening the browser then navigating to the webpage, TC opens the browser directly with the webpage.

  • Both codes work fine using JavaScript, using the latest version of TC and Chrome

        Browsers.Item(btChrome).RunOptions = "https://smartbear.com/";
        Browsers.Item(btChrome).Run();
        
        // Define URL
        var testURL = "https://smartbear.com/";
    
        // Launch browser and access testURL
        Browsers.Item(btChrome).Run(testURL);

     

  • eykxas's avatar
    eykxas
    Regular Contributor

    Hi ! 

     

    you can try this : 
    Browsers.Item(btChrome).RunOptions = "url";
    Browsers.Item(btChrome).Run();

     

    instead of opening the browser then navigating to the webpage, TC opens the browser directly with the webpage.

    • AMR013's avatar
      AMR013
      Contributor

      eykxas ,

       

      Thank you for the suggestion! It appears to be working consistently. I really appreciate the help.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Both codes work fine using JavaScript, using the latest version of TC and Chrome

        Browsers.Item(btChrome).RunOptions = "https://smartbear.com/";
        Browsers.Item(btChrome).Run();
        
        // Define URL
        var testURL = "https://smartbear.com/";
    
        // Launch browser and access testURL
        Browsers.Item(btChrome).Run(testURL);

     

    • AMR013's avatar
      AMR013
      Contributor

      rraghvani ,

       

      Thank you for confirming eykxas 's solution. After numerous tests, it is working consistently. Really appreciate the input!

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    What version of TestComplete are you using? And what browser version are you testing against?