如何通过watij为此input元素设置值

时间:2022-11-13 00:04:38

My code:

<input tabIndex="1" style="width: 10px; color: black; margin-left: 2px;" type="text" setvaluehandler="RichInputBoxSetValueHandler1" backspacedeleteoff="true" tipText="" jQuery1308721363625="14"/>

I don't know what setvaluehandler="RichInputBoxSetValueHandler1" means?
Is it a trigger handler? If so, how is it triggered?

我不知道setvaluehandler =“RichInputBoxSetValueHandler1”是什么意思?它是触发器处理程序吗?如果是这样,它是如何触发的?

1 个解决方案

#1


0  

This looks like a text input with a few custom attributes (maybe read by jquery).

这看起来像一个带有一些自定义属性的文本输入(可能由jquery读取)。

U should be able to fill it like a standard text input with Watij.

你应该可以像Watij的标准文本输入一样填充它。

EDIT : which means you have to add a "name" or an "id" to your element.

编辑:这意味着你必须为你的元素添加“名称”或“id”。

EDIT 2 : If you can't add a "name" or an "id" to you element, you have to use xpath (which may require to experiment).

编辑2:如果你不能为你的元素添加“名称”或“id”,你必须使用xpath(可能需要实验)。

First you could try :

首先你可以尝试:

ie.textField(xpath,"//INPUT[@setvaluehandler='RichInputBoxSetValueHandler1']").set("Text"); 

XPath finding may not work if HTML is not valid HTML (try to validate the HTML page you're trying to automate through http://validator.w3.org/).

如果HTML不是有效的HTML,则XPath查找可能不起作用(尝试通过http://validator.w3.org/验证您尝试自动化的HTML页面)。

#1


0  

This looks like a text input with a few custom attributes (maybe read by jquery).

这看起来像一个带有一些自定义属性的文本输入(可能由jquery读取)。

U should be able to fill it like a standard text input with Watij.

你应该可以像Watij的标准文本输入一样填充它。

EDIT : which means you have to add a "name" or an "id" to your element.

编辑:这意味着你必须为你的元素添加“名称”或“id”。

EDIT 2 : If you can't add a "name" or an "id" to you element, you have to use xpath (which may require to experiment).

编辑2:如果你不能为你的元素添加“名称”或“id”,你必须使用xpath(可能需要实验)。

First you could try :

首先你可以尝试:

ie.textField(xpath,"//INPUT[@setvaluehandler='RichInputBoxSetValueHandler1']").set("Text"); 

XPath finding may not work if HTML is not valid HTML (try to validate the HTML page you're trying to automate through http://validator.w3.org/).

如果HTML不是有效的HTML,则XPath查找可能不起作用(尝试通过http://validator.w3.org/验证您尝试自动化的HTML页面)。