0

I found a table element using

WebElement tableElement = selectorboxelement.findElement(By.xpath("//ancestor::table"));

selectorboxelement is a webelement that I found by using

WebElement selectorboxelement = driver.findelement(By.Name("p_part_chkbox"));

The reason I did this, is because I couldn't find the ID or name of the table, but the above element was within the table so it was an easy way to get ahold of the table. Now how do I pull information from specific cells of this table?

Edit: Here is the HTML Code for the table. There's not enough room for the whole code, but the code just repeats until all of the info is there.

   <HTML>
<HEAD>
<TITLE>***************</TITLE>
<SCRIPT LANGUAGE="JavaScript">                                                        
function to_SchedForm(theForm) {                                                 
var j = 0;                                                                         
if (theForm.p_chkbox_cnt.value == 1)
{
        if (theForm.p_part_chkbox.checked ){                                             
            ++j;                                                                    
        }                                                                         
}
else{
for (var i = 0; i < theForm.p_part_chkbox.length; i++ ) {                             
        if (theForm.p_part_chkbox[i].checked ){                                             
            ++j;                                                                    
        }                                                                         
}                                                                                 
}
if (j == 0) {                                                                     
    alert("No Part Numbers Selected");                                             
    return false;                                                                      
}                                                                                  
return true;                                                                     
}                                                                                  
function to_MultiSchedForm(theForm) {                                             
var j = 0;                                                                         
var c = 0;                                                                     
var k = 0;                                                                     
for (var i = 0; i < theForm.p_part_chkbox.length; i++ ) {                             
     if (theForm.p_part_chkbox[i].checked ){++k;
         if (theForm.p_mode_chk[i].value != "CR"){                                      
            ++j;                                                                    
         }                                                                         
       }                                                                               
}                                                                                  
if (k == 0) {                                                                     
    alert("No Part Numbers Selected")
    return false;                                                                       
}                                                                                  
if (j != 0 && theForm.ACTION1.value == "multi_order") {                                                                     
    alert("The Multiple Schedule Update option is only available for Schedules that currently have a blank Last Commit value.  Use the Individual Schedules Button to change a commitment Date.")
    return false;                                                                       
}                                                                                  
return true;                                                                     
}                                                                                  
</SCRIPT>                                                                            
</HEAD>
<BODY>
<TABLE  BORDER="0" WIDTH="100%"
                  CELLSPACING="0" CELLPADDING="0">
<TR>
<TD WIDTH="100%", VALIGN="top"><IMG SRC="/apps/space/img/PPPS_NEW.jpg" ALT="GM Banner" NAME="PPPS1"></TD>
</TR>
<TR>
<TD width="50%"><HR></TD>
</TR>
</TABLE>
<TABLE  BORDER="0" WIDTH="100%" CELLSPACING="0"
                   CELLPADDING="0">
<TR>
<TD WIDTH="100%", VALIGN="top", ALIGN="center"><IMG SRC="/apps/space/img/priority3.jpg" ALT="Priority Banner" NAME="Priority1"></TD>
</TR>
</TABLE>
<BR>
<CENTER>
<TABLE  WIDTH="100%">
<TR>
<FORM ACTION="Schedule.PrioritySummary" METHOD="POST" NAME="to1_PS_Page">
<INPUT TYPE="hidden" NAME="P_PERSON_ID" VALUE="BZRGJH">
<INPUT TYPE="hidden" NAME="p_mode" VALUE="EDIT">
<INPUT TYPE="hidden" NAME="p_type" VALUE="SCHEDULE">
<INPUT TYPE="hidden" NAME="p_space_duns" VALUE="">
<INPUT TYPE="hidden" NAME="p_onum" VALUE="">
<INPUT TYPE="hidden" NAME="p_proc" VALUE="">
<INPUT TYPE="hidden" NAME="p_zcode" VALUE="BL62">
<INPUT TYPE="hidden" NAME="c_sort_one" VALUE="part_number">
<INPUT TYPE="hidden" NAME="c_sort_two" VALUE="priority">
<INPUT TYPE="hidden" NAME="c_sort_three" VALUE="commit_mode">
<INPUT TYPE="hidden" NAME="c_sort_four" VALUE="po_rel_sort">
<INPUT TYPE="hidden" NAME="p_supplier" VALUE="">
<INPUT TYPE="hidden" NAME="p_zcodes_space" VALUE="">
<INPUT TYPE="hidden" NAME="p_duns" VALUE="">
<INPUT TYPE="hidden" NAME="p_part" VALUE="">
<INPUT TYPE="hidden" NAME="p_sort_type" VALUE="none">
<TD VALIGN="BOTTOM" ALIGN="LEFT"><FONT FACE="courierNew" SIZE="2"><B> Part #:</B><INPUT TYPE="text" NAME="p_pnum" SIZE="12" MAXLENGTH="12"></FONT><INPUT TYPE="submit" VALUE="GO"></TD>
</FORM>
<FORM ACTION="Schedule.PrioritySummary" METHOD="POST" NAME="to2_PS_Page">
<INPUT TYPE="hidden" NAME="P_PERSON_ID" VALUE="BZRGJH">
<INPUT TYPE="hidden" NAME="p_mode" VALUE="EDIT">
<INPUT TYPE="hidden" NAME="p_type" VALUE="SCHEDULE">
<INPUT TYPE="hidden" NAME="p_space_duns" VALUE="">
<INPUT TYPE="hidden" NAME="p_pnum" VALUE="">
<INPUT TYPE="hidden" NAME="p_proc" VALUE="">
<INPUT TYPE="hidden" NAME="p_zcode" VALUE="BL62">
<INPUT TYPE="hidden" NAME="c_sort_one" VALUE="po_rel_sort">
<INPUT TYPE="hidden" NAME="c_sort_two" VALUE="part_number">
<INPUT TYPE="hidden" NAME="c_sort_three" VALUE="priority">
<INPUT TYPE="hidden" NAME="c_sort_four" VALUE="commit_mode">
<INPUT TYPE="hidden" NAME="p_sort_type" VALUE="none">
<INPUT TYPE="hidden" NAME="p_supplier" VALUE="">
<INPUT TYPE="hidden" NAME="p_zcodes_space" VALUE="">
<INPUT TYPE="hidden" NAME="p_duns" VALUE="">
<INPUT TYPE="hidden" NAME="p_part" VALUE="">
<TD VALIGN="BOTTOM" ALIGN="LEFT"><FONT FACE="courierNew" SIZE="2"><B> Order #: </B><INPUT TYPE="text" NAME="p_onum" SIZE="12" MAXLENGTH="12"></FONT><INPUT TYPE="submit" VALUE="GO"></TD>
</FORM>
<FORM ACTION="Schedule.PrioritySummary" METHOD="POST"  NAME="to3_PS_Page">
<INPUT TYPE="hidden" NAME="P_PERSON_ID" VALUE="BZRGJH">
<INPUT TYPE="hidden" NAME="p_mode" VALUE="EDIT">
<INPUT TYPE="hidden" NAME="p_type" VALUE="SCHEDULE">
<INPUT TYPE="hidden" NAME="p_space_duns" VALUE="">
<INPUT TYPE="hidden" NAME="p_pnum" VALUE="">
<INPUT TYPE="hidden" NAME="p_onum" VALUE="">
<INPUT TYPE="hidden" NAME="p_zcode" VALUE="BL62">
<INPUT TYPE="hidden" NAME="c_sort_one" VALUE="po_rel_sort">
<INPUT TYPE="hidden" NAME="c_sort_two" VALUE="part_number">
<INPUT TYPE="hidden" NAME="c_sort_three" VALUE="priority">
<INPUT TYPE="hidden" NAME="c_sort_four" VALUE="commit_mode">
<INPUT TYPE="hidden" NAME="p_sort_type" VALUE="none">
<INPUT TYPE="hidden" NAME="p_supplier" VALUE="">
<INPUT TYPE="hidden" NAME="p_zcodes_space" VALUE="">
<INPUT TYPE="hidden" NAME="p_duns" VALUE="">
<INPUT TYPE="hidden" NAME="p_part" VALUE="">
<TD VALIGN="BOTTOM" ALIGN="LEFT"><FONT FACE="courierNew" SIZE="2"><B><SELECT NAME="p_proc"><OPTION VALUE="0">&lt; Select Processor &gt;<OPTION VALUE="KXH">K.Hr 918040497243         <OPTION VALUE="SJF">S. Fox 586-484-0855       </SELECT></B></FONT><INPUT TYPE="submit" VALUE="GO"></TD>
</FORM>
</TR>
</TABLE>
</CENTER>
<HR>
<CENTER>
<FONT FACE="courierNew" SIZE="2">Mfg. DUNS: <B>178522926</B></FONT>
&nbsp;&nbsp;
<FONT FACE="courierNew" SIZE="2"><B>KAUTEX INC</B></FONT>
&nbsp;&nbsp;
<FONT FACE="courierNew" SIZE="2">Z-code: <B>BL62</B></FONT>
</CENTER>
<CENTER>
<TABLE  WIDTH="100%" BORDER="2" BORDERCOLOR="#00008B">
<TR>
<TH VALIGN="CENTER" ALIGN="CENTER" WIDTH="5%" BGCOLOR="darkblue"><CENTER><FONT COLOR="WHITE" SIZE="-1"><B><FONT FACE="courierNew" SIZE="2">Select One or More</FONT></B></FONT></CENTER></TH><FORM ACTION="Schedule.PrioritySummary" METHOD="POST"  NAME="to4_PS_Page">
<INPUT TYPE="hidden" NAME="P_PERSON_ID" VALUE="BZRGJH">
<INPUT TYPE="hidden" NAME="iv_group" VALUE="">
<INPUT TYPE="hidden" NAME="p_mode" VALUE="EDIT">
<INPUT TYPE="hidden" NAME="p_type" VALUE="SCHEDULE">
<INPUT TYPE="hidden" NAME="p_space_duns" VALUE="">
<INPUT TYPE="hidden" NAME="p_duns_number" VALUE="">
<INPUT TYPE="hidden" NAME="p_zcode" VALUE="BL62">
<INPUT TYPE="hidden" NAME="p_pnum" VALUE="">
<INPUT TYPE="hidden" NAME="p_onum" VALUE="">
<INPUT TYPE="hidden" NAME="p_proc" VALUE="">
<INPUT TYPE="hidden" NAME="p_sort_type" VALUE="part_num">
<INPUT TYPE="hidden" NAME="c_sort_one" VALUE="part_number">
<INPUT TYPE="hidden" NAME="c_sort_two" VALUE="priority">
<INPUT TYPE="hidden" NAME="c_sort_three" VALUE="commit_mode">
<INPUT TYPE="hidden" NAME="c_sort_four" VALUE="po_rel_sort">
<INPUT TYPE="hidden" NAME="p_supplier" VALUE="">
<INPUT TYPE="hidden" NAME="p_zcodes_space" VALUE="">
<INPUT TYPE="hidden" NAME="p_duns" VALUE="">
<INPUT TYPE="hidden" NAME="p_part" VALUE="">
<TH  BGCOLOR="darkblue"><CENTER><FONT COLOR="WHITE" SIZE="-1"><B><INPUT TYPE="image" NAME="p_img" SRC="/apps/space/img/Part_Number_Button2.gif" border="0"></B></FONT></CENTER></TH></FORM>
<TH VALIGN="CENTER" ALIGN="CENTER" WIDTH="21%" BGCOLOR="darkblue"><CENTER><FONT COLOR="WHITE" SIZE="-1"><B><FONT FACE="courierNew" SIZE="2">Description</FONT></B></FONT></CENTER></TH><FORM ACTION="Schedule.PrioritySummary" METHOD="POST"  NAME="to5_PS_Page">
<INPUT TYPE="hidden" NAME="P_PERSON_ID" VALUE="BZRGJH">
<INPUT TYPE="hidden" NAME="iv_group" VALUE="">
<INPUT TYPE="hidden" NAME="p_mode" VALUE="EDIT">
<INPUT TYPE="hidden" NAME="p_type" VALUE="SCHEDULE">
<INPUT TYPE="hidden" NAME="p_space_duns" VALUE="">
<INPUT TYPE="hidden" NAME="p_duns_number" VALUE="">
<INPUT TYPE="hidden" NAME="p_zcode" VALUE="BL62">
<INPUT TYPE="hidden" NAME="p_pnum" VALUE="">
<INPUT TYPE="hidden" NAME="p_onum" VALUE="">
<INPUT TYPE="hidden" NAME="p_proc" VALUE="">
<INPUT TYPE="hidden" NAME="p_sort_type" VALUE="ordr_num">
<INPUT TYPE="hidden" NAME="c_sort_one" VALUE="po_rel_sort">
<INPUT TYPE="hidden" NAME="c_sort_two" VALUE="part_number">
<INPUT TYPE="hidden" NAME="c_sort_three" VALUE="priority">
<INPUT TYPE="hidden" NAME="c_sort_four" VALUE="commit_mode">
<INPUT TYPE="hidden" NAME="p_supplier" VALUE="">
<INPUT TYPE="hidden" NAME="p_zcodes_space" VALUE="">
<INPUT TYPE="hidden" NAME="p_duns" VALUE="">
<INPUT TYPE="hidden" NAME="p_part" VALUE="">
<TH  BGCOLOR="darkblue"><CENTER><FONT COLOR="WHITE" SIZE="-1"><B><INPUT TYPE="image" NAME="p_img" SRC="/apps/space/img/Order_Number_Button2.gif" border="0"></B></FONT></CENTER></TH></FORM>
<TH VALIGN="CENTER" ALIGN="CENTER" WIDTH="7%" BGCOLOR="darkblue"><CENTER><FONT COLOR="WHITE" SIZE="-1"><B><FONT FACE="courierNew" SIZE="2">Last Commit</FONT></B></FONT></CENTER></TH><FORM ACTION="Schedule.PrioritySummary" METHOD="POST"  NAME="to6_PS_Page">
<INPUT TYPE="hidden" NAME="P_PERSON_ID" VALUE="BZRGJH">
<INPUT TYPE="hidden" NAME="iv_group" VALUE="">
<INPUT TYPE="hidden" NAME="p_mode" VALUE="EDIT">
<INPUT TYPE="hidden" NAME="p_type" VALUE="SCHEDULE">
<INPUT TYPE="hidden" NAME="p_space_duns" VALUE="">
<INPUT TYPE="hidden" NAME="p_duns_number" VALUE="">
<INPUT TYPE="hidden" NAME="p_zcode" VALUE="BL62">
<INPUT TYPE="hidden" NAME="p_pnum" VALUE="">
<INPUT TYPE="hidden" NAME="p_onum" VALUE="">
<INPUT TYPE="hidden" NAME="p_proc" VALUE="">
<INPUT TYPE="hidden" NAME="p_sort_type" VALUE="none">
<INPUT TYPE="hidden" NAME="p_supplier" VALUE="">
<INPUT TYPE="hidden" NAME="p_zcodes_space" VALUE="">
<INPUT TYPE="hidden" NAME="p_duns" VALUE="">
<INPUT TYPE="hidden" NAME="p_part" VALUE="">
<TH  BGCOLOR="darkblue"><CENTER><FONT COLOR="WHITE" SIZE="-1"><B><INPUT TYPE="image" NAME="p_img" SRC="/apps/space/img/Due_Now_Button2.gif" border="0"></B></FONT></CENTER></TH></FORM>
<TH VALIGN="CENTER" ALIGN="CENTER" WIDTH="5%" BGCOLOR="darkblue"><CENTER><FONT COLOR="WHITE" SIZE="-1"><B><FONT FACE="courierNew" SIZE="2">Due 11/03</FONT></B></FONT></CENTER></TH><TH VALIGN="CENTER" ALIGN="CENTER" WIDTH="5%" BGCOLOR="darkblue"><CENTER><FONT COLOR="WHITE" SIZE="-1"><B><FONT FACE="courierNew" SIZE="2">Due 11/10</FONT></B></FONT></CENTER></TH><TH VALIGN="CENTER" ALIGN="CENTER" WIDTH="5%" BGCOLOR="darkblue"><CENTER><FONT COLOR="WHITE" SIZE="-1"><B><FONT FACE="courierNew" SIZE="2">Due 11/17</FONT></B></FONT></CENTER></TH><TH VALIGN="CENTER" ALIGN="CENTER" WIDTH="5%" BGCOLOR="darkblue"><CENTER><FONT COLOR="WHITE" SIZE="-1"><B><FONT FACE="courierNew" SIZE="2">Due 11/24</FONT></B></FONT></CENTER></TH><TH VALIGN="CENTER" ALIGN="CENTER" WIDTH="5%" BGCOLOR="darkblue"><CENTER><FONT COLOR="WHITE" SIZE="-1"><B><FONT FACE="courierNew" SIZE="2">Future</FONT></B></FONT></CENTER></TH><TH VALIGN="CENTER" ALIGN="CENTER" WIDTH="5%" BGCOLOR="darkblue"><CENTER><FONT COLOR="WHITE" SIZE="-1"><B><FONT FACE="courierNew" SIZE="2">Total</FONT></B></FONT></CENTER></TH><TH VALIGN="CENTER" ALIGN="CENTER" WIDTH="5%" BGCOLOR="darkblue"><CENTER><FONT COLOR="WHITE" SIZE="-1"><B><FONT FACE="courierNew" SIZE="2">SNR</FONT></B></FONT></CENTER></TH></TR>
<FORM ACTION="Schedule.SchedForm" METHOD="POST" NAME="toSchedForm"onSubmit="if (this.ACTION1.value == 'single_order')
                                    {
                                       if (to_SchedForm(this))
                                       {
                                           return true
                                       }
                                       else
                                       {
                                          return false
                                       }
                                    }
                                    else
                                    {
                                       if (to_MultiSchedForm(this))
                                       {
                                          document.toSchedForm.action=&quot;Schedule.multi_schedform&quot;;return true
                                       }
                                       else
                                       {
                                          return false
                                    }
                                       return false
                                 }">
<INPUT TYPE="hidden" NAME="P_EMS_DIVISION" VALUE="M ">
<INPUT TYPE="hidden" NAME="P_DOC_PREFIX" VALUE="XQ">
<INPUT TYPE="hidden" NAME="P_DOC_NUMBER" VALUE="APHL ">
<INPUT TYPE="hidden" NAME="P_DOCUMENT_TYPE" VALUE="Q">
<INPUT TYPE="hidden" NAME="P_PART_DLS" VALUE="A">
<INPUT TYPE="hidden" NAME="P_PART_PLS" VALUE=" ">
<INPUT TYPE="hidden" NAME="P_PART_NUM" VALUE="23214821">
<INPUT TYPE="hidden" NAME="p_mode_chk" VALUE="CR">
<INPUT TYPE="hidden" NAME="p_chkbox_cnt" VALUE="1">
<TR>
<TD VALIGN="CENTER" ALIGN="CENTER"><B><INPUT TYPE="checkbox" NAME="p_part_chkbox" VALUE="1"></B></TD>
<TD VALIGN="CENTER"
                                         ALIGN="RIGHT"><FONT FACE="CourierNew" SIZE="2"><B>******** </B></FONT></TD>
<TD VALIGN="CENTER"
                                         ALIGN="LEFT"><FONT FACE="courierNew" SIZE="2">TANK ASM - FUEL                                       </FONT></TD>
<TD><FONT FACE="CourierNew" SIZE="2">*******</FONT></TD>
<TD VALIGN="CENTER"
                                     ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>-</B></FONT></TD>
<TD VALIGN="CENTER"
                                            ALIGN="CENTER"><B><FONT COLOR="*****" FACE="courierNew" SIZE="2"></B><B>12</B></FONT></TD>
<TD VALIGN="CENTER"
                                            ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>0</B></FONT></TD>
<TD VALIGN="CENTER"
                                         ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>0</B></FONT></TD>
<TD VALIGN="CENTER"
                                         ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>0</B></FONT></TD>
<TD VALIGN="CENTER"
                                         ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>0</B></FONT></TD>
<TD VALIGN="CENTER"
                                         ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>0</B></FONT></TD>
<TD VALIGN="CENTER"
                                         ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>****</B></FONT></TD>
<TD VALIGN="CENTER"
                                         ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>-</B></FONT></TD>
</TR>
<INPUT TYPE="hidden" NAME="P_EMS_DIVISION" VALUE="M ">
<INPUT TYPE="hidden" NAME="P_DOC_PREFIX" VALUE="XQ">
<INPUT TYPE="hidden" NAME="P_DOC_NUMBER" VALUE="APHL ">
<INPUT TYPE="hidden" NAME="P_DOCUMENT_TYPE" VALUE="Q">
<INPUT TYPE="hidden" NAME="P_PART_DLS" VALUE="A">
<INPUT TYPE="hidden" NAME="P_PART_PLS" VALUE=" ">
<INPUT TYPE="hidden" NAME="P_PART_NUM" VALUE="***********">
<INPUT TYPE="hidden" NAME="p_mode_chk" VALUE="CR">
<INPUT TYPE="hidden" NAME="p_chkbox_cnt" VALUE="2">
<TR>
<TD VALIGN="CENTER" ALIGN="CENTER"><B><INPUT TYPE="checkbox" NAME="p_part_chkbox" VALUE="2"></B></TD>
<TD VALIGN="CENTER"
                                         ALIGN="RIGHT"><FONT FACE="CourierNew" SIZE="2"><B>******** </B></FONT></TD>
<TD VALIGN="CENTER"
                                         ALIGN="LEFT"><FONT FACE="courierNew" SIZE="2">TANK ASM - FUEL                                       </FONT></TD>
<TD><FONT FACE="CourierNew" SIZE="2">J1UJ3  -000</FONT></TD>
<TD VALIGN="CENTER"
                                     ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>-</B></FONT></TD>
<TD VALIGN="CENTER"
                                            ALIGN="CENTER"><B><FONT COLOR="FF0000" FACE="courierNew" SIZE="2"></B><B>*****</B></FONT></TD>
<TD VALIGN="CENTER"
                                            ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>0</B></FONT></TD>
<TD VALIGN="CENTER"
                                         ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>0</B></FONT></TD>
<TD VALIGN="CENTER"
                                         ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>0</B></FONT></TD>
<TD VALIGN="CENTER"
                                         ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>0</B></FONT></TD>
<TD VALIGN="CENTER"
                                         ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>0</B></FONT></TD>
<TD VALIGN="CENTER"
                                         ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>********</B></FONT></TD>
<TD VALIGN="CENTER"
                                         ALIGN="CENTER"><FONT FACE="courierNew" SIZE="2"><B>-</B></FONT></TD>
Sasuke Uchiha
  • 5
  • 1
  • 1
  • 5
  • If I understand your problem correctly - this should come in handy - http://stackoverflow.com/questions/10630120/selenium-webdriver-fetching-table-data – InterruptedException Nov 03 '14 at 16:14

1 Answers1

1

Get the rows from it:

List<WebElement> tableRows = table.findElements(By.xpath("tr"));

And then table cells either:

List<WebElement> tableCells= table.findElements(By.xpath("tr/td"));

OR - Loop through all tableRows in a for loop and get the cells by

for(WebElement row : tableRows) {
    List<WebElement> cells = row.findElements(By.xpath("td"));
   }

And finally you can get the value in the cell by using

for(WebElement cell : tableCells) {
    System.out.println( "Value = " + cell.getText());
}
Keith Enlow
  • 914
  • 6
  • 17
  • I'm not able to get the table's ID by using chrome's inspect element so I did what I put in my question to get the table as a webelement. How should I change the code you gave me to accommodate that? Sorry, I am new to programming, but thanks for helping me. – Sasuke Uchiha Nov 03 '14 at 16:34
  • can you show me what your table element looks like? ...
    . There is no reason that if you have an id on your table that it can't be found. Something else must be wrong.
    – Keith Enlow Nov 03 '14 at 16:37
  • Are you asking for the HTML code for the table? I'll edit my question and put it in – Sasuke Uchiha Nov 03 '14 at 16:41
  • It doesn't look like you've put an id on any of your elements anywhere. – Keith Enlow Nov 03 '14 at 16:45
  • I can't change the HTML because that's from a third party website. I was having trouble getting the webdriver to select the table without a name or ID, but then I did what's in my question to finally select it. Now that I have it selected, I don't know how to pull data from the cells of the table. Your code looks like it could work if it was modified to not need the ID of the table. – Sasuke Uchiha Nov 03 '14 at 16:54
  • Okay, well I modified my answer to try to help with your specific problem. Table in my example is your tableElement. It should work. Try it. – Keith Enlow Nov 03 '14 at 17:08
  • Use System.out.println() like I Have in my answer and you should be able to see the output of the cells. Also, you should click the check mark and vote my answer up as the correct answer. Thanks! And you're welcome! – Keith Enlow Nov 03 '14 at 17:26
  • I think your answer worked to form the List because I didn't get an error telling me that it couldn't find the element, however when I try your code to print the list, nothing is printed. It doesn't even print Value = – Sasuke Uchiha Nov 03 '14 at 17:32
  • I don't man. You could try cell.getAttribute("innerHTML"); instead of getText() and see if that works. Its hard to say because I'm not there with you. – Keith Enlow Nov 03 '14 at 17:39
  • That doesn't seem to work either. Your code was still able to make a List without giving me an error saying it can't find the elements, so my question is technically answered. I'll just keep trying different things to make it print. Thanks again. – Sasuke Uchiha Nov 03 '14 at 17:48
  • Sorry I couldn't be more help on the matter. Cheers! – Keith Enlow Nov 03 '14 at 18:48
  • I tried this String[] strarray = tableCells.toArray(new String[0]); System.out.println(strarray); and it printed [Ljava.lang.String;@3fc624 any idea why? – Sasuke Uchiha Nov 03 '14 at 19:26
  • You can't print out an array like that. You need to print out individual values. Or print out Arrays.toString(strarray) – Keith Enlow Nov 03 '14 at 19:43
  • How do I use this in ruby? – RV_Dev Dec 12 '17 at 21:34