【问题标题】:How to fix "Permission denied to access property 'document'"?如何修复“访问属性'文档'的权限被拒绝”?
【发布时间】:2011-07-19 04:22:17
【问题描述】:

在尝试使用 selenium 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 浏览器会弹出,并且 URL 如下所示:
http://www.google.com/selenium-server/core/RemoteRunner.html?sessionId =507c2d6ec7214587984f0f86148e9ff5&multiWindow=true&baseUrl=http%3A%2F%2Fwww.google.com%2F&debugMode=false

我认为 url 应该是 http://localhost:4444 并更改了 url(留下其余部分)。现在打开了一个 selenium 页面(右侧有命令)。然后它打开谷歌页面,但之后什么也没有。 nunit 显示测试用例失败,说明原因:Permission denied to access property 'document'

有什么想法吗?提前致谢。

【问题讨论】:

  • 建议移到软件自动化测试交流站
  • 我应该将我的帐户链接到 sqa.stackexchange.com 并重新发布吗?或者,我可以以某种方式将这个问题链接到那里吗?

标签: c# selenium selenium-rc selenium-webdriver


【解决方案1】:

有人回复了sqa.stackexchange.com:

我尝试了"*chrome D:\Program Files (x86)\Firefox 4\firefox.exe",似乎它正在工作。

引用链接:

这里的*chrome 指的是firefox 浏览器,具有更高的安全性 对 java 脚本安全限制的特权。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-02-08
    • 2014-04-24
    • 1970-01-01
    • 2012-11-16
    • 1970-01-01
    相关资源
    最近更新 更多