Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem working with WebCheckBox
#1
Hi all,

I'm doing some exercise on yahoo mail with QTP version 10. The error message comes when I execute my script to delete email:

I've tried some other ways to solve this but it only works when I capture interface in the object repository. Can you guys please help me solve this problem with DP?. All helps are appreciated.

"Object required: 'checkbox'
Function file: D:\QTP\Training\Functions\Yahoo Dynamic Functions.vbs
Line (62): " checkbox.Set "ON"

And this is my script:

Code:
Public sub s_Delete_Mail (strSubject) Dim wTable1 Set wTable1 = Description.Create wTable1("micclass").Value="WebTable" wTable1("text").Value="^.*See.*$" wTable1("html id").Value="" Set inboxtable = Description.Create inboxtable("micclass").Value="WebTable" inboxtable("text").Value="^Inbox.*$" Dim checkbox row = Browser("name:=^.*Yahoo.*$").Page("title:=^.*Yahoo.*$").WebTable(wTable1).WebTable(inboxtable).GetRowWithCellText(strSubject) Set checkbox = Browser("name:=^.*Yahoo.*$").Page("title:=^.*Yahoo.*$").WebTable(wTable1).WebTable(inboxtable).ChildItem(row,1,"WebCheckBox",0) [b]checkbox.Set "ON"[/b] (Click delete button) End Sub

Thanks for reading.
Ngoc Vo
Reply
#2
Hi

Try the script by removing "set" in the line:
Code:
"Set checkbox = Browser("name:=^.*Yahoo.*$").Page("title:=^.*Yahoo.*$").WebTable(wTable1).WebTable(inboxtable).ChildItem(row,1,"WebCheckBox",0)"
Reply
#3
Hi Kavita,

Thank you for replying me. I tried removing the "set" in that line, and this time I get this error messenge:

Object variable not set
Function file: D:\QTP\Training\Functions\Yahoo Dynamic Functions.vbs
Line (59): " checkbox = Browser("name:=^.*Yahoo.*$").Page("title:=^.*Yahoo.*$").WebTable(wTable1).WebTable(inboxtable).ChildItem(row,1,"WebCheckBox",0)".

I think we cannot do it this way. I'm trying to search on google for pass few days, but there is no result Sad
Reply
#4
Hi
Sorry for not reading your message properly. If you are trying to access the checkbox in the webtable "inboxtable", then please try the below script and let me know if it won't work.

Code:
Set inboxtable = Description.Create inboxtable("micclass").Value="WebTable" inboxtable("text").Value="^Inbox.*$" set WebEdits=Browser("name:=^.*Yahoo.*$").Page("title:=^.*Yahoo.*$").ChildObjects(inboxtable) If (WebEdits.Count>0) Then row = WebEdits(0).GetRowWithCellText(strSubject) Set checkbox = WebEdits(0).ChildItem(row,1,"WebCheckBox",0) checkbox.Set "ON" End If
Reply
#5
Hi Kavita,

After trying your new solution, I get the same error message

Object required: 'checkbox'
Function file: D:\QTP\Training\Functions\Yahoo Dynamic Functions.vbs
Line (63): " checkbox.Set "ON"".

Seems like there are some problems with my QTP, because I've searched on many websites, and found out same solutions for this situation, but when I do it that way, I only get this error message Sad
Reply
#6
Hi try by changing the variable name "oCheckBox" (anytext other than "checkbox"), because type value for WebCheckBox is checkbox. I think this might be one reason for that error.
Please let me know.
Reply
#7
Hi all,

I'm happy to inform you guys that I have found my solution in this situation.
I'd like to say "Thank you" to Kavita for helping me (from your solution, I've found my own Smile )

Thanks
Ngoc Vo
Reply
#8
"WelCome" Ggoc, Good to hear that you found the solution.
Reply
#9
But, can you please share with us, what was your solution. I'm facing almost the same problem.

Thanks
Reply
#10
Hi guys,

Sorry for this lately reply because I was so busy in last few days. I'm happy to share with you guys my solution as below

Code:
Public sub s_Delete_Mail (strSubject) 'Go to inbox Set yahoo = Browser("name:=^((Compose\sMail\s\-\s)|(\(\d+\sunread\)\s)|(Inbox\s(\(\d+\))?(\s)?\-\s))?Yahoo!\sMail(\:\sThe\sbest\sweb\-based\semail!)?$").Page("micclass:=Page") yahoo.Link("name:=^Inbox\s\(\d+\)$").Click Set inbox = Browser("name:=^((Compose\sMail\s\-\s)|(\(\d+\sunread\)\s)|(Inbox\s(\(\d+\))?(\s)?\-\s))?Yahoo!\sMail(\:\sThe\sbest\sweb\-based\semail!)?$").Page("micclass:=Page") Set inboxtable = Description.Create inboxtable("micclass").Value="WebTable" inboxtable("text").Value="^Inbox.*$" Set checkbox = Description.Create checkbox("micclass").Value="WebCheckBox" Set checkboxes = inbox.WebTable(inboxtable).ChildObjects(checkbox) row = inbox.WebTable(inboxtable).GetRowWithCellText(strSubject)-1 checkboxes(row).Set "ON" inbox.WebButton("name:=Delete","html id:=top_del").Click End Sub
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)