雖然試圖用硒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向我展示了測試用例失敗的原因:權限被拒絕訪問屬性'文檔'
任何想法?提前致謝。
建議將其移至軟件自動化和測試交換站點 – bryanbcook
我應該將我的帳戶鏈接到sqa.stackexchange.com並轉發嗎?或者,我可以以某種方式將此問題鏈接到那裏? – mshsayem