2011-07-19 117 views
0

虽然试图用硒rc自动化测试,我遇到了这个问题。我只是按照教程中的步骤。下面是代码(同教程):如何解决“权限被拒绝访问属性文档'”?

[TestFixture] 
public class SeleniumTest 
{ 
    private ISelenium selenium; 
    private StringBuilder verificationErrors; 

    [SetUp] 
    public void SetupTest() 
    { 
     selenium = new DefaultSelenium("localhost", 4444, @"*custom D:\Program Files (x86)\Firefox 4\firefox.exe", "http://www.google.com/"); 
     selenium.Start(); 
     verificationErrors = new StringBuilder(); 
    } 

    [TearDown] 
    public void TeardownTest() 
    { 
     try 
     { 
      selenium.Stop(); 
     } 
     catch (Exception) 
     { 
      // Ignore errors if unable to close the browser 
     } 
     Assert.AreEqual("", verificationErrors.ToString()); 
    } 

    [Test] 
    public void TheGoogleTest() 
    { 
     selenium.Open("/"); 
     selenium.Type("lst-ib", "selenium"); 
     try 
     { 
      Assert.IsTrue(selenium.IsTextPresent("Selenium - Web Browser Automation")); 
     } 
     catch (AssertionException e) 
     { 
      verificationErrors.Append(e.Message); 
     } 
    } 
} 

当我运行测试,我的Firefox-5浏览器弹出,网址如下:
http://www.google.com/硒服务器/核心/ RemoteRunner.html?的sessionId = 507c2d6ec7214587984f0f86148e9ff5 &多窗口= TRUE &的baseUrl =的http%3A%2F%2Fwww.google.com%2F & debugMode =假

我以为网址应为HTTP :// localhost:4444并更改了网址(剩下的部分)。现在打开一个硒页面(右边的命令)。然后它打开谷歌页面,但没有任何后。而nunit向我展示了测试用例失败的原因:权限被拒绝访问属性'文档'

任何想法?提前致谢。

+0

建议将其移至软件自动化和测试交换站点 – bryanbcook

+0

我应该将我的帐户链接到sqa.stackexchange.com并转发吗?或者,我可以以某种方式将此问题链接到那里? – mshsayem

回答

1

有人回答它sqa.stackexchange.com

我试着用"*chrome D:\Program Files (x86)\Firefox 4\firefox.exe",似乎是工作。从链接

报价提到:

这里*chrome指的是Firefox浏览器,并已高架Java脚本的安全限制安全 特权。

相关问题