How to find and delete a specific record in table/grid using Selenium - selenium-rc

Assume that, a page contains a table of records (created dynamically) with Delete, Edit and View options (for each row/record). Now i want to find a specific record with name/id and delete that record. Is this possible in Selenium?
Help me to resolve this! Thanks in Advance.

Sure, we do this all the time in our tests. You need to write an element locator that finds the row you want and identifies the appropriate button, then just Selenium.Click(...) on it. The exact locator value will depend on your application, but it will probably be something like xpath=//path/to/table/tr[td[pos() = 1 AND text() = 'My Name']]/td/button[#value='Delete']. In other words, "the button with the value 'Delete' in the row that has 'My Name' in its first cell in the table".

Related

how to multiply two fields in a form in oracle APEX

everyone. I am making accounting program in oracle APEX. I need to multiply two fields in a form and to save the result in a third field. I searched for that in youtube and here in stackoverflow but did not find anything aprropriate. Can you help me?
Dynamic action is a simple option; create it on both items (so that it fires when any item's contents has changed). What will it do? Set value of the resulting item.
Action: set value
set type: PL/SQL expression
expression: :P1_VAL1 * :P1_VAL2
items to submit: P1_VAL1, P1_VAL2
affected element: item, P1_RESULT
That's all.

Table Extraction in UIPath if table has images

I am trying to extract the Table which has the following format
When I want to extract i should have either put some character on place up icon or i dont want that either the case is fine..
But UIPath brings this way.. 78,59,237806 all as one text which is misleading.. How to resolve this issue..
Thanks
Take a look at the Find Children activity. You can specify an item via selector (the table) and use Find Children to return a collection of type UiElement.
So set the filter to extract the "<webctrl tag='tr' />" which will effectively give you a collection of the rows.
Use a For Each to iterate through each UiElement you got from the first Find Children activity, and use that element to run another Find Children. In this case, set the filter to extract the elements with a class of "mid-wrap". This gives you a collection of the elements in the row which match that requirement, and this will exclude the data-up value, since that's a different class.
You can then loop over this collection to get the innertext attribute, which will give you the actual values you're looking for each cell in the row. Use something like Add Data Row to add the values to a datatable, and let the For Each run over the next row in the collection.

GWT (smartgwt) grid sort selected records top

I have a grid where the user can select records via checkbox in front of every record. Now I have a requirement to sort the records based on their selection, so that all selected records should be placed top, followed by the not selected ones.
Is there any standard function to achieve this? As an alternative I thought of saving the selection state as an attribute on every record and sort based on the attribute.
The code for the column is:
gridRealmDt.setSelectionType(SelectionStyle.SIMPLE);
gridRealmDt.setSelectionAppearance(SelectionAppearance.CHECKBOX);
I try to describe the code I use as the affected code is deeply nested in our own framework classes.
gridRealmDt is a subclass of smartgwt ListGrid. In my Dialog a create an instance of the grid which creates an instance of a database bound datasource. When the dialog is loaded the records are fetched from the database and after that a registered an dataArrivedHandler where I select the records which match records from another table.
I tried to place the selection attribute in an extra field and use that for sortig before my other sort criteria, but this does not work. Here is the code for the field I am using.
ListGridField txtSelected = new ListGridField(SELECTED, "");
txtSelected.setHidden(true);
txtSelected.setSortByDisplayField(true);
txtSelected.setCanSortClientOnly(true);
When I do not set the canSortClientOnly property the order by is sent to my database resulting in an error, as the table does not contain that field, so I set the property. Now I get following error
Removing field from the sort Specifier array because it specifies canSort Client Only: true and all data is not yet client-side.
I also tried to use a sortNormilizer on the Name field which is my main sort criteria, but the normalizer is called before the selection value is set to the record.
record.setAttribute(CARealmDS.SELECTED,selected ? "a" : "b");
I also cannnot find a way to call the normalizer when selection changes.
Currently we are using Smart GWT Version 6.0p.
I don't think there is any standard function. Just use grid store update. Place checked items first.

How to make select list and input text field read only for preventing editing

I am developing an oracle APEX application.
I created the form with master details form. How to make select list and input field to read only on tabular form (Add Row Section) when the status value is selected "Closed" or "Cancelled".
I have searched on stackoverflow but I could not find any related question about that.
Please give me idea about that ? Thank you..
Add a classic report to the page with the same columns. Render the tabular form when the status is not close or cancelled, and render the classic report when it is by using the condition on both regions.
Probably half a dozen ways to do this.
Add column in your sql (that isn't displayed to user) that calculates literal value of 'readonly' or null, depending on your status column value. Give it a column alias of 'readonly'
CASE status IN ('Closed','Cancelled') THEN 'readonly' END AS readonly_col
Edit your Status column and add to 'Element CSS Classes' : #READONLY_COL#
(hash tag surrounding your column alias)
For LOV/Select List, here is a simple solution for you
// disable:
$('#P123_ITEM_CNT').attr('readonly', true);
$('#P123_ITEM_CNT').css('pointer-events','none');
$('#P123_ITEM_CNT').css('opacity','.5');
$('#P123_ITEM_CNT').off('keydown');
//enable:
$('#P123_ITEM_CNT').attr('readonly', false);
$('#P123_ITEM_CNT').css('pointer-events','');
$('#P123_ITEM_CNT').css('opacity','inherit');
$("#P123_ITEM_CNT").on('keydown');

Passing more than 3 items in a reports column link

I have a report that is listing students and I want a column to edit a student. I've done so by following this answer:
How do you add an edit button to each row in a report in Oracle APEX?
However, I can only seem to pass 3 items and there's no option to add more. I took a screenshot to explain more:
I need to pass 8 values, how can I do that?
Thanks!
Normally, for this you would only pass the Primary Key columns (here looks like #RECORD_NUMBER# only). The page that you send the person to would then load the form based on the primary key lookup only. If multiple users were using this application, you would want the edit form to always retrieve the current values of the database, not what happened to be on the screen when a particular person ran a certain report.
Change the Target type to URL.
Apex will format what to already have into a URL text field which magically appears between Tem3 and Page Checksum.
All you need to do is to add your new items and values in the appropriate places in the URL.
I found a workaround, at least it was useful to my scenario.
I have an IR page, query returns 4 columns, lets say: ID, DESCRIPTION, SOME_NUMBER,SOME_NUMBER2.
ID NUMBER(9), DESCRIPTION VARCHAR2(30), SOME_NUMBER NUMBER(1), SOME_NUMBER2 NUMBER(3).
What I did was, to setup items this way:
P11_ITEM1-->#ID#
P11_ITEM2-->#DESCRIPTION#
P11_ITEM3-->#SOME_NUMBER##SOME_NUMBER2#
Previous data have been sent to page 11.
In page 11, all items are display only items.
And P11_ITEM3 actually received two concatenated values.
For example, the calling page has columns SOME_NUMER=4 and SOME_NUMBER2=150
so, in pag1 11, P11_ITEM3 shows 4150
In page 11 I created a Before Footer process (pl/sql expression)
to set up new items, for example P11_N1 as source SUBSTR(P11_ITEM3,1,1)
and item P11_N2 as source SUBSTR(P11_ITEM3,2,3)
So, I had those items with corresponding values from the calling IR page.
The reason I did not pass the primary key only for new lookup access, is because i do not want to stress database performing new queries since all data are already loaded into page items. I've been an oracle DBA for twenty years and I know there is no need to re execute queries if you already have the information somewhere else.
These workarounds are not very useful for a product that bills itself as a RAD tool.
Just include a single quoted word in the select statement (Select col1, 'Randomword', col2 from table 1;)
Then define that column as a link and bingo! More items than 3 to select.

Resources