abhijit
abhijit

Reputation: 1968

Error when running selenium via C#

Am trying to run a selenium suite using this code which runs perfectly on my local machine but giving an error when deployed on the server saying cannot find the specified file. Any help would be appreciated?

the program and argument:

program = "java";
Arguments = " -jar selenium-server.jar and rest of the argument as in selenium v give browser port and results and testcase file";

    standardErr = String.Empty;
    standardOut = String.Empty;

    if (!silent)
    {
        Console.WriteLine("start" + program + " " + arguments);
    }

    Process proc = Process.GetCurrentProcess();
    proc.StartInfo.Arguments = arguments;

    if (!string.IsNullOrEmpty(workingDirectory))
    {
        //execute from the specific working directory if specified
        proc.StartInfo.WorkingDirectory = workingDirectory;
    }

    proc.EnableRaisingEvents = true;
    proc.StartInfo.FileName = program;
    proc.StartInfo.CreateNoWindow = true;
    proc.StartInfo.UseShellExecute = false;
    proc.StartInfo.RedirectStandardOutput = true;
    proc.StartInfo.RedirectStandardError = true;
    proc.Start();
    proc.WaitForExit();

    if (!silent)
    {
        if (proc.StandardOutput != null)
        {
            standardOut = proc.StandardOutput.ReadToEnd();
            Console.WriteLine(standardOut);
        }
    }

    if (proc.StandardError != null)
    {
        standardErr = proc.StandardError.ReadToEnd();
        Console.WriteLine(standardErr);
    }

    proc.StandardOutput.Close();
    proc.StandardError.Close();
    return standardErr;

Upvotes: 1

Views: 197

Answers (1)

Emond
Emond

Reputation: 50672

Make sure the local machine and the server have the same environment settings (Path, classpath etc.)

Next (if the problem remains) try to find out what file can't be found (Eventlog, other logs)

Upvotes: 1

Related Questions