【问题标题】:Selenium Test: Method Not Allowed error硒测试:方法不允许错误
【发布时间】:2016-08-19 19:37:18
【问题描述】:

我正在尝试按照here 上的说明学习如何在 C# 中创建 selenium 测试

设置功能:

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

每当我运行测试时,selenium.Start();抛出以下异常:

System.Net.WebException : 远程服务器返回错误:(405) Method Not Allowed。

结果堆栈跟踪:

 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()

selenium 服务器(版本 3.0.0.beta)在远程服务器上运行,我打开了 4444 端口。

【问题讨论】:

  • 您是否可以通过键入您提供给 Selenium 的相同 url 在浏览器中看到该页面?你是用http还是https?

标签: java c# selenium


【解决方案1】:

您应该使用 Selenium Web Driver 而不是 Selenium RC。 Selenium RC 很旧。我使用 C# 使用 Selenium Web Driver 的方式如下。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-20
    • 2014-01-08
    • 2012-06-29
    • 2016-12-02
    • 2012-10-25
    • 2012-03-21
    • 2015-11-25
    相关资源
    最近更新 更多