在CodedUI中设置隐藏输入的值 [英] Set value for hidden input in CodedUI

查看:69
本文介绍了在CodedUI中设置隐藏输入的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我无法设置隐藏输入的值。

I am unable to set the value of a hidden input.

在CodedUI中,我能够通过HTMLCustom对象找到控件。  但是这个对象没有设置者。

In CodedUI, i am able to find the control via an HTMLCustom object.  But there are not setters for this object.

有人可以提供一些建议吗?

Can someone lend some advice?

谢谢

推荐答案

嗨benshull,

Hi benshull,

编码用户界面无法识别隐藏控件,但这是一个解决方法,使用
JavaScript代码来执行。

Coded UI cannot recognize the hidden control, but here is a workaround, to use JavaScript code to execute.

我们可以从Window对象中找出UI对象并将其转换为适当的HTML控件。在此之后,它就像您从UIMap找到控制一样好,并且可以根据需要访问或执行操作。

We could find out UI object from Window object and convert it to appropriate HTML control. After this, it is as good as you have found control from UIMap and can access or perform operations as you want.

示例:

  [TestMethod]

    public void CodedUITestMethod1()
    {
        var Email = (HtmlEdit)this.UIMap.UIGmailInternetExploreWindow.ExecuteScript("return document.getElmentById('Email')");

        Email.Text = "qwe";

    }

祝你好运,

Fletch


这篇关于在CodedUI中设置隐藏输入的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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