2011-07-20 15 views
1

ローカルマシン上で完全に動作するこのコードを使用してセレンスイートを実行しようとしていますが、指定ファイルを見つけることができないというサーバーにデプロイしたときにエラーが発生します。どんな助けもありがたいですか?C#経由でセレンを実行するとエラーが発生する

プログラムと引数:

プログラム= "javaの";
引数= "-jarセレニウムのようなselenium-server.jarと残りの引数vブラウザのポートと結果とテストケースのファイルを指定します";

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; 
+0

ところで、 "csharp"のようなものはありません。言語は "C#"です。 –

+0

ありがとうございましたjohn saundersが私に知らせてくれました... – abhijit

答えて

1

ローカルマシンとサーバーが同じ環境設定(パス、クラスパスなど)を持っていることを確認し

次の(問題が解決しない場合)、ファイルをすることができない何かを探してみます見つかりました(Eventlog、他のログ)

+0

私はイベントログをチェックしようとしましたが、DNSエラーがありました...私はあなたのansが私の問題の解決策であると思います。投票しました。一度サーバー上で実行されます。 – abhijit

関連する問題