Cucumber step to select auto suggested google map search result

Problem

You have a location search in your application that uses google maps auto suggest, and you want to be able to select the first item, so that it can be used in your cucumber tests.

Solution

You can create a step as in the code below, and put it in one of your cucumber step definitions:

and then you can call this step from any other step in your cucumber tests by: