battleship
battleship

Reputation: 353

how to double-click on a cell in table with Selenium Ruby Webdriver

I'm trying to use below codes to double-click on a cell in a table in my web application (I tried to do Click two times with the hope that they are equal to double-click). However, the cell is not clicked at all, but I expect that after double-clicking on the cell, the text field will be displayed for me to edit info of that cell.

@driver.find_element(:xpath => "//table[@id='gridabc']//tr[1]/td[9]").click
@driver.find_element(:xpath => "//table[@id='gridabc']//tr[1]/td[9]").click

I'm using Selenium Ruby Webdriver. Please help guide me a way to resolve this. Thanks much.

Upvotes: 1

Views: 3972

Answers (1)

Anand Shah
Anand Shah

Reputation: 14913

#@example Double click an element

el = driver.find_element(:id, "some_id")
driver.action.double_click(el).perform

Code shamelessly copied from the documentation :)

Upvotes: 8

Related Questions