1
votes

I'm trying to learn how to create selenium test in C#, following the instructions on here

Setup function:

    [SetUp]
    public void SetupTest() {
        selenium = selenium = new DefaultSelenium("TestServer", 4444, "*iexplore", BaseUrl);
        selenium.Start();
        verificationErrors = new StringBuilder();
    }

Whenever I run my test, selenium.Start(); throws the exception below:

System.Net.WebException : The remote server returned an error: (405) Method Not Allowed.

Result StackTrace:

 at System.Net.HttpWebRequest.GetResponse()
     at Selenium.HttpCommandProcessor.DoCommand(String command, String[] args)
     at Selenium.HttpCommandProcessor.Start()
     at Selenium.DefaultSelenium.Start()
     at SeleniumTests.IMPORT.SetupTest()

The selenium server (Version 3.0.0.beta) is running on a remote server, I have opened port 4444.

1
Are you able to see the page in the browser by typing the same url you supply to Selenium? Also are you using http or https? - neo

1 Answers

2
votes

You should use Selenium Web Driver instead of Selenium RC. Selenium RC is old. The way I work with Selenium Web Driver using C# is the following.

IWebDriver driver = new InternetExplorerDriver();
driver.Navigate().GoToUrl("https://www.example.com");