Forum Discussion

abhishek1997's avatar
abhishek1997
Contributor
2 years ago

Run Tests in Edge Browser Normal Mode & InPrivate Mode simultaneously

Hello Team,

 

We are facing some difficulties while testing the web applications parallelly in one single browser.

Here is the scenario, where we have two web applications in which one application opens in Edge Browser normal mode and another one opens in Edge Browser InCognito mode. Here is the sample code in Python.

 

# Launch GMAIL in Edge InCognito Mode
def LaunchInPvtMode():  
   gmailURL = "www.gmail.com"
   Browsers.Item[btEdge].RunOptions = "-inprivate"
   Browsers.Item[btEdge].Run(gmailURL)
# Launch GOOGLE in Edge Normal Mode
def LaunchInNormalMode():  
   googleURL = "www.google.com"
   Browsers.Item[btEdge].Run(googleURL)

 

Now the conflict is:

  1. If I run LaunchInNormalMode(), the browser is opening in the normal mode and again I am running LaunchInPvtMode() it is opening in the same browser instance and not opening in the private mode.
  2. If I run LaunchInPvtMode(), the browser is opening in the private mode and again I am running LaunchInNormalMode() it is opening in the same browser instance and not opening in the normal mode.

So I want these two python functions to be opened in two Edge browser instances simultaneously (which is Normal Mode & Private Mode). So I will switch between both Normal Mode & Private Mode simultaneously and continue my test cases.

 

Note: The tests are running in Edge Browser only not on Chrome

 

Is there any solution for this scenario ?

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    You have to use --user-data-dir as well, in your RunOptions,

     

    def LaunchTwo():  
        Browsers.Item[btEdge].RunOptions = "--user-data-dir=C:\Temp\Profile_edge1"
        Browsers.Item[btEdge].Run("http://www.google.com/")
    
        Browsers.Item[btEdge].RunOptions = "--inprivate --user-data-dir=C:\Temp\Profile_edge2"
        Browsers.Item[btEdge].Run("https://www.w3schools.com/")
    

     

     

     

    • abhishek1997's avatar
      abhishek1997
      Contributor

      If we use the above function (LaunchTwo()), the browser opening in a new instance but the SmartBear extension is not available in the new profile to execute the next steps.

       

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Have the non inprivate use your default profile. 

    Browsers.Item[btEdge].Run("http://www.google.com/")

    The have the the inprivate use

    Browsers.Item[btEdge].RunOptions = "--inprivate --user-data-dir=C:\Temp\ProfileX"
    Browsers.Item[btEdge].Run("https://www.w3schools.com/")

    and install the extension.

    • abhishek1997's avatar
      abhishek1997
      Contributor

      No it's not working, and we cannot install TestComplete extension while running or while executing the function and it is not a good way of working. If we run the main function only one browser is opening and executing the two functions.

       

      def LaunchOne():  
        Browsers.Item[btEdge].Run("http://www.google.com/")
      
      def LaunchTwo():
        Browsers.Item[btEdge].RunOptions = "--inprivate --user-data-dir=C:\Temp\ProfileX"
        Browsers.Item[btEdge].Run("https://www.w3schools.com/")
        
      def main():
        LaunchOne()
        LaunchTwo()

       

      If we use below function, both functions are opening in Private Mode and in Logs we are getting The Browser is already running.

       

      def main():
        LaunchTwo()
        LaunchOne()

       

       

      We cannot use Chrome browser and it is restricted by our organization, that is why we are running our web applications in One single browser simultaneously.

       

      So my requirement is mentioned below.

      Assume we have two Web Apps i.e., Google and Gmail and these should run simultaneously.

      Edge Browser - Profile-1 - Normal Mode :  run tests for Google.com

      Edge Browser - Profile-2 - InCognito Mode :  run tests for Gmail.com

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      Hi,

       

      users will never launch a browser normally and the other in-private mode. 

      As a quick idea: what if you start browser in normal mode first and then open new in-private window (via Ctrl-Shift-N shortcut)? (Like a lot of users do, as per my guess.) Will it work for you?