Search code examples
c#selenium-webdriversaucelabs

how to set silent mode for sauce lab pre run - C#


I want to use sauce labs pre-run capability to run some executable before my tests runs and i would like to set silent mode argument for the pre-run capability. Below is the code snipped what I have been trying so far.

            DesiredCapabilities capabilities = new DesiredCapabilities();
            Dictionary<string, object> obj = new Dictionary<string, object>
            {
                { "executable", "http://url.to/my/executable" },
                { "background", true },
                { "timeout", 120 }
            };
            capabilities.SetCapability("prerun", obj);

Please suggest how can I set the silent mode here. I know a solution in java, But not sure how to do it in C#.


Solution

  • I was able to add silent mode args by defining a LinkedList and adding the silent mode parameters to it. Finally, add the LinkedList object to pre-run arguments with args key. Below is the code snippet.

    DesiredCapabilities capabilities = new DesiredCapabilities();
    Dictionary<string, object> prerunParams = new Dictionary<string, object>();
    prerunParams.Add("executable", "http://url.to/my/executable");
    LinkedList<string> args = new LinkedList<string>();
    args.AddLast("/S");
    args.AddLast("-a");
    args.AddLast("-q");
    prerunParams.Add("args", args);
    prerunParams.Add("background", false);
    prerunParams.Add("timeout", 60);
    capabilities.SetCapability("prerun", prerunParams);