开发者

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 = workingDirect开发者_运维百科ory;
    }

    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;


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜