What I'm trying to do: Open a dropdown containing a list of states on a web page, and select a value in that dropdown which matches the state value read in from an excel file, stored in a Data input in the Start stage.
I have a collection called State Mappings; For initial values there are two columns. State, which has the abbreviated state text (i.e; PA)
and Navigation, which has the sendkeys value for that specific state in the dropdown menu (i.e; {DOWN 2}{ENTER}). I do this for all 50 states.
I have a navigate step called Select State with two actions. The first is a Click Centre, to open up the dropdown menu on the page. The second is a Global Send Keys.
For this step, the problem I'm having is I can't figure out how to write the expression such that it uses the appropriate sendkeys as the value.
For example, I want it to use [State Mappings.Navigation] where [Data.State] = [State Mappings.State]
In other words, I have the states mapped to the appropriate sendkey values in a collection but can't figure out how to pull out that value (State Mappings.Navigation) from the collection using Data.State as a lookup key.
For the record, I'm aware of Select Item but due to some application limitations it will not work in this case so Sendkeys is a must.
Well, it looks like you're looking for an action to filter collection.
To do that use:
Object: Utility - Collection Manipulation
Action: Filter Collection
Input:
Collection in: [State Mappings]
Filter: "[State] = '" & [Data.State] & "'"
Output:
Collection out: [Whatever you want]
the result of the action should be collection with 1 row, where in "State column" you will have desired state, and in "Navigation", you'll have corresponding field.
If you'll have issues with that, then it probably comes from input filter. The syntax is:
[Field] = 'Value'
the supplied code uses Datatable.select method. You can read more about it on MSDN network.