Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VAlue from datasheet is not being picket up
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi,
I have to enter date in a field based on whether that field is enabled or disabed. My coede reads as follows
Code:
Dim FromDateDisabled
FromDateDisabled = Browser("x").Page("y").WebEdit("FromDate").GetROProperty("Disabled")
If FromDateDisabled = False Then
Browser("x").Page("y").WebEdit("FromDate").Set DataTable("FromDate", dtGlobalSheet)
    Else
    Reporter.ReportEvent micPass,"From Date","From Date Disabled"
In this situation, if the disabled = true, Else statement is not picking up and the test fails.
Any hlep is appreciated please!!
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
Try changing to this

Code:
If lcase(FromDateDisabled) = "false" then

GetROproperty is going to return a string value.

Hope this helps.
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi,

Please try the below code to get the value

Code:
DataTable.Import("C:\Documents and Settings\qtp\Desktop\Login_Details.xls")
WebVal=DataTable.GetSheet(1).GetParameter("Login").Value
Val=Browser("name:=International").Page("title:=International").WebEdit("name:=Uname").GetROProperty("disabled")
If Val=0 Then
     Browser("name:=International").Page("title:=International").WebEdit("name:=Uname").Set WebVal
else
    Reporter.ReportEvent micFail,"Login user name field ","Login username field is read only"
End If

Thanks,
Rekhapramod
Reply
#4
Solved: 10 Years, 8 Months, 3 Weeks ago
Sorry guys,
Both the solutions didn't work. I guess, it is wrong from my part in explaining the problem. Let me rewrite the problem.
The code after the 'Then' statement is not being picked up whether it is reporter... event or entering the value from the datasheet.
Thanks for all the help I am getting from you guys.
Reply
#5
Solved: 10 Years, 8 Months, 3 Weeks ago
I can only see that scenario happening if your script is throwing an error. VbScript stops execution on error unless otherwise specified. You do have to be careful. depending on the errored statment, the next line might be the true statement of the if..condition and not be the results you want.

Code:
on error resume next 'go to next statment
Dim FromDateDisabled
FromDateDisabled = 1 'default to satisfy condition test if error occurs
FromDateDisabled = Browser("x").Page("y").WebEdit("FromDate").GetROProperty("Disabled")
If FromDateDisabled = 0 Then  'disabled is reverse logic too!!!!
  Browser("x").Page("y").WebEdit("FromDate").Set DataTable("FromDate", dtGlobalSheet)
Else
  Reporter.ReportEvent micPass,"From Date","From Date Disabled"
end if

Hope this helps.
Reply
#6
Solved: 10 Years, 8 Months, 3 Weeks ago
Thank you. Go to next step upon error works. For now, I will give a break and will dig into this. I want to see if there is a way to make this work without the go to next step line.

But, I can't thank you enough for answering my questions.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  export UFT datasheet to excel and then append Mozza 0 1,638 09-04-2018, 08:58 AM
Last Post: Mozza
  Change the datasheet jsknight1969 4 3,531 10-19-2009, 07:00 AM
Last Post: mhicke
  Set the column header in the excelsheet before importing it to local datasheet nageshpv 2 3,189 08-04-2008, 04:05 PM
Last Post: nageshpv

Forum Jump:


Users browsing this thread: 1 Guest(s)