I've started having trouble running Watin tests via Nunit. Last week this was working but this week it's not. I'm not aware that I've changed anything but I've started getting UnauthorizedAccessException : access is denied errors being raised when I'm trying to click a link.
The simplest code that raises the error is as follows:
[Test, RequiresSTA]
public void TestTest()
{
using (var browser = new IE(SMDTestConfig.TestURL + "Game"))
{
browser.Link(Find.ByText("Log On")).Click();
}
}
The full error message from NUnit is as follows:
SMDTestFramework.GameTest.TestTest: WatiN.Core.Exceptions.ElementNotFoundException : Could not find A element tag matching criteria: Attribute 'innertext' matches '^ *Log\ On *$' at http://localhost/smdci/Game (inner exception: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))) ----> System.UnauthorizedAccessException : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
The error message would suggest that it's the Find.ByText("Log On") statement that's causing the error but if I split it up into 2 lines as follows:
AttributeConstraint cons = Find.ByText("Log On");
browser.Link(cons).Click();
The error is actually raised on the second line.
I've looked at the following questions but none of the answers seem to work for me:
WatiN UnauthorizedAccessException errors
Access denied error ( Visual S开发者_JAVA百科tudio and WatiN )
UnauthorizedAccessException when redirecting to a new page with the error displayed on top
Getting around System.UnauthorizedAccessException : Access is denied
精彩评论