Press TAB and then ENTER key in Selenium WebDriver with Ruby

enter, keypress, ruby, selenium-webdriver, tabs

Solution

In Ruby user1316's code looks like

driver.action.send_keys(elementVisible, :tab).send_keys(elementVisible, :return).perform

Problem

I am doing automated testing using Selenium WebDriver with Ruby. I need to click a button. I cannot get the button element by id or css or xpath as the button is transparent. I would like to use Tab and Enter key to press the button. I can use Tab key to get the button as below: ``` @element.send_keys :tab @element --> any javascript element visible in the browser ``` But how do I use the Enter key on the button? Basically I need to achieve press Tab key and then press Enter key to click the button. I am using Selenium WebDriver `@driver = Selenium::WebDriver.for :firefox`

Original source

Related problems