Global Send Keys - Blue Prism - sendkeys

I am trying to use global send keys to press "Down" and then "Enter", however the element that I am trying to spy loses functionality if I use the UI Automation mode every time.
So my question is if I spy my element with the HTML mode is there still a way to use the Global Send Keys as so far it I can only see the option to use them if the UI mode is used for spying.
Any solutions would be greatly appreciated.
Thanks

Bit of incorrect information going on in this page so doing some work to steer people correctly here and then provide solution to OP's problem;
SendKeys are only utilised by the following attributes as of v6.4
UI Elements:
Button (UIA) elements
Check Box (UIA) elements
Radio Button (UIA) elements
Combo Box (UIA) elements
Edit Box (UIA) elements
Menu (UIA) elements
Menu Item (UIA) elements
List (UIA) elements
List Item (UIA) elements
Table (UIA) elements
Tab Control (UIA) elements
Tab Item (UIA) elements
Hyperlink (UIA) elements
Tree View (UIA) elements
Tree View Item (UIA) elements
Window (UIA) elements
Active Accessibility Elements:
Button (AA) elements
Combo Box (AA) elements
List Box (AA) elements
Edit (AA) elements
And lastly
Application elements (what some people call the root element)
SAP Main Windows
These are the only places you can use Send Keys.
As for Send Key events, these are for utilizing send keys typically on thin client applications like Citrix. A great explanation is posted here:
https://www.rpaforum.net/threads/global-send-keys-and-send-key-events.1587/
Also there is a data sheet on Send Keys called 'Guide to Send Keys and Send Key Events on the Blue Prism portal would recommend you read it. For the purposes of answering here to Op's various questions.
If you spy with HTML mode you can't use a HTML element to invoke Send Keys. You can use the root application sure but not the actual spied element. There is a sequence of events you could try where you use HTML/AA/similar to click the element you are targeting and then afterwards utilise either an element listed above or the root element to invoke send keys to perform the task you are looking for. In this case teh task you are trying to do in send keys is
{DOWN}
for the down arrow or
{PGDN}
for page down if you wanted instead and then
{ENTER}
for the enter function
As stated by Blue Prism and other resources unless you absolutely need to do not use Send Key Events, it is not preferred.

Yes, using a navigate stage Blue Prism allows for Global Send Keys to be utilized on elements spied in HTML mode.
This is especially useful/necessary when interacting with generatively constructed DOMs that like to mimic ractive front-end (looking at you SharePoint 2019).
Case-in-point: A dropdown that holds no values until clicked, at which point the JavaScript 'onclick' binding or shadow-DOM is activated to return the values. Thus these dropdown values are unavailable to spy/map in any consistent way, so you'd need to "navigate" and select based on Global Send Keys.

Related

While using screen reader such as NVDA, how to press Left or Right key?

While using screen reader such as NVDA, when left or right key is pressed, the screen reader reads the current or next element letter by letter.
If anybody knows how can I press left or right key to trigger the element's keypress event?
Thanks.
A screen reader has two modes: browse mode (where keyboard events are sent to the screen reader) and forms mode (where keyboard events are sent to the html element).
The default setting for most screen readers is to have automatic switching between the two modes for certain types of html elements, although you can manually switch between the two modes as well.
So the key to having keyboard events sent to your element is to use the right html element (these are elements that require keyboard focus management) or use the role for that element.
The following elements will automatically switch between browse mode (arrow key reading the next character) and forms mode (the html element handling the arrow key):
Combobox
Grid
Listbox
Menu or menu bar
Radiogroup
Tabs
Toolbar
Tree Grid
Tree View
Some of these elements have a native html element (eg, <input type='radio'>) but others require the role (eg, <div role='tablist'>).
If your component doesn't fall into one of these widgets, then you can use role="application" but I always caution about using that role. It's often misused and can make a website difficult to use for a screen reader user if the role isn't used correctly.

Radio buttons used in a rad grid in batch edit mode

I am trying to find any information about using a radio button in a rad grid in batch edit mode. I have created a template column, then added the radio button control, but it doesn't work in batch edit mode (nothing saves back to the DB). Is it even possible? I can't find anything on the Telerik site so I am suspecting its not supported. Thanks.
The Radio list is not supported in the batch editing mode. Such integration simply has not been implemented. The closest available option at this time is using a dropdown list: http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx. Generally speaking, the standard way of editing boolean fields is through a checkbox column and not a radio button list - check the Discontinued checkboxes column.
What the grid does is that it loops through the controls with JS code when cells are opened and closed and determines control types and the proper API to use (e.g., $get().control.get_value() for dropdownlists, or $get().value for standard inputs). You can try implementing similar logic in the batch editing events.
You can try to use a RadRadioButtonList with the two items declared in its markup and its client-side API (see the get_selectedIndex() and set_selectedIndex() method: https://docs.telerik.com/devtools/aspnet-ajax/controls/radiobuttonlist/client-side-programming/radiobuttonlist-object) together with the following approach of working with templates: https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/edit-mode/batch-editing/working-with-templates.
The idea is to have the radio button list in the edit template of the column and to select the correct item in it according to the newly opened cell value on the client, then fetch the selected item from the button list and put it in the grid data source.
You can find one example that you can try using as base in the following thread: https://www.telerik.com/forums/radiobuttonlist-in-gridtemplatecolumn.
Showing a radio button list in the item template is also something that is not supported, as the editing would basically happen in the "display" mode of the cell, and not in the edit mode of the cell. You could try using the server ItemDataBound event and FindControl() (see here: https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-controls-in-template-column) may let you set initial values based on the data source for the radio button lists without data binding them. Then, perhaps a hidden field or hidden checkbox can be used for the actual data binding (see the template article above). You could also try using the batch editing manager changeCellValue() method on the client-side events of the radio button list, in a fashion similar to this article: https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/edit-mode/batch-editing/how-to/editing-checkboxes.
Another approach you can consider is to use the client-side events of the radio button list and immediately upon change to call a service that will update the database. This may simplify the template handling logic (you could do this in a read-only column) but it goes against the purpose of batch editing to invoke one request with a lot of data, and you would also need to secure the service.
Another online resource to check is
https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/edit-mode/batch-editing/how-to/editing-checkboxes

Find element in desplegable list after doing browser back

I'm scraping a web with the following structure
Menu1
Submenu1
Event1
Event2
...
Submenu2
Event n
...
...
Menu2
....
Where to have access to Submenu you have to click on Menu, so as to expand the node and make submenu list visible, and to have access to Event list the same, you need to click on the corresponding submenu node.
Once you get the event, you click on it and it goes to another page. After you scrape some, you go back to the previous page and scrape the next event. The code would be as follows
browser=webdriver.Chrome()
browser.get(url)
Menu1=browser.find_element_by_xpath('some expression')
Menu1.click()
submenu=Menu1.find_elements_by_xpath('some other expression')
for sub in submenu:
event=sub.find_elements_by_xpath('expression here')
for ev in event:
event.click()
Some scraping
'Go back to previous page'
browser.execute_script("window.history.go(-1)")
After doing the first iteration when trying to do the second for Event2, I get a NoSuchElementException, basically because after going back list are not expanded and therefore not all objects are visible to keep on with the for looping.
Is there any way that suits the code to fix this? My guess is that if I click Menu1 again, all Submenu elements will be visible so that list will be once again available. Afterwards, if I click on sub then the Events list will be available as well.
Eager to read your suggestions
Thanks
So, in esence, what has come to my mind as the solution is generating several list for each menu, with the text of the node. Iterate in for loops instead of nodes, loops of the node names that are unchanging.
Then, for each node name, loop through the object until finding it, and click on that particular item.
Then repeat until you've reached all nodes.

Can not click on element via TestComplete object mapping

I need to click on a web element, within TestComplete, this element looks like this:
I outlined its boundary using heavy-black line.
The problem is, by default, an element is always clicked in its middle point, and for this element above, clicking its middle point produces no results as it does not click this plus sign.
Within TestComplete, this element can not be broken further down into smaller elements.
I can use Selenium in JavaScript to click it, but is there is an other way?
Thanks
Try using x and y coordinates with the Click method.
SmartBear Click Action
I needed to click a button on my website but TestComplete was only able to identify the parent object which had 3 buttons in it. I was able to use x,y coordinates to press the 3 different buttons in parent object.
Record a script where you click the button and look at the function created to get the coordinates you need.

How can I select always the last radio button?

I have a verification page to test by selenium webdriver automation. On the verification page there are always three questions.
But those questions are selected from a pool of questions and so for a single user different questions might appear every separate time he comes to verification page.
So say there are 20 questions in my pool and there are five options (radio answers) for each question, so there are 100 separate radio buttons and each has its separate id/name in DOM.
I am unable to automate this piece of the webpage.
In order to proceed with my testing, I need to always select the last radio button for each of the three questions.
The last radio always contains either "None" or "never" in the label text and radio text label is clickable.
Also the name locator always starts with "1402248" for each radio button.
I am using Page object model in my projet.
Can someone help me to understand how can I identify each radio webelement?
I am using this:
#FindBy (xpath = "//*[#class='radio']//a[contains(text(),'never') or contains(text(),'None')]")
protected WebElement oVerifyIdentityFirstAnswer;
This CSS selector should find all radio buttons that are last of their type inside a parent element
driver.findElements(By.cssSelector("input[type='radio']:last-of-type"))
If your radio buttons are all encapsuled individually, move the last-of-type to that container element:
driver.findElements(By.cssSelector("a:last-of-type" > input[type='radio']))
This returns a list of WebElement, which you can iterate over and click every entry. I wouldn't use the #FindBy annotation by the way, since it often leads to staleness exceptions.
Try changing your Xpath to:
xpath = "//*[#class='radio']//a[contains(text(),'never') or contains(text(),'None')][last()]"