Tuesday, March 30, 2010

Do You Want To View Your Web Table's Structure?

Do you want to view your web table's structure? If the answer is Yes, then try the below snippet.
Set objTable=Browser("name:=Google").Page("title:=Google").WebTable("name:=q").Object
strTRCount=objTable.getElementsByTagName("TD").Length-1
For i=0 to strTRCount
objTable.getElementsByTagName("TD")(i).style.borderstyle="solid"
objTable.getElementsByTagName("TD")(i).style.borderwidth="2px"
objTable.getElementsByTagName("TD")(i).style.bordercolor="#98bf21"
Next
Try the above code with Google page, you will get the output as below.

Now, you are able to view all the cells of the webtable.

1 comment:

  1. Set objTable=Browser("name:=Google").Page("title:=Google").WebTable("name:=q").Object
    strTRCount=objTable.getElementsByTagName("TD").Length-1
    For i=0 to strTRCount
    objTable.getElementsByTagName("TD")(i).style.borderstyle="solid"
    objTable.getElementsByTagName("TD")(i).style.borderwidth="2px"
    objTable.getElementsByTagName("TD")(i).style.bordercolor="#98bf21"
    Next

    ReplyDelete