If I understand the question correctly, you want to mock the behaviour of the "TAB" key when your application is opened by the "click" event of a button component.
The application should cycle the focus between spark components on the KeyboardEvent with the Keyboard.TAB for the keyCode property.
I believe you can simulate this by manually constructing this KeyboardEvent in the handler function of your button's click event. The event should propagate and trigger the default behavior of the TAB key.
Let me put this way, I want to remove the button, What I'm trying to do is to test the Accessibliity of hte application using the Selenium, Selenium communicates with the UI some how, I'd like to have some comands on the selenium side which can help me to Tab through the application.
1 person found this helpful
Sorry but I'm unable to help you with Selenium directly, you might have better luck by posting the question on its forums.
However, I do have one idea. It seems like selenium has some support for simulating keyboard events.
Look for the functions keyDown ( locator,keySequence ), keyPress ( locator,keySequence ) and keyUp ( locator,keySequence ) here http://release.seleniumhq.org/selenium-core/1.0/reference.html#actions
Of course, seleniums simulated-key support has some limitations for different operating systems, as evident from this post:
In any case, I would try to simulate the tab event directly in your Selenium client.
I think you will need to dispatch KEY_FOCUS_CHANGE event.
On which component should I be dispatching the KEY_FOCUS_CHANGE event on? the application or the component on which the focus was active?
Never mind, figured it,Thanks a ton Alex(Flex HarUI)!
The component that currently has focus. Try:
focusManager.getFocus().dispatchEvent(new FocusEvent(FocusEvent.KEY_FOCUS_CHANGE, ....
FWIW, focusManager has a method called getNextFocusManagerComponent(), in case you want to know where focus is going to go next.