-1

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#.

JeffC
  • 18,375
  • 5
  • 25
  • 47
Appu Mistri
  • 651
  • 6
  • 20
  • Did you look right below the Java code on the page you linked? It has code for C#. – JeffC Jul 25 '18 at 20:00
  • @JeffC - Yeah, I took a look into that as well, It tells how to set the prerun capability for C# but it does not demonstrate how to add arguments for silent mode. – Appu Mistri Jul 26 '18 at 12:28
  • Let me know if you have any solution for adding silent mode argument. – Appu Mistri Jul 26 '18 at 15:52
  • 1
    You haven't used the C# code on that very page in your example. Did you try it as written? The instructions specifically state not to use a JSON object but you've done that in your example code. Also, if you are using SauceLabs, you can raise a ticket to get an answer directly from them. – JeffC Jul 26 '18 at 16:01

1 Answers1

1

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);
Appu Mistri
  • 651
  • 6
  • 20