battleship battleship - 1 year ago 144
Ruby Question

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.

Answer Source
#@example Double click an element

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

Code shamelessly copied from the documentation :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download