Google places autocomplete with Selenium IDE test - firefox

I'm trying to make test in Selenium IDE (from Firefox addon) for autocomplete place (given from google places). I need type in input place name and get the first location.
Sequence for place "Rzeszów, Polska":
i.stack.imgur.com/gqRMd.png
Firstly I've tried mouseOver and Click action - elements exists but didn't make a click on autocomplete. Next I've tried two another sequences (with clickAt and KeyDown), but also didn't make a click, despite the fact that Selenium can find correct locator.
i.stack.imgur.com/F13q7.png
I was trying my solution for jQuery autocomplete -> jqueryui.com/autocomplete/ and it worked fine there.
I think, problem is connected with html structure, with bold in place name:
i.stack.imgur.com/BfLyE.png
You can test it on: jsfiddle.net/dodger/pbbhH/
My sequence in Selenium IDE (shown above) doesn't work for google places, could anyone solved this problem with autocomplete?
//Moderator: Please add photos and create links to my post and delete this line. Thanks.

To force the places autocompletion list to appear I had to send single keydown and keyup events to the input field. Like this:
selenium.focus(LOCATOR);
selenium.type(LOCATOR, ""); // clear the field
for (int i=0; i<value.length(); i++) {
String c = String.valueOf(value.charAt(i));
selenium.keyDown(LOCATOR, c.toUpperCase());
selenium.keyPress(LOCATOR, c);
selenium.keyUp(LOCATOR, c.toUpperCase());
}
Finally, to select an entry of the list, I've got it working by simulating keyboard events (since I also had no luck with mouse events).
keyDown with the arrow down key: selenium.keyDown(LOCATOR, "\u0028");
blur on the input field (optional I think): selenium.fireEvent(LOCATOR, "blur");
LOCATOR is the locator for your input field. \u0028 is the key code for arrow down (hex 28 or dec 40)
Hope this helps.

Related

UIPath Robot won't type into a text box, clear selector. Clicking separately and sending hotkeys also does not work

I've tried nearly anything, The "Type Into" activity won't print plain text into the text box let alone a held variable. The textbox element in question is the update work items comment box in the acme-test website from the Level 3 RPA developer course. I am able to type into the box manually and the robot is able to find it (the cursor moves to the centre of the text box and the program continues). I've tried quite a lot, including using a click activity and then sending the string as hotkeys.
Most probably the issue is related to your selectors. Since you are on level 3 RPA developer course I assume you are using Reframework for the task and I believe because of comprehensive error handling capabilities of this template your application just continuous with the next item instead of crashing when it can't find the element.
To solve the selector issues I usually do the following:
Use partial selectors instead of full selectors
Use wildcards for dynamic parts of your selectors (* for replacing any number of characters, ? for replacing exactly 1 character)
You can also store the page you are working on in a Uipath.Core.Browser type variable to eliminate the need of reselecting browser.
Also keep in mind that if you have used basic recorder functionality of UI path it generates full selectors.

UNbound Text Box wont save

I have a form onto which I have placed an unbound text box. This box is designed to calculate the total of 4 other bound text boxes which have simple numerical values in. I have used the expression builder in the unbound text box to set its control source property i.e. =([box1]+[box2]+[box3]+[box4])
When I first put this in it works fine. However after I close and then reopen the data base the box sits on the form saying #NAME? as if it has lost its control source. I have checked the data source after and nothing seems to be wrong. Any ideas why its happening. Its a pain as I have a button which when pressed opens a report based on the value in the unbound text box.
Try using Nz:
=Nz([box1],0)+Nz([box2],0)+Nz([box3],0)+Nz([box4],0)
Not entirely sure why it now works but I have re added the text box and the calculations into the source code and it seems to be fine. Perhaps just a glitch in my previous attempt... I used the =sum solution rather than the =Nz solution. Maybe my version of access or my data base is just fickle... thanks anyway

How to avoid PlaybackFailureException in coded UI during sending keyboard keys to Outlook Message Window?

I'm trying to send keyboard sequence ctrl+c to message field in outlook's meeting form (ControlType=Client;Name=Message) and get the PlaybackFailureException.
The element was found successful and I can send an any text there, but not keyboard keys. There are two ways that I tried:
1) using modifiers:
elements_object.SetFocus();
Keyboard.SendKeys("{A}", ModifierKeys.Control);
Keyboard.SendKeys("{C}", ModifierKeys.Control);
This way just type A and then C to the field. Action that I expect wasn't executed (selecting + copying)
2) without modifiers:
elements_object.SendKeys("{^a}");
elements_object.SendKeys("{^c}");
This way threw the exception PlaybackFailureException .
There is interesting thing: for example send of {ENTER} is work.
What am I doing wrong, guys ?
If you want to perform Ctrl+A, Use
Keyboard.SendKeys("^a");
To Perform Ctrl + C,
Keyboard.SendKeys("^c");
If you would like to pass control on which, sendkeys has to perform:
Keyboard.SendKeys(UITestControl, "^c");
Check Here to know more about SendKeys:MSDN SendKeys
Edit
I tried the below code (May be quick & dirty) and it works for me:
WinWindow outlook = new WinWindow();
outlook.SearchProperties.Add(WinWindow.PropertyNames.Name, "Untitled - Meeting ");
WinClient doc = new WinClient(outlook);
doc.SearchProperties.Add(WinWindow.PropertyNames.Name, "Document1");
WinClient msg = new WinClient(doc);
msg.SearchProperties.Add(WinWindow.PropertyNames.Name, "Message");
Keyboard.SendKeys(msg, "^a");
Keyboard.SendKeys(msg, "^c");
// I tried pasting it, it pastes same content whatever is copied.
Keyboard.SendKeys(msg, "^v");
I don't know how it exactly works, but maybe it'll be useful for someone in future. The approach is click to this field and then all shortcuts are working fine. Without clicking it doesn't work.

How to call a click on the Google Maps Marker marker in UI Automator?

In UIAutomator Viewer can see that the markers do not have anything unique except the index.
I tried to simulate a click on a specific marker in the following way:
UiObject gMap = mDevice.findObject(new UiSelector().descriptionContains("Google Map"));
UiObject marker = mDevice.findObject(gMap.getSelector().index(1));
marker.clickAndWaitForNewWindow();
But the click did not happen. How can I simulate clicking on the markers?
Don't use gMap.getSelector(). You should use childSelector to search markers inside map view
UiObject marker = mDevice.findObject(UiSelector()
.descriptionContains("Google Map")
.childSelector(UiSelector().instance(1))
)
And try to use marker.waitForExists(5000) before clicking. Usually they appear not immediately on map
Using CulebraTester and a sample map application (as shown)
which has 3 markers: the 2 red have title and snippet and the blue doesn't, you can see how the generated code differ.
mDevice.findObject(By.desc("title_of_marker1. snippet_of_marker1.").clazz("android.view.View").text(Pattern.compile("")).pkg("com.example.diego.mymapapplication")).clickAndWait(Until.newWindow(), DEFAULT_TIMEOUT);
mDevice.findObject(By.desc("title_of_marker2. snippet_of_marker2.").clazz("android.view.View").text(Pattern.compile("")).pkg("com.example.diego.mymapapplication")).clickAndWait(Until.newWindow(), DEFAULT_TIMEOUT);
mDevice.findObject(By.desc("Google Map").clazz("android.view.View").text(Pattern.compile("")).pkg("com.example.diego.mymapapplication")).clickAndWait(Until.newWindow(), DEFAULT_TIMEOUT);
the 3rd selector is too broad and ambiguous.
I guess if you add title and/or snippet you'll have no problem clicking on them.

Keyboard navigation for RadListBox with icons

I am using RadListBox to show a list of items. Each item has an icon. The requirement is jumping on the item when a the first letter of that item is pressed.
For example: It should focus on "Dock" when letter "D" is pressed
Is there any built-in feature to accomplish this>
This functionality is built into the RadListBox right out of the box.
You must have the list box focused and then type a key to select the item with the first letter matching the key that was pressed. In order to focus on the list box you can either: click with the mouse, tab to it, set focus in JS, or use the KeyboardNavigationSettings.CommandKey and KeyboardNavigationSettings.FocusKey to help aid with keyboard navigation.
Example:
RadListBox1 = new RadListBox()
RadListBox1.KeyboardNavigationSettings.CommandKey = KeyboardNavigationModifier.Alt;
RadListBox1.KeyboardNavigationSettings.FocusKey = KeyboardNavigationKey.L;
You can also use EnableMarkMatches to highlight more than one match if necessary and for typing more than one letter for selecting.
Reference: Telerik RadListBox Keyboard Navigation Demo << This has all the sample code you should need.
Seems this a Telerik bug, but i made a project, test situation and it's working.
download sample project here.
this project tested on google chrome Version 60.0.3112.113 (Official Build) (64-bit)
After run project press Alt+s or Alt+o or Alt+c
Remember change AccessKey property to change shortcut key:
RadListBox1.Items[0].AccessKey = "s";
I should say that this NOT a perfect solution.
RadListBox is a powerful ASP.NET AJAX control to display a list of items. It allows for multiple selection of items, reorder and transfer between two listboxes. Drag and drop is fully supported as well.

Resources