Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Object required on SetToProperty
#1
Not Solved
I'm trying to write a script using QTP but got stuck on SetToProperty method.I need to change date in and object innerhtml. After I do that then when I try to set the value Using SetToProperty I'm having error Object required:
For reference here is my code.

Code:
Browser("MyPurolator Login - Purolator").Page("MyPurolator Home - Purolator").Link("Create a Shipment").Click

Browser("MyPurolator Login - Purolator").Page("Purolator E-Ship Online").Sync

Set var_date = Browser("MyPurolator Login - Purolator").Page("Purolator E-Ship Online").WebTable("WebTable")

var_date = var_date.GetTOProperty("innerhtml")

MsgBox var_date

var_date = replace(var_date, "2010-12-11 ", "2010-12-02 ")

MsgBox var_date

DataTable.Value("value", dtGlobalSheet) = var_date

var_temp = DataTable.Value("value", dtGlobalSheet)

MsgBox var_temp

var_date.SetTOProperty "innerhtml", var_temp (THIS IS WHERE HAVING ERROR)

' Set value of web table then sync

MsgBox var_date.GetTOProperty("innerhtml")

Browser("MyPurolator Login - Purolator").Page("Purolator E-Ship Online").Sync

Can somebody help me to resolve it?

Many Thanks in Advance.
Reply
#2
Not Solved
In the line:

Code:
var_date = var_date.GetTOProperty("innerhtml")

you are overwriting the variable that used to hold the object. Create a new variable to hold the original innerhtml of the test object.

Code:
Browser("MyPurolator Login - Purolator").Page("MyPurolator Home - Purolator").Link("Create a Shipment").Click

Browser("MyPurolator Login - Purolator").Page("Purolator E-Ship Online").Sync

Set var_date = Browser("MyPurolator Login - Purolator").Page("Purolator E-Ship Online").WebTable("WebTable")

var_innerhtml = var_date.GetTOProperty("innerhtml")

MsgBox var_innerhtml

var_innerhtml = replace(var_date, "2010-12-11 ", "2010-12-02 ")

MsgBox var_innerhtml

var_date.SetTOProperty "innerhtml", var_innerhtml

MsgBox var_date.GetTOProperty("innerhtml")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Script required to run any app as administrator kalyan_srirangam 0 2,664 09-02-2013, 08:18 PM
Last Post: kalyan_srirangam
  Object Required Error branjitk 6 12,825 06-07-2012, 12:43 PM
Last Post: branjitk
  Object Required Error rohit330 0 2,872 05-07-2012, 10:16 PM
Last Post: rohit330
  The SetTOProperty on an object is n ot working... shibinp 0 3,066 09-02-2011, 06:39 PM
Last Post: shibinp
  Object required error received after object was set RJP 0 3,532 01-20-2011, 03:51 AM
Last Post: RJP

Forum Jump:


Users browsing this thread: 1 Guest(s)