Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to click on WebElement within a WebTable
#8
Solved: 8 Years ago
(08-15-2013, 02:06 AM)fridlek Wrote: I am having some difficulty trying to automate clicking a WebElement that resides within a WebTable.

I have no problems being able to find the row and column with the webtable that contains the value I wish to click on. The problem is the clicking part....

Below is my code for finding the row and column within the WebTable. The problem is with using ChildItem(iRow, iCol, "WebElement", 0). It doesn't want to return a value. It keeps giving me a Object Error.

ANy help would be appreciated!

Thanks!

Code:
row_count=Browser("title:= Supplier T-File Tracking.*").Page("title:= Supplier T-File Tracking.*").WebTable("html id:= tfiletable").RowCount
col_count=Browser("title:= Supplier T-File Tracking.*").Page("title:= Supplier T-File Tracking.*").WebTable("html id:= tfiletable").ColumnCount(row_count)

For iRow = 1 to row_count
  For iCol = 1 to col_count
    iReturn =  Browser("title:= Supplier T-File Tracking.*").Page("title:=Supplier T-File Tracking.*").WebTable("html id:= tfiletable").ChildItemCount(iRow,iCol,"WebElement")
   
    strReturn =  Browser("title:= Supplier T-File Tracking.*").Page("title:= Supplier T-File Tracking.*").WebTable("html id:= tfiletable").GetCellData(iRow,iCol)

    Print "This is the cell data: " & strReturn
 
    If strReturn = "READY FOR T-FILE FOCAL" Then
        MsgBox "I found the cell numbers: " & " Row: " &  iRow & " Column: " & iCol
        nCnt = Browser("title:= Supplier T-File Tracking.*").Page("title:= Supplier T-File Tracking.*").WebTable("html id:= tfiletable").ChildItemCount(iRow, iCol, "WebElement")
       Browser("title:= Supplier T-File Tracking.*").Page("title:= Supplier
    End If
    If iReturn > 0 Then
       Print "This is row: " & iRow & " and column: " & iCol & " ChildItems = " & iReturn
    End If
  Next
Next

I'm guessing it's because the ChildItemCount value = 0 is why the Object Error appears when I try to do this with the object:

Code:
iChildCnt = Browser("title:= Supplier T-File Tracking.*").Page("title:= Supplier T-File Tracking.*").WebTable("html id:= tfiletable").ChildItemCount(intRow, intColumn, "WebElement")

Set oPartNumberLink = Browser("title:= Supplier T-File Tracking.*").Page("title:= Supplier T-File Tracking.*").WebTable("html id:= tfiletable").ChildItem(intRow, intColumn, "WebElement", 0)

oPartNumberLink.Highlight

I guess I don't understand why ChildItem Count is returning 0 when I know for a fact that is the cell row and column of the value I want.

Hi fridlek,

Please try the below way.

Browser("title:= Supplier T-File Tracking.*").Page("title:= Supplier T-File Tracking.*").WebTable("html id:= tfiletable").ChildItemCount(intRow, intColumn, "WebElement").Click

This should definitely work.

Thanks,
Nandana
Reply


Messages In This Thread
RE: Trying to click on WebElement within a WebTable - by Nandana - 11-10-2016, 02:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Gain data from a webtable inside a webtable AndyM 1 1,940 07-12-2018, 08:36 PM
Last Post: Ankur

Forum Jump:


Users browsing this thread: 3 Guest(s)