What is the process for incorporating a mouseover event using Javascript within Jmeter?

Currently, I am creating load tests using the Jmeter tool along with the WebDriver Sampler plugin. Despite my efforts to resolve an issue with the mouseover function by implementing various solutions from platforms like Stack Overflow, none of them seem to work.

WDS.sampleResult.sampleStart()

var logowanieMenu = WDS.browser.findElement(pkg.By.id('ctl00_MainMenun0'))

logowanieMenu.mouseover()

WDS.sampleResult.sampleEnd()

java.lang.Thread.sleep(800)

Alternatively,

WDS.sampleResult.sampleStart()

var logowanieMenu = $('#ctl00_MainMenun0')

logowanieMenu.mouseover()

WDS.sampleResult.sampleEnd()

java.lang.Thread.sleep(800)

I have also experimented with a combination of logowanieMenu.hover() and logowanieMenu.focus().

In order to address this issue, I believe that importing the jQuery library into the script or creating a JavaScript mouseover event could be potential solutions.

Answer №1

It appears that the mouseover function is not defined in the WebElement class, causing your test to fail at the line where it is called.

To resolve this issue, consider utilizing the Actions class, specifically the moveToElement() function. Here is an example:

var actions = new org.openqa.selenium.interactions.Actions(WDS.browser)
actions.moveToElement(logowanieMenu).perform()

For demonstration purposes, here is sample code showcasing the functionality:

WDS.sampleResult.sampleStart()
WDS.browser.get('http://jmeter.apache.org/')
var overview = WDS.browser.findElementByLinkText('Overview')
var actions = new org.openqa.selenium.interactions.Actions(WDS.browser)
java.lang.Thread.sleep(1000)
actions.moveToElement(overview).perform()
java.lang.Thread.sleep(1000)
var license = WDS.browser.findElementByLinkText('License')
actions.moveToElement(license).perform()
java.lang.Thread.sleep(1000)
WDS.sampleResult.sampleEnd()

If you run the code, you will observe the behavior as described, with the links changing colors accordingly.

Refer to https://i.sstatic.net/wXzlP.gif

Explore The WebDriver Sampler: Your Top 10 Questions Answered for additional insights on WebDriver Sampler tips and tricks.

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

The specified file ngx-extended-pdf-viewer/assets/pdf.js cannot be found

I have integrated the ngx-extended-pdf-viewer package in my Angular application using npm to enable the display of PDF content. According to the setup instructions, I have added the following configuration in my angular.json file: "assets": [ ...

How to Generate a JSON Cookie Array?

Currently, I am in the process of leveraging jquery's json to form a cookie array. The script I have managed to put together thus far is functional except for the part pertaining to the array. Would someone be able to guide me on how to construct an a ...

Organizing dynamic arrays using ECMAScript 2015

Currently, I am manipulating and reordering an array using data from a webpage. Initially, I reordered my array of objects based on a separate "sorting array" order. The original array looked like this: [ { "domain":"www.exampleurl.com/redire ...

Creating a local storage file named .notification.localstore.json specific to Microsoft ConversationBot

I am in need of utilizing a ConversationBot to send messages to MS Teams users. The code snippet below was obtained from an example app generated by TeamsToolkit. It functions as expected, however, it relies on user IDs stored in .notification.localstore.j ...

Could someone provide some insights on how the ( !! ) operator functions?

Angular 6 has arrived and while browsing through a quick tutorial on Medium, I stumbled upon this interesting piece of code. else if (!!this.day4Name && !this.day5Name && days[date] !== this.day4Name) { this.day5Name = days[date]; ...

Retrieve specific attributes in a nested eager loading sequelize query

I have a query to fetch information about shows from a database, along with details about the venue and bands involved. However, I am only interested in retrieving the names of the bands and the venue. The current code is pulling the entire record instea ...

I can't figure out why I'm getting a NullPointerException from WebElement.isDisplayed(). Can

Currently, I am facing a challenge with checking the visibility of an element on the webpage. In my previous approach, I was utilizing wait.until(ExpectedCondition.visibilityOfElement(locator)) in my pseudo code. However, this default ExpectedCondition on ...

Navigating the landscape of European law and online payment regulations can be complex, especially when it

Currently, I am in the process of developing a website that integrates Stripe payments. Since it is based in Europe, I will be required to implement SCA 3D Secure authentication. According to the documentation provided by Stripe, it is recommended to handl ...

Utilizing shared code on RectJS components without relying on inheritance

For instance, const Shelf1 = () =>{ const mouseDown = (e) =>{ console.log("mouseclick"); } } const Shelf2 = () =>{ const mouseDown = (e) =>{ console.log("mouseclick"); } } const Shelf3 = () =>{ const m ...

Determine the dimensions of Expo's React Native Over the Air (OTA) update

Is there a method to determine the size of the required download for an OTA update before existing deployed apps (e.g. v1) retrieve it following the publication of a new managed Expo app (e.g. v2)? ...

The importance of utilizing explicit waits in Selenium

Implicit wait is a broad approach to waiting while explicit wait is more targeted towards specific operations. So, even though implicit wait can solve many problems, it's still beneficial to use explicit wait for precise control over certain actions. ...

Navigating Redirects using axios in the Browser

Is there a way to work with redirects in axios to capture the redirected URL in the browser when making an API call? I am looking to retrieve the redirected URL through a GET request. ...

Transferring data between AngularJS services situated on separate pages

I'm currently working on an example project for AngularJS involving a simple book store. I am facing a challenge where I need to pass a book ID from a home page to a service on an edit page in order to render the book details. The issue I'm encou ...

Combining two variables in AngularJS seamlessly, without explicit instruction

In the realm of Controllers resides my beloved home.js: angular.module("HomeApp", ["BaseApp"]) .controller("MainCtrl", ["$http", "$window", "BaseService", function($http, $window, BaseService) { var self = this; self.posts = BaseServ ...

What is the best way to verify a password's strength with Joi so that it includes 2 numbers, 2 special characters, 2 uppercase letters, and 2 lowercase letters?

Is there a way to achieve this using Joi? For instance: Joi.string() .required() .min(8) .max(16) .pattern(/(?=(?:.*[a-z]){2,16}).+/) .pattern(/(?=(?:.*[A-Z]){2,16}).+/) .pattern(/(?=(?:.*[0-9]){2,16}).+/) .pa ...

A step-by-step guide on setting up an event listener for dynamically generated HTML using JavaScript objects

In my JavaScript code, I am creating object instances that include HTML elements in the form of buttons. These buttons are dynamic and have words generated dynamically as well. I want these buttons to execute certain functions when clicked. The challenge I ...

What is the best way to encapsulate a child's properties within a function?

Is there a way to automate wrapping each child of an object with a function? // current code import authController from "./authController"; import appController from "./appController"; import userController from "./userController&q ...

What is the best way to utilize the oninput function in Jade?

input(type='range', id= 'inputSlider', min='0', max='255', value='50', step='1', oninput=showValue(this.value)) span#outputText 50 script. var socket = io.connect(); socket.on(& ...

Navigation bar theme toggle malfunctioning as anticipated

I'm experiencing an issue with the navbar theme change functionality. Whenever I click on the dark mode button, the theme changes for a brief moment and then reverts back to light mode. <!doctype html> <html lang="en"> <hea ...

React - Error: you have a syntax problem because there is an unexpected token <

I am working on a project using Express, pg, and react. However, I have encountered some issues with React. Here is the directory of my project index.js var express = require('express'); var server = express(); var path = require('path&ap ...