Let me be clear: - I have Java.exe in my path environment variable - So if I want to run a "selenium-server" I will do :
1. Start cmd.exe
Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.
C:\Documents and Settings\cnguyen>
2. Then:
C:\Documents and Settings\cnguyen>cd C:\Selenium RC 0.9.2\selenium-server-0.9.2
3. Next, I'm in the directory that I want so I run:
C:\Documents and Settings\cnguyen>cd C:\Selenium RC 0.9.2\selenium-server-0.9.2
C:\Selenium RC 0.9.2\selenium-server-0.9.2>java -jar selenium-server.jar
09:26:18.586 INFO - Java: Sun Microsystems Inc. 16.3-b01
09:26:18.586 INFO - OS: Windows 2003 5.2 x86
09:26:18.586 INFO - v0.9.2 [2006], with Core v0.8.3 [1879]
09:26:18.633 INFO - Version Jetty/5.1.x
09:26:18.633 INFO - Started HttpContext[/selenium-server/driver,/selenium-server
/driver]
09:26:18.633 INFO - Started HttpContext[/selenium-server,/selenium-server]
09:26:18.633 INFO - Started HttpContext[/,/]
09:26:18.648 INFO - Started SocketListener on 0.0.0.0:4444
09:26:18.648 INFO - Started org.mortbay.jetty.Server@16a55fa
And here is what I got so far, it compiled but not showing anything :(
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace SeleniumProcessExample
{
public class SeleniumProcess
{
private Process pro;
public SeleniumProcess()
{
pro = new Process();
Directory.SetCurrentDirectory( @"C:\Selenium RC 0.9.2\selenium-server-0.9.2" );
pro.StartInfo.FileName = "java";
pro.StartInfo.Arguments = " -jar selenium-server.jar";
pro.StartInfo.RedirectStandardOutput = true;
pro.StartInfo.RedirectStandardError = true;
pro.StartInfo.UseShellExecute = false;
pro.Start();
string strOutput = pro.StandardOutput.ReadToEnd();
string strError = pro.StandardError.ReadToEnd();
Console.WriteLine( strOutput );
Console.WriteLine( strError );
Console.Out.Flush();
pro.CloseMainWindow();
}
}
}