简体   繁体   中英

UFT Image used as button

I am trying to run the below code, but it throws and error when executing the last line of code.

Browser("name:=401K Calculator").Page("title:=401K Calculator").WebEdit("name:=age").Set 26
Browser("name:=401K Calculator").Page("title:=401K Calculator").WebEdit("name:=retirementage").Set 70
Browser("name:=401K Calculator").Page("title:=401K Calculator").WebEdit("name:=lifeexpectancy").Set 80
Browser("name:=401K Calculator").Page("title:=401K Calculator").WebEdit("name:=income").Set 50000
Browser("name:=401K Calculator").Page("title:=401K Calculator").WebEdit("name:=incomeincrease").Set 3
Browser("name:=401K Calculator").Page("title:=401K Calculator").WebEdit("name:=balance").Set 150000
Browser("name:=401K Calculator").Page("title:=401K Calculator").WebEdit("name:=contribution").Set 10
Browser("name:=401K Calculator").Page("title:=401K Calculator").WebEdit("name:=inflation").Set 5

Browser("name:=401K Calculator").Page("title:=401K Calculator").Image("file name:=calculate.png","index=0").Click

When I use Object spy on the button (image), it shows its name as"image" instead Button.

I am using the script on http://www.calculator.net/401k-calculator.html website.

Here is the error: "Object doesn't support this property or method: 'Browser(...).Page(...).Image'"

What should I change in order to get it to work?

The description you gave for the calculate button is:

"file name:=calculate.png","index=0"

The first part is fine but in the index part you forgot the : that tells UFT you're using descriptive programming. It should be:

"file name:=calculate.png","index:=0"
' You forgot this                ^

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM