What to do when QTP is not able to identify browse or upload buttons

上一篇 / 下一篇  2009-12-18 16:25:51 / 个人分类:我的自动化学习

Dim web, webPage
Set web = Browser("name:=****")
Set webPage = Browser("name:=****").Page("title:=****")
webPage.Frame("html id:="&popFrame.id).WebFile("name:=uploadFile").Click
web.Dialog("regexpwndtitle:=选择文件").WinListView("regexpwndclass:=SysListView32").Select "指标导入.xls"
web.Dialog("regexpwndtitle:=选择文件").WinButton("text:=打开\(\&O\)").Click
webPage.Frame("html id:="&popFrame.id).WebFile("name:=uploadFile").Set "C:\Documents and Settings\neipin\桌面\指标导入.xls"


转载:http://www.learnqtp.com/qtp-unable-to-identify-browse-upload-buttons/

I am recording using QTP and for some reason QTP does not recognize any upload buttons. For example, start the recording at this site:http://cgi-lib.berkeley.edu/ex/fup.html

Click on the "Browse" button. Notice this click is not recognized by QTP. Please provide some feedback why QTP is not able to recognize this button. Thanks

This is an interesting question and not a typical object identification issue. I thought I will take it up on the blog to make it available to the wider audience.

If you go on the link mentioned above, you will see QTP is not able to record the click on Browse web button. Web buttons are generally associated withinput type=submitobject but if you see the source of the browse button, you will noticeinput type=fileobject.

qtp-type-file-type-submit 

Now According toMicrosoft help,input type=fileobject creates a file upload object with a text boxANDBrowse button. Notice the AND. So, in case ofinput type=file, the text box and browse button are considered part of ONE object. There are no separate objects for QTP to identify.

What can we do to solve this issue?

EnterWeb Event Recording Configuration.

  1. Object Spy on the text box/ browse button object reveals that it is a WebFile type Object.QTP webfile object
  2. Using Tools > Web Event Recording Configuration, go to WebFile (under Web Objects tree). Addonclickevent.When QTP does not recognize buttons
  3. Set theonclickevent settings to Always. Click ‘OK’.QTP onclick werc
  4. Done!. Record the click on browse button, now QTP should be able to identify the click on the button.

TAG:

 

评分:0

我来说两句

Open Toolbar