I am not able to list out the boxes which are checked and unchecked.the checkboxes are placed in the div tags. And only class name is generated dynamically when the is clicked.

Unchecked checkboxes:

<div class="jqx-checkbox-default jqx-checkbox-default-p_p_id=TeamManagement_WAR_TeamManagementportlet&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_TeamManagement_WAR_TeamManagementportlet_artifactTypeLabel=0&_TeamManagement_WAR_TeamManagementportlet_jspPage=%2Fhtml%2Fteam%2Fassign_user.jsp&_TeamManagement_WAR_TeamManagementportlet_token=ORGANIZATION&_TeamManagement_WAR_TeamManagementportlet_screenMode=maximized&_TeamManagement_WAR_TeamManagementportlet_artifactId=0&_TeamManage...l-p_p_id=TeamManagement_WAR_TeamManagementportlet&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_TeamManagement_WAR_TeamManagementportlet_artifactTypeLabel=0&_TeamManagement_WAR_TeamManagementportlet_jspPage=%2Fhtml%2Fteam%2Fassign_user.jsp&_TeamManagement_WAR_TeamManagementportlet_token=ORGANIZATION&_TeamManagement_WAR_TeamManagementportlet_screenMode=maximized&_TeamManagement_WAR_TeamManagementportlet_artifactId=0&_TeamManagement_WAR_TeamManagementportlet_teamId=0">
<div style="width: 13px; height: 13px;">
<span class="" style="width: 13px; height: 13px;"></span>
</div>

Checked checkboxes:

<div class="jqx-checkbox-default jqx-checkbox-default-p_p_id=TeamManagement_WAR_TeamManagementportlet&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_TeamManagement_WAR_TeamManagementportlet_artifactTypeLabel=0&_TeamManagement_WAR_TeamManagementportlet_jspPage=%2Fhtml%2Fteam%2Fassign_user.jsp&_TeamManagement_WAR_TeamManagementportlet_token=ORGANIZATION&_TeamManagement_WAR_TeamManagementportlet_screenMode=maximized&_TeamManagement_WAR_TeamManagementportlet_artifactId=0&_TeamManagement_WAR_TeamManagementportlet_teamId=0 jqx-fill-state-normal jqx-fill-state-normal-p_p_id=TeamManagement_WAR_TeamManagementportlet&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_TeamManagement_WAR_TeamManagementportlet_artifactTypeLabel=0&_TeamManageme`nt_WAR_TeamManagementportlet_jspPage=%2Fhtml%2Fteam%2Fassign_user.jsp&_TeamManagement_WAR_TeamManagementportlet_token=ORGANIZATION&_TeamManagement_WAR_TeamManagementportlet_screenMode=maximized&_TeamManagement_WAR_TeamManagementportlet_artifactId=0&_TeamManagement_WAR_TeamManagementportlet_teamId=0 jqx-rc-all jqx-rc-all-p_p_id=TeamManagement_WAR_TeamManagementportlet&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_TeamManagement_WAR_TeamManagementportlet_artifactTypeLabel=0&_TeamManagement_WAR_TeamManagementportlet_jspPage=%2Fhtml%2Fteam%2Fassign_user.jsp&_TeamManagement_WAR_TeamManagementportlet_token=ORGANIZATION&_TeamManagement_WAR_TeamManagementportlet_screenMode=maximized&_TeamManagement_WAR_TeamManagementportlet_artifactId=0&_TeamManagement_WAR_TeamManagementportlet_teamId=0">
<div style="width: 13px; height: 13px;">
<span class="jqx-checkbox-check-checked jqx-checkbox-check-checked-p_p_id=TeamManagement_WAR_TeamManagementportlet&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_TeamManagement_WAR_TeamManagementportlet_artifactTypeLabel=0&_TeamManagement_WAR_TeamManagementportlet_jspPage=%2Fhtml%2Fteam%2Fassign_user.jsp&_TeamManagement_WAR_TeamManagementportlet_token=ORGANIZATION&_TeamManagement_WAR_TeamManagementportlet_screenMode=maximized&_TeamManagement_WAR_TeamManagementportlet_artifactId=0&_TeamManagement_WAR_TeamManagementportlet_teamId=0" style="width: 13px; height: 13px;"></span>
</div>

The code:

//Checked element is present in this div
WebElement weChecked=.findElement(By.xpath("//div[3]/div[3]/div/div[5]/div/div/div[1]/div")); 
//Unchecked element is present in this div
WebElement weUnchecked=.findElement(By.xpath("//div[3]/div[3]/div/div/div[1]/div"));

//This the following code where I am checking
WebElement weUnchecked=.findElement(By.xpath("//div[3]/div[3]/div/div/div[1]/div"));
if(weUnchecked.isSelected())
{
    System.out.println("Selected");
}
else
{
    System.out.println("Not Selected");
}
//WebElement weChecked=.findElement(By.xpath("//div[3]/div[3]/div/div[5]/div[1]/div"));
WebElement weChecked=.findElement(By.xpath("//div[3]/div[3]/div/div[5]/div/div/div[1]/div"));
if(weChecked.isSelected())
{
    System.out.println("Selected");
}
else
{
    System.out.println("Not Selected");
}



Source link https://sqa.stackexchange.com/questions/20152/check-box-check-and--using---driver

LEAVE A REPLY

Please enter your comment!
Please enter your name here