What is the best way to trigger a double click on a missing ng-dblclick selector using Webdriver?

I am facing an issue with a double-click control in an application using Angular. I came across an example on the Angular page demonstrating its implementation, but I'm unable to successfully double click on the example control.

You can view the example page here, along with its output.

The button at the bottom implements the control I need to interact with: ng-dblclick= getdetails()

I have attempted executing the JavaScript directly and using XPath actions, but to no avail.

IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
js.ExecuteScript("getdetails()");

new Actions(driver).DoubleClick(driver.FindElement(By.XPath("/html/body/div/input"))).Perform();

Any suggestions on what steps I can take next?

Thank you for your assistance.

Answer №1

Give these a shot

Try this out - new Actions(driver).moveToElement(driver.findElement(By.xpath("/html/body/div/input")).doubleClick().build().perform();

Alternatively, you can try

WebElement element= driver.findElement(By.xpath("/html/body/div/input"));
((JavascriptExecutor)driver).executeScript("arguments[0].dblclick();", element);

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is there a jade plug-in available that enables manipulation using syntax similar to jQuery?

If I have a list of li elements and I want to use JavaScript to find an element with class X and modify some of its attributes, I know it can be done with regular JavaScript, but I'm unsure of how to select existing elements and manipulate them. Is th ...

Looking to update the background color of a div every 3 seconds?

Every 3 seconds, I need to change the background color of each div. To do this, I attempted to modify the values in the color array every 3 seconds. For example, the value at index 0 (which is "red") would move to index 1, then the value at index 1 would ...

JavaScript encounters an error when trying to create a MarkLogic instance with an array

[javascript] XDMP-CAST: (err:FORG0001) xs:string#1(.) -- Invalid cast: `json:object(<json:object xmlns:xs="http://www.w3.org/2001/XMLSchema" ` xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>) cast as xs:string Stack Tr ...

Developing an interactive form for instant price calculations

I'm currently tackling a project that involves developing an order form capable of computing the price of a door in real-time. However, I am having trouble deciding on the best approach to take. The form will include the following inputs: Frame (Dr ...

Recursively removing an item in React components

There is an array containing nested objects that I am working with. My goal is to successfully remove the specific element from this array. Interestingly, when I attempt to delete a non-nested element, everything works fine. However, when I try to remove a ...

Guide to executing two child processes sequentially in Node JS

I am working on two processes within a function: one generates a JSON file from an audio while the other normalizes the generated JSON file. However, I'm facing an issue where only one of the processes runs at a time - when the first one runs, the se ...

ASP.NET MVC - AjaxContext is a powerful feature provided by the

I recently attempted to delve into the AjaxContext utilized by ASP.NET-MVC in scenarios such as Ajax Actionlinks and their clientside functions like onSuccess and onComplete. However, I must admit that I found it quite confusing... Is there any documentati ...

issue with Knex query output when integrated with Express.js

Below is the Knex raw SQL query that I have written. knex.raw("select group_concat(details_odishagovtjobdetails.more_info) as more_info,\ scrap_odishagovtjobs.start_date,scrap_odishagovtjobs.last_date,scrap_odishagovtjobs.post_name,\ ...

The click-handler method in VueJS Paginate Component fails to activate

I'm currently working on a Vue Component code that involves pagination for a list. The pagination seems to be working fine, except for the issue I encounter when trying to navigate to the next page, which in this case is page 2. I've added a cons ...

Make sure that JSON.stringify is set to automatically encode the forward slash character as `/`

In my current project, I am developing a service using nodejs to replace an old system written in .NET. This new service exposes a JSON API, and one of the API calls returns a date. In the Microsoft date format for JSON, the timestamp is represented as 159 ...

How can I connect HTML and JavaScript to get the clicker functioning?

While the HTML and javascript work flawlessly on jsfiddle where I initially created this project, I'm encountering a problem with Google Drive's hosting. The HTML displays correctly but there is no interaction happening with the javascript. Belo ...

Troubleshooting: AngularJS route provider fails to load templateUrl

Currently, I am diving into the world of AngularJS and as I grasp new concepts, I am eagerly trying to implement them. My current focus lies on understanding the routeProvider functionality. Despite my efforts to include what I have learned, for some reas ...

Error: The `gatsby require.resolve` function cannot locate the specified module when attempting

Currently, I am referring to the tutorial at and have already set up my gatsby-node.js file. Here is how my current directory structure looks like: public src -pages -templates --program_group.js static gatsby-config.js gatsby-node.js In my gatsby-node. ...

Avoid or alter the alert stating that your modifications may not be saved

I am faced with the challenge of automatically logging a user out of an application after a period of inactivity. The issue arises when attempting to log the user out, as the browser triggers a 'Are you sure you want to leave' prompt when change ...

The `pubnub removeListener` function does not get triggered when the `useEffect` hook

Operating a single chat works perfectly; however, upon entering and exiting a chat screen before re-entering it, double messaging occurs, and the listener remains active despite being placed in the return of useEffect. I attempted the solution provided in ...

Tips for extracting the translated content from Google Translator through Selenium?

My attempts to extract Google Translator text using Selenium have been unsuccessful. Here is the code I tried: result=driver.findElement(By.xpath("//body/div[@id='result_box']/span")); I also experimented with different variations: 1.result=dr ...

String variable representing the name of a React element

As I was reviewing the source code of a React UI library, I stumbled upon an interesting code pattern that I will simplify here: function Test() { let Button = "button"; // ... return <Button>Click me</Button>; } I'm curious about ...

Trimming content within an editable div in JavaScript: A guide

I am working on an editable div feature where users can input text for comments. My goal is to eliminate any unnecessary spaces before and after the text. For example, if a user types: "&nbsp;&nbsp;Hello&nbsp;world&nbsp;&nbsp;&nbsp ...

How to use AngularJS to parse JSON containing backslashes

Here is the JSON data stored in $scope.projectData: [{ "\"Space\"": "\"L1 (1 floor)\"", "\"Subject\"": "\"Corridor Distance\"", "\"Label\"": "\"Corridor Distance\"", "\"Color&bso ...

Determine the true size of a hidden element that was dynamically generated

I've designed a div element that initially displays only 180 characters, hiding the rest of the content. When a user clicks on the 'viewmore..' link within this partially hidden div, all the content becomes visible and a 'showless...&a ...