0

I have application which uses grid to display the details. using selenium web driver how can I access the data present in the grid.Following is the html code

<div id="contenttable_TeamManagement_WAR_TeamManagementportlet_teamGrid" height="100%" style="overflow: hidden; position: relative; width: 1225.3px; margin-left: 0px; top: 0px;">
<div id="contenttable_TeamManagement_WAR_TeamManagementportlet_teamGrid" height="100%" style="overflow: hidden; position: relative; width: 1225.3px; margin-left: 0px; top: 0px;">
<div id="row0_TeamManagement_WAR_TeamManagementportlet_teamGrid" style="position: relative; height: 28px;" role="row">
<div id="row1_TeamManagement_WAR_TeamManagementportlet_teamGrid" style="position: relative; height: 28px;" role="row">
<div id="row2_TeamManagement_WAR_TeamManagementportlet_teamGrid" style="position: relative; height: 28px;" role="row">
<div id="row3_TeamManagement_WAR_TeamManagementportlet_teamGrid" style="position: relative; height: 28px;" role="row">
<div id="row4_TeamManagement_WAR_TeamManagementportlet_teamGrid" style="position: relative; height: 25px;" role="row">
<div id="row5_TeamManagement_WAR_TeamManagementportlet_teamGrid" style="position: relative; height: 25px;" role="row">
<div id="row6_TeamManagement_WAR_TeamManagementportlet_teamGrid" style="position: relative; height: 25px;" role="row">
<div id="row7_TeamManagement_WAR_TeamManagementportlet_teamGrid" style="position: relative; height: 25px;" role="row">
<div id="row8_TeamManagement_WAR_TeamManagementportlet_teamGrid" style="position: relative; height: 25px;" role="row">
<div id="row9_TeamManagement_WAR_TeamManagementportlet_teamGrid" style="position: relative; height: 25px;" role="row">
</div> 

My code:

WebDriver driver= new FirefoxDriver(); 
driver.get(Configuration.HelpGuideHomePage.baseURL);
AppFunctions.authorizedUserLogin(driver, TestData.sEmailAddress, TestData.sPassword); 
Thread.sleep(3000); 
AppFunctions.clickTeam(driver); 
Thread.sleep(3000); //click on check boxes WebElement  
element=driver.findElement(By.xpath("//div[@class='jqx-checkbox-default jqx-fill-state-normal jqx-rc-all']")); 
element.click(); 

closed as unclear what you're asking by Peter M., Bharat Mane, Kate Paulk, Michael Durrant, Bookeater Jul 18 '16 at 18:50

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    What have you already tried? Are you getting an error? I think people will need more background to assist you in this case. – ECiurleo Jun 14 '16 at 8:56
  • 1
    Add the code you have so far. Also, I don't see any data in the DIV elements? – FDM Jun 14 '16 at 9:48
  • <div class="jqx-grid-cell jqx-item jqx-grid-cell-wrap jqx-grid-cell-alt" style="left: 30px; z-index: 792; width:703.2999996px;" role="gridcell"> <div style="overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: 5px;">Basic Temp-Scenario Model Team</div> </div> – Mallika Jun 14 '16 at 11:27
  • Basic Temp-Scenario Model Team....This is data which is present in second row of the grid – Mallika Jun 14 '16 at 11:28
  • I have to access this data using selenium web driver.WebDriver driver= new FirefoxDriver(); driver.get(Configuration.HelpGuideHomePage.baseURL); AppFunctions.authorizedUserLogin(driver, TestData.sEmailAddress, TestData.sPassword); Thread.sleep(3000); AppFunctions.clickTeam(driver); Thread.sleep(3000); //click on check boxes WebElement element=driver.findElement(By.xpath("//div[@class='jqx-checkbox-default jqx-fill-state-normal jqx-rc-all']")); element.click(); – Mallika Jun 14 '16 at 11:30
0

To get access to the text of an element you use:

WebElement element = driver.findElement(By.id("row0_TeamManagement_WAR_TeamManagementportlet_teamGrid"));
String elementText = element.getText();
System.out.println(elementText);

Not the answer you're looking for? Browse other questions tagged or ask your own question.