Checking a check box that can be checked - selenium

To share a profile, check box is used.
There are three type of check boxes
check box which is read-only
check box which is already checked
check box which is not checked
In the above scenario, how to verify using selenium web-driver (java)
verify read-only check box is read-only
verify checking a check box whether checked or not
how to automate checking a check box when there are multiple
unchecked check box

try this code
boolean b=driver.findElement(By.name("Check Box Locator")).isEnabled();
above code returns true if checked and false if not checked....
or try this code too...
String status=driver.findElement(By.name("Check Box Locator")).getAttribute("Checked");
this string prints the attribute value whether it is checked or unckecked
based on attribute value you can prepare your report
hope this helps you

Related

Check some field before opening confirmation box in ODOO

I want to check that if some fields in the form view has been checked or not. If they have been checked then show a confirmation message and if not then a error message saying that those fields must be checked. For this functionality I have created a button which calls a specific function in the model. The button has also attribute confirm which enables the confirmation pop up box. But all the time it first opens the confirmation message and then the checking for the fields. I want to have the other way around how to achieve this. Please help.

Checkboxes get disabled by theirself

i have a problem in the application that i'm currently trying to make. In checkboxs' properties it says it's Enabled = True but after i debug and open it they all are disabled. Why did this happen? Any helps?
I think the problem here may be one of terminology. You're accessing the 'Enabled' property, but I think you may want the 'Checked' property.
The Enabled property is set by you, and controls whether the user can click on the checkbox or not. The Checked property is set either by you or by the user, and it changes whenever the user clicks on the checkbox.
Here's a picture of four checkboxes:
Check Box One is Enabled, and not Checked.
Check Box Two is Enabled, and Checked.
Check Box Three is not Enabled, and not Checked.
Check Box Four is not Enabled, and Checked.

Combo box change value event

I have product that supports multiple databases. During installation I would like to have a combo box that contains all databases it supports. Also there is a text box where user can enter connection string. I would like to have connection string template for each supported database and when combo box is changes, I would like to show in text box connection string template related to selected database.
As Yan said this is not possible to do on one screen. However you could have the dropdown on it's own page and then after clicking next work out what the user selected by testing the property which is set and populate the textbox with the correct template.

How to clear textbox value?

In my CustomUI I am trying to validate the logon service account by entering the username and password. The Test button will validate the credentials. If it is an invalid account, it will show a spawndialog with an error, and on clicking will return to the same CustomUI. While returning back the username and password textbox value should be empty. What is the best way to clear out the textbox values? I tried by setting the property of the textbox value to empty, but the installer get failed.
On the close button control of your modal dialog you can put a set property control event that sets those properties back to empty. ( {} means empty in MSI ) Be sure to get the controlevent order correct so that the properties get set before the dialog is closed.
But, I'm not sure this will work. I'm not positive that the original dialog will refresh that data correctly. There are certain limitations of MSI UI and this might be one of those cases. (I'd have to mock it up to confirm. )
If you do his this limitation, the workaround is to do a NewDialog instead of a SpawnDialog and on that dialog tell the user there is a problem and only offer them a back button to the previous dialog.

Turn off struts validation per input box based on checkbox value

I have a struts application that has a form to edit user details. I am using struts validator to validate the user input.
I have a checkbox that, when clicked, makes 'Password' and 'Confirm Password' input boxes appear.
If the checkbox box is UNchecked, I do not want the app to validate the invisible input boxes. If I check the checkbox, I then want the validator to kick it.
I have put an c:if around the to only display if the checkbox is checked.
My problem is that the Password/Confirm password validation kicks in, but is invisible.
My question is, is there a way to only validate an input box based on a checkbox value?
Not sure, but i believe you can use validWhen" validation, this validation is for such use-cases for more details refer to the official doc
validator