访问被拒绝错误(Visual Studio和WatiN) [英] Access denied error ( Visual Studio and WatiN )

查看:123
本文介绍了访问被拒绝错误(Visual Studio和WatiN)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio 2005中使用了WatiN测试工具.当我尝试从列表框中选择一个值时,出现访问被拒绝"错误.

I'm using the WatiN testing tool with Visual Studio 2005. When I try to select a value from my list box I am getting an "access denied" error.

推荐答案

我最近在使用WatiN 2.0 beta时在选择列表中看到了很多.代替使用aSelectList.Select(strText)选项,这样做似乎更好:

I have seen this a lot with select lists recently when using the WatiN 2.0 beta. Instead of using the aSelectList.Select(strText) option, it seems to work better when you do this:

ie.SelectList(Find.ById("MySelect")).Option(Find.ByText("Option 1")).Select();

当更改导致自动回发的ASP.NET控件时,也会发生这种情况.第一个更改将注册,但是您尝试访问的下一个元素将引发访问被拒绝"错误,因为它仍在尝试访问旧页面.在这种情况下,您可以尝试使用ie.WaitForComplete(),但有时这是必需的:

This can also happen when changing an ASP.NET control that cause an auto-postback. The first change will register, but the next element you try to access will throw an "Access Denied" error because it is still trying to access the old page. In this case you can try using ie.WaitForComplete(), but sometimes this is required:

ie.SelectList(Find.ById("AutoPostBackSelect")).Option(Find.ByText("Option")).Select();
System.Threading.Thread.Sleep(200); //Sleep to make sure post back registers
ie.WaitForComplete();
ie.SelectList(Find.ById("MySelect")).Refresh()
ie.SelectList(Find.ById("MySelect")).Option(Find.ByText("Option 1")).Select();

这篇关于访问被拒绝错误(Visual Studio和WatiN)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆