I have a select dropdown for time with the current time + 1/2 hour pre-selected (so changes frequently) by the application server (rails).
How can I arrow-down 6 times (the increments are half hours) to pick the value currently selected plus 3 hours?
I've tried using sendKeys
but can see any way to pass 'downArrow'
I've tried keyPress
with a value of \\40
but that didn't do anything (no error).
I can't used a fixed index as the preselected time on the dropdown is frequently changing.
The dropdown always has the same number of elements - about 48.
I've tried using the deprecated keyDown()
but that didn't seem to work (though no error, just no change).
I'm also wondering if I might be able to somehow find and store the current option index (as a variable) from the existing page and then use that +3 to 'reselect' the option I want?
This would start with
storeElementIndex
//select[@id='reservation_end_time']/option[@selected='selected']
current_time_index
and then have
select
id=reservation_end_time
index=${current_time_index}+4
but I get [error] Illegal Index: 25+4
I've also tried:
store
${current_time_index}+4
new_time
with
storeElementIndex
//select[@id='reservation_end_time']/option[@selected='selected']
current_time_index
select
id=reservation_end_time
index=${new_time}
but I get the same error.