Web 如何通过TestComplete验证闪烁光标当前是否位于文本框内
我试图验证文本框是否在某个操作后获得焦点(闪烁的光标放在其中)。我尝试使用聚焦属性,但它似乎不起作用,或者对象没有此属性。这是一个Web应用程序。这是密码Web 如何通过TestComplete验证闪烁光标当前是否位于文本框内,web,jscript,testcomplete,Web,Jscript,Testcomplete,我试图验证文本框是否在某个操作后获得焦点(闪烁的光标放在其中)。我尝试使用聚焦属性,但它似乎不起作用,或者对象没有此属性。这是一个Web应用程序。这是密码 reportPage = Aliases.iexplore.IESA; saveWindow = reportPage.Find("ObjectIdentifier", "MainContent_saveFilterSetDialog_saveDialog", 50, true); saveWindowNameTextBox
reportPage = Aliases.iexplore.IESA;
saveWindow = reportPage.Find("ObjectIdentifier", "MainContent_saveFilterSetDialog_saveDialog", 50, true);
saveWindowNameTextBox = saveWindow.Find("ObjectIdentifier", "*MainContent_*_sfsName", 25, true);
if(saveWindowNameTextBox.Focused == true)
Log.Message("The blinking cursor is inside of the name text box")
else
Log.Error("The blinking cursor is not inside of the name text box")
日志窗口显示“等待聚焦”,然后失败,日志显示“无法找到具有指定属性的对象”
注意:在“对象检查器”窗口中检查此文本框对象时,属性列表中未列出“聚焦”
还有其他方法可以实现这一点吗?我可以使用HTML DOM属性activeElement实现这一点
var actualFocusedElement = Sys.Browser().Page("*BC/Report*").contentDocument.activeElement.id
if(aqString.Contains(actualElement, "saveDialog_tmpl_sfsName", 0, true))
Log.Message("The blinking cursor is inside of the name text box")
else
Log.Error("The blinking cursor is not inside of the name text box")