Forum Discussion

RichardPla's avatar
RichardPla
Occasional Contributor
9 months ago
Solved

RunOptions property

I start a new instance of Chrome to run my test cases. First I specify the RunOptions (command line for Chrome) and then start the browser. Here is the code I am using:

 

Browsers.Item("chrome").RunOptions = '--aggressive-cache-discard';
Browsers.Item("chrome").RunOptions = '--disable-cache';
Browsers.Item("chrome").RunOptions = '--disable-application-cache';
Browsers.Item("chrome").RunOptions = '--incognito';

 

Sys.Browser("chrome").BrowserWindow(0).Keys("^n");

 

NOTE: I have tried to do the same using PowerShell in conjunction with WshShell, but the Browser object that is created that way is useless.

 

I know that you you ask to execute Browsers.Item("chrome").Run(); after the options have been specified, but that works only if there are no browser instances running, which obviously is not what I want.

 

Q: can you tell me please, if there is a way launch a new instance of Chrome (or Chromium based Edge), while there are already other instances of that browser running, with the command line options that I need?

 

 

  • Are you trying to run your tests in one browser with all those options set or in separate browsers with one option in each?

     

     

  • Using the following parameter --user-data-dir

    Microsoft Windows [Version 10.0.19044.3208]
    (c) Microsoft Corporation. All rights reserved.
    
    C:\>"C:\Program Files\Google\Chrome\Application\chrome.exe" --user-data-dir=C:\Temp\User1
    
    C:\>"C:\Program Files\Google\Chrome\Application\chrome.exe" --user-data-dir=C:\Temp\User2

    Will launch "two instances" of Chrome

     

2 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Using the following parameter --user-data-dir

    Microsoft Windows [Version 10.0.19044.3208]
    (c) Microsoft Corporation. All rights reserved.
    
    C:\>"C:\Program Files\Google\Chrome\Application\chrome.exe" --user-data-dir=C:\Temp\User1
    
    C:\>"C:\Program Files\Google\Chrome\Application\chrome.exe" --user-data-dir=C:\Temp\User2

    Will launch "two instances" of Chrome

     

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    Are you trying to run your tests in one browser with all those options set or in separate browsers with one option in each?