Hi
I was wondering if anyone can make my classe better I am trying to check if first radio button checked or not if not check it than go to next one.
Thanks
public class EventDetailChildNameSettingsStepDefs {
@And("event_details I Enable children settings checkbox (on|off|ON|OFF)$")
public void event_detailsEnableChildrenSettingsOnOffONOFF(String strCheck1) throws Throwable {
SimpleAction.runs(() -> {
TestBase testBase = ObjectDriver.INSTANCE.getTestBase();
GetAttribute.run(Passkey_Events.PK_Event_ChildrenSettings.chkAskForChildCountYes, "class", "ChildrenSettings");
if (strCheck1.equalsIgnoreCase("on")) {
if (!testBase.getGlobalVariable("ChildrenSettings").contains("checked")) {
Input.run(Passkey_Events.PK_Event_ChildrenSettings.chkAskForChildCountYes);
}
} else if (strCheck1.equalsIgnoreCase("off")) {
if (testBase.getGlobalVariable("ChildrenSettings").contains("checked")) {
Input.run(Passkey_Events.PK_Event_ChildrenSettings.chkAskForChildCountYes);
}
}
Input.run(Passkey_Events.PK_Event_ChildrenSettings.chkAskForChildNameYes);
Input.run(Passkey_Events.PK_Event_ChildrenSettings.chkMakeNameRequired);
Input.run(Passkey_Events.PK_Event_ChildrenSettings.chkAskForChildAgeYes);
Input.run(Passkey_Events.PK_Event_ChildrenSettings.chkMakeAgeRequired);
});
}
if first radiobutton
is checked or not if itis check the nextone if not check the radiobutton
than check the next one
Mustapha Rhouate 0 days go
Hi any help?
I was wondering if I can create datatable that will be set to ON or OFF by the user choice.
Thanks
| list | values |
| Button1 | ON |
| Button2 | OFF |
| Button3 | OFF |
Instructor
Yogesh Chawla Replied on 11/03/2020
You are using the framework methods and annotations in this class which must be getting used in your project. This very class is also achieving your objective and more over it is following your framework style of coding other wise 'if first radiobutton
is checked or not', this can be used in many ways. Check this:
If you want to check on just one RadioButton you can use the isChecked function
if(radioButton.isChecked())
{
// is checked
}
else
{
// not checked
}
and if you have a RadioGroup you can use
if (radioGroup.getCheckedRadioButtonId() == -1)
{
// no radio buttons are checked
}
else
{
// one of the radio buttons is checked
}
Instructor
Yogesh Chawla Replied on 11/03/2020
As far as data table is concerned, this is how it is made in JavaScript and jQuery:
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
</head>
<body>
<table id="example">
<thead>
<tr><th>Sites</th></tr>
</thead>
<tbody>
<tr><td>11</td></tr>
<tr><td>22</td></tr>
<tr><td>33</td></tr>
</tbody>
</table>
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script>
<script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script>
<script>
$(function(){
$("#example").dataTable();
})
</script>
</body>
</html>
Thereafter coding can be done on data table:
// For example, Simply get the sum of a column
var
table = $(
'#example'
).DataTable();
table.column( 3 ).data().sum();