Click on checkboxes based on text in another column and status of checkbox - selenium-ide

I have a table on a page with 50 check boxes and some columns, and I need to click on the ones that has a specific text on the last column. So I used this command:
//table[#id='edit-entities']/tbody/tr[td[6][contains(text(), 'New')]]/td/div/input
It worked, Selenium clicks on the first one. Now I need to know how can I make Selenium to click in the other ones.
I tried:
//table[#id='edit-entities']/tbody/tr[td[6][contains(text(), 'New')]]/td/div/input[2]
I put the index [2] in the front of the input to test if it would click on the second check box matching this condition, but it says it did not find the element.

Figured out ... the index must be the row index and not the checkbox index:
//table[#id='edit-entities']/tbody/tr[td[6][contains(text(), 'New')]][4]/td/div/input

Related

PowerApps Get Selected Item from Lookup to make a Button Visible at the Command line bar

I want a button from the command line bar to be visible or invisible depending on whether a record has been selected in the lookup field from the main form or not.
If no record has been selected, then the button should be displayed. Otherwise not.
For this problem, I want to use the Power Fx in PowerApps, but I haven't found a command yet, which shows me the content or something like that of the lookup field. Other field data types like text have worked without problems.
With Javascript, I already managed it without problems, but I would like to do it also in PowerFx if that should work.
Screenshot: https://i.stack.imgur.com/uqDJ6.png
The records come from the Table Company, where the attribute is Companyname.
Commands where I think they might work:
If([Selected Record];true;false);If(IsBlank([Selected Record]);true;false);If(IsBlankOrError([Selected Record]);true;false);If(IsEmpty([Selected Record]);true;false)
I guess there are 2 scenarios:
The Lookup form control element is a Dropdown with a Selected output property. Then your approach would work like If(IsBlankOrError(DataCardValue1.Selected),true,false)
If your form control element is a ComboBox then you could use If(CountRows(DataCardValue1.SelectedItems)>0,true,false) or the above described IsBlankOrError.

Select single row with checkbox in sap.ui.table

noobie_sapui5_developer
I am trying select single row of sap.ui.table with checkbox.
There are 2 modes for this table
Multi
Single
In multi selection mode there are checkboxes for each row and multiple rows can be selected - but I want only a single row to be selected
In single selection mode, it allows only a row to be selected - but there are no check boxes.
How to achieve a table with checkboxes with only one selectable row?
It is possible with sap.m.table, but my requirement is to make it work with sap.ui.table.
Why I wouldn't recommend doing this:
Checkboxes (selectionMode="MultiToggle") are usually used to signal the user that he's able to select no, one or more options, while radio buttons (selectionMode="Single") tell the user that he's only able to choose one option.
See: material.io, nngroup, uxplanet-radio, uxplanet-checkbox
In your case, I'd recommend using the selectionMode="Single" and either set the selectionBehavior attribute to Row, RowOnly or RowSelector (SelectionBehaviour).
As #jasbir pointed out, you could use the rowSelectionChange event in order to invoke a function that grabs the index (getSelectedIndex) of the row that was just selected. You can then call the setSelectedIndex function on the sap.ui.table.Table and pass it the grabbed index. This will remove previously selected rows and set the currently selected row as selected.
<Table id="yourTableId"
selectionMode="MultiToggle"
rowSelectionChange="onSelectionChange">
</Table>
And in the controller.
onSelectionChange: function(oEvent) {
var oYourTable = this.getView().byId("yourTableId"),
iSelectedIndex = oEvent.getSource().getSelectedIndex();
oYourTable.setSelectedIndex(iSelectedIndex);
}
Note: Since the setSelectedIndex function triggers a rowSelectionChange the above function gets triggered twice (another indicator that this solution isn't intended behaviour).
Check the SAP Fiori Guidelines for the sap.ui.table.Table for further information.
You can use rowSelectionChange event whenever a selection is changed you can unselect other rows and keep the selected one.
Hope this helps

Infopath: Rules with Multiple Selection List Box do not trigger

Im trying to implement several rules for a form, based on a selection of some multiple selection list boxes. Im customizing a form for a existing SharePoint list by clicking on "Customize Form" in SharePoint. First of all, the choice fields on the list (multiple selection) are oddly binded in InfoPath:
I cant change the variable's name "Value" and Real Estate Categories should not be a required field. (*)
On one view I have a "Business Unit Purchase" box that is a multiple selection box (choice) and there is a next button. The next button should only be availiable when a selection is made.
So I tried to the following rules for the Next Button:
Rule Type Action:
IF Value (of Business Unit Pruchase) is not blank -> Switch to next view
This works properly, but now i wanted to disable the next button when nothing is the text box was selected, because it makes it more clear to have a selection beofre ist possible to go on. So I tried this:
Rule Type Formatting:
IF Value is blank -> disable this control
This disables the button as wanted when the multiple text box has not any items selected, but after selecting one or more, nothing happens. Is there any reason why this does not work?
Normally when a selection is made, the field "value" of "Business Unit Purchase" should contain one or more strings and therefor should not be blank anymore.
A multiselect list box almost always contains one blank element entry unless it has been manually removed (e.g. via code).
Because of this, the condition Value is blank will almost always be true.
To remedy this, use the dropdown in the Condition builder's field selection dialog to set up your condition as:
All occurrences of Value are blank -> Disable this control
If you do this, the control should be enabled when one or more items are selected.

delete selected item from text item

i have got multi lined text item like gridview in my forms project. i want to select an item and click delete button and the system must delete selected index but i didnt find the perfect function. it's not bind into the database so its not complicated i just want to delete the line from the text item. i tried to find the properties of the current record, i use some of loops but it didnt find the selected item index. does it have "selected item" function like c#, java. Or do i have to create a function to find selected item. which way is the best and how could i do that.
This code may help you(I didn't get a chance to test this) :
GO_BLOCK('Gridview_BLOCK_NAME');
GO_RECORD(record_index);
DELETE_RECORD;
GO_ITEM('block.delete_button');--if you want the cursor back to delete button

I have a listbox. How do I select the 3rd item in the listbox out of many items?

I have a form with 10 listboxes on it. I also have a command button. How do I make it so that if I press the command button it will select the 3rd item of a listbox of my choosing?
You may do so by converting your 10 listboxes into a control array. If I remember correctly, you do so by specifying the same Name property and a unique, non-negative Index property for each one of the ListBox instances in your form.
Assuming you named all of your list boxes as ListBoxArr and set up the Index property so that the first listbox is 0, the second one is 1, etc. then you can write something like this
' Access the 6th list box and select the third item
' Remember, Index values are zero-based, so 0 is first item...
ListBoxArr(5).ListIndex = 2