Executing a Mouse Event with Selenium, VBA, and JavaScript

I currently have some Webdriver (java) code that I am attempting to convert to VBA. The code snippet is as follows:

    WebElement pos1 = LiloTest.driver.findElement(By.id("autoAssocitionForm:categoryDetailCombinationId:23"));

    JavascriptLibrary jsLib = new JavascriptLibrary(); 

    jsLib.callEmbeddedSelenium(LiloTest.driver,"triggerMouseEventAt", pos1,"click", "0,0");

I am struggling to replicate the same functionality in VBA with the Selenium type library. I have experimented with the "ExecuteScript" method without much success. One of the issues I'm facing is the lack of visibility into any JavaScript while inspecting the page source for the specified element.

If anyone could offer guidance or assistance, it would be greatly welcomed.

Answer №1

After some investigation, I managed to solve the issue:

 JavaScriptTest = "document.getElementById('autoAssocitionForm:categoryDetailCombinationId:23').checked = true;"

 Set Position = bot.FindElementById("autoAssocitionForm:categoryDetailCombinationId:23")

 Position.ExecuteScript (JavaScriptTest)

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

Opacity of the color obtained from the props in a styled component

I attempted to adjust the opacity of a color passed as props. I achieved this using Sass like so: background: rgba($primary, 0.2); However, when trying to accomplish the same with styled-components, it doesn't seem to work. `background-color: rgba(${ ...

Retrieve all the values from a form with identical names using angularjs

I have a form with two text boxes, one for entering a name and the other for an email. There is also a button to add a new row with these two text boxes. I am attempting to retrieve the values of Name and Email using AngularJS, but I am new to Angular. Be ...

The fixed-top navigation bar in Bootstrap obscures the links within the #content

As a student studying software development, I am currently working on a web development project for my class. Utilizing Bootstrap, I have implemented a navbar-fixed-top and structured the body as a table-striped table with each row containing a <a href= ...

Is it important that the end date does not exceed the start date?

In my request, the end date cannot be later than the start date. For example, if the start date is 24/4/2017 and the end date is 23/4/2017, the search function should be disabled for the calendar date 23/4/2017. Only dates from 24/4/2017 onwards should be ...

Is there a way to extract values from a Selenium WebElement at a quicker pace?

In an attempt to extract values from a Selenium WebElement, I have written this test code: import java.util.List; import org.apache.commons.lang3.ObjectUtils.Null; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa. ...

Traverse nested "for of" Loops recursively in JavaScript

As I delve into learning NodeJS, I find myself grappling with the challenge of crafting a more compact and refined logic for the code block shown below. I am eager to explore the possibility of incorporating recursion or leveraging ES6 methods to enhance e ...

Setting up Redis for session store in the right way involves a few key steps

I have been attempting to configure Redis Store in the following manner: var express = require('express'); var app = express(); ....... ....... var session = require('express-session'); var redis = require("redis").createClient(); var ...

Using :contains() with find_element_by_css_selector() in Selenium Python

When working with Selenium on Python, I encountered an issue while trying to select an element: driver = webdriver.Firefox() driver.find_element_by_css_selector("td:contains('hello world')") This resulted in the following error message being di ...

Generating forms dynamically in Vue using code

I'm looking to prompt the user to specify how many points they want to create, followed by entering coordinates for each point. One approach I attempted involved using an initial text field to capture the number of points desired, and then using a lo ...

Unable to properly delete data in Express/Postgres

After developing a Kanban board using JavaScript without any frameworks on the front end, I integrated Express/Postgres on the back end. However, I am encountering an issue with the 'Delete' operation. While all other CRUD operations are functio ...

When an error occurs, initiate a new http request

I'm currently working on a function in nodeJS and express to handle REST API responses. Here's a snippet of the code I've been working on: var express = require('express') var httpRequest = require('request'); var bodyPa ...

Can Selenium grid allow for simultaneous login to multiple nodes with different login IDs?

I need assistance in logging into my Gmail account with multiple user names simultaneously using Selenium Grid (Java). I have 5 nodes and each node should use a different user name. The list of user names is stored in an Excel file. Is there anyone who c ...

What is the best method for consolidating all parameter types of an object comprised of a collection of functions?

Can you analyze this typescript code snippet for me? type params1 = {p:number} ; type params2 = {p:boolean}; type params3 = {p:string}; type res = {r:string}; const fObject = { a:(a:params1):res=>{return {r:`${a.p}`}}, b:(a:params2):res=>{return {r: ...

Eliminating the "as" keywords from the TypeScript code

I'm looking to optimize this TypeScript code by removing the unnecessary as keywords. The code includes a method called update where I'm attempting to improve the organization of sanitizing, validating, and attributing data. However, it seems tha ...

Send image data in base64 format to server using AJAX to save

My goal is to store a base64 image on a php server using the webcam-easy library (https://github.com/bensonruan/webcam-easy). I added a button to the index.html file of the demo: <button id="upload" onClick="postData()" style=" ...

When the content within a dialog element exceeds the boundaries of the dialog, it will not be displayed

Issue Struggling with creating a dialog element that includes an x button for closing the <dialog> in the upper-right corner. My initial idea was to utilize absolute positioning and transforms to achieve this functionality, but encountered a setback ...

What is the best way to determine whether to use HTTP or HTTPS based on the current URL?

I have a specific line of code in my program that sets the REST URL: this._restUrl = "http://" + this._info.host + "/app/rest/"; However, I am facing an issue when trying to implement SSL. I need help with converting this into a statement that can work w ...

Error: The index.js file could not be located within the React application being used by Express with Node

I am having an issue with setting up my own express server for a React app in production. I keep getting a 404 error for the index.js file which contains my React js script. Here is the folder structure I am working with: server.js +public | index.html | ...

Error: Unable to access the 'stateUpdate' property (a function) because it is undefined when passing data from a parent component to a child component

I seem to be encountering a problem with passing a function from the parent to child component in react js. Even after attempting to pass the value to the component as props, I keep getting a type error mentioned in the question. It's puzzling why th ...

Is there a way for me to retrieve the highlighted red value below and store it as a list?

Can anyone help me with extracting the highlighted value in red and saving it as a list? I am trying to retrieve the Memcode value from an href tag inside a p tag using BeautifulSoup. Unfortunately, I am struggling to extract this value successfully. If ...