Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error object doesnt support this property or method
#1
Solved: 10 Years, 10 Months ago
I've been trying to get around this for a while and can't seem to get it. The code below gives the error

"Object doesn't support this property or method: rCount=Browser("Yahoo!").Page("Yahoo! Finance - Business").WebTable("Most Actives","index:=0").RowCount"

The end result I'm trying to achieve is copy data from "Most Actives" table on this site and paste it into a text document.

Any ideas? Thanks



Code:
Browser("Yahoo!").Page("Yahoo!").Link("Finance").Click          
Browser("Yahoo!").Page("Yahoo! Finance - Business").Sync
Wait 10

Dim rCount
Dim cCount
Dim cData

rCount=Browser("Yahoo!").Page("Yahoo! Finance - Business").WebTable("Most Actives","index:=0").RowCount
cCount=Browser("Yahoo!").Page("Yahoo! Finance - Business").WebTable("Most Actives","index:=0").ColumnCount
For r=1 to rCount
cCount=Browser("Yahoo!").Page("Yahoo! Finance - Business").WebTable("Most Actives","index:=0").ColumnCount(r)
For c=1 to cCount
cData=Browser("Yahoo!").Page("Yahoo! Finance - Business").WebTable("Most Actives","index:=0").GetCellData(r,c)

msgbox cData
Next
Next
Reply
#2
Solved: 10 Years, 10 Months ago
Looks like you're using Descriptive Programming there -

Code:
.WebTable("Most Actives","index:=0").
Most Actives should have a property name
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 10 Years, 10 Months ago
Hi Ankur

Thank you for the response. I'm not exactly sure what you mean by property name. Using the object spy I try adding a few attributes to try and specify the table further but it gave the same error. Would you kindly give an example of this "property name"

Edit: The "Most Actives" I got from the object spy, it was the name of the webtable it came back with after clicking on the table "WebTable: Most Actives"

Code:
.WebTable("Most Actives","index:=0","html tag:=TABLE","name:=BAC")
Reply
#4
Solved: 10 Years, 10 Months ago
I mean, the code should look something like

Code:
.WebTable("PropertyName:=Most Actives","index:=0").

given that the syntax is
Code:
.WebTable("PropertyName1:=PropertyValue1","PropertyName2:=PropertyValue2" .....).
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#5
Solved: 10 Years, 10 Months ago
Ah ok, that makes sense.

Well, tried that and it seemed to solve that error but led to a new one.

Code:
Wrong number of arguments or invalid property assignment: 'Browser(...).Page(...).WebTable(...).ColumnCount'

Line (10): "cCount=Browser("Yahoo!").Page("Yahoo! Finance - Business").WebTable("PropertyName:=Most Actives","index:=0","html tag:=TABLE").ColumnCount".

Just in case it helps, the script runs, opens the page but acts like it gets stuck in loop. After letting it run 3-4 minutes I manually stop, thats when the error pops.
Reply
#6
Solved: 10 Years, 10 Months ago
Disregard, I got it to work somehow.
I used a different block of code I found and modified it but, it'll take a bit I think to figure out why this one works while the other doesn't. Thank you for your help Smile

Working Code:

Code:
Dim res
Dim res1
Dim res2
Dim i,j
res =Browser("Yahoo!").Page("Yahoo! Finance - Business").WebTable("PropertyName:=Most Actives","index:=6").RowCount
res1=Browser("Yahoo!").Page("Yahoo! Finance - Business").WebTable("PropertyName:=Most Actives","index:=6").ColumnCount(res)

For i=1 to res
For j=1 to res1
  res2=Browser("Yahoo!").Page("Yahoo! Finance - Business").WebTable("PropertyName:=Most Actives","index:=6").GetCellData(i,j)
msgbox res2
next
next
Reply
#7
Solved: 10 Years, 10 Months ago
PropertyName I mentioned above was just a place holder, it should be replaced with an actual property name.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#8
Solved: 10 Years, 10 Months ago
Ah ok. I guess thats why when I change the "index" number it is cycling through all webtables. The "PropertyName:=Most Actives" isn't really doing anything in this case.

So I guess what I need to figure out is what property IS "Most Actives"
When I use the object spy it says the WebTable: Most Actives, with a variety of attributes. Thats why I put the Most Actives in the webtable function in the first place.

One of the attributes of the Webtable is name:=BAC but it doesn't seem to like that. I'll just have to play around with it some more to try and figure out how to specify what element I want rather than trial and error with index #
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [UFT] Change property of object (WpfButton) robertosalemi 2 2,485 11-22-2016, 12:43 PM
Last Post: Ankur
  Intermitent "Object not visible" error erodpr 5 3,281 01-14-2016, 10:55 AM
Last Post: vinod123
  Uft 12 - Identification of Google Chrome Object's Property value as plain text teja2730 0 2,453 02-02-2015, 05:22 PM
Last Post: teja2730
  cannot use the type method on object and submit is not working jove1776 5 8,379 01-27-2015, 10:08 PM
Last Post: Parke
  ERROR : Object reference not set to an instance of an object. Suyashxp 2 6,944 12-30-2014, 11:32 AM
Last Post: ursprasadp

Forum Jump:


Users browsing this thread: 1 Guest(s)