How to write selenium java code for doubleClick()
on a record using web driver?
I have displayed some records in the body part. Once I clicked on a record we should get a popup window to update it.
Please suggest how to write Selenium Java code using web driver.
I have tried following code:
Actions action = new Actions(driver);
action.moveToElement(driver.findElement(By.xpath("//table/tbody/tr[2]/td/div/div/table/tbody/tr[10]/td[1]"))).doubleClick().build().perform();
Before getting started, download the Selenium Server Standalone package. This package is a jar file, which includes the Hub, WebDriver, and legacy RC that is needed to run the Grid. To get started with Selenium Grid, it is essential to have Java already installed, and set up the environment variables.
To install Selenium Grid, you only need to download the Selenium Server jar file – the same file used in running Selenium RC tests. To run test scripts on the Grid, you should use the DesiredCapabilities and the RemoteWebDriver objects.
We can perform double click on elements in Selenium with the help of Actions class. In order to perform the double click action we will use moveToElement() method, then use doubleClick() method.
Actions action = new Actions(driver);
action.moveToElement(driver.findElement(By.xpath("//table/tbody/tr[2]/td/div/div/table/tbody/tr[10]/td[1]"))).doubleClick().perform();
This code works!!!
Try this code:
Actions action = new Actions(driver);
WebElement btnElement=driver.findElement("Locator of element"));
action.doubleClick(btnElement).build().perform();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With