Selenium error: Element is unclickable ... Another element is blocking the click, but go ahead and click

When attempting to utilize the code snippet below

return this.driver.findElement(By.css("div[class*='img']")).click();

An error occurs:

Uncaught WebDriverError: unknown error: Element is not clickable at point (525, 889). Other element would receive the click:...

Is there a way to force the click action even if the "other element" is in the way? I am working with webdriverjs.

The issue stems from the website I am testing, which employs some fancy react elements that hide the link associated with the image. Instead of directly linking an image, the entire image is masked by a transparent box that redirects users to a different page. Despite not technically clicking the image, from a user perspective, it appears to be the same action.

Previously with webdriverIO, I could achieve this using

browser.moveToObject("img");
 browser.leftClick();

However, we are transitioning away from that method. I have also attempted

this.driver.findElement(By.css("div[class*='img']"));
    return this.driver.actions().click().perform();

but it does not seem to have any effect.

While there are numerous inquiries regarding this specific error, I have not come across any that address the need to proceed with the click operation regardless.

Answer №1

After spending hours searching for a solution to a problem, finally posting a question, and then miraculously discovering the answer right after, I stumbled upon a workaround:

var mylink = this.driver.findElement(By.css("div[class*='img']"));
return this.driver.executeScript("arguments[0].click();", mylink);

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

A current issue lies in the fact that node.js is failing to update

I'm currently working on creating a functionality that involves reading a CSV file and checking if the headers are correct before proceeding. Below is the code snippet: let validHeaders = false; fs.createReadStream(path) .pipe(csv.parse({headers : ...

Attempting to create a discord bot using Selenium in Python for seamless integration

I am currently attempting to create a Discord bot using Selenium in Python. I have been working on the script to connect the bot to my discord account. Below are the required imports: from selenium import webdriver from selenium.webdriver.common.keys imp ...

Struggling to remove quotation marks from a string that was originally an array before being converted?

Here is the code snippet that I am struggling with: users = [{ "userid": "45", "name": "steve" }, { "userid": "32", "name": "john" }]; getuser = users.flatMap(user => user.userid === '32' ? user.name : []); result = getuser.toSt ...

Obtaining text from a select list using JQuery instead of retrieving the value

How can I retrieve the value from a select list using jQuery, as it seems to be returning the text within the options instead? Below is my simple code snippet: <select id="myselect"> <option selected="selected">All</option> <op ...

Is it incorrect to run the script multiple times in order for it to function properly?

After attempting to execute this script using both a while loop and a for loop, I noticed that it stops working after just one repetition. driver.find_element_by_class_name("submit").click() x = driver.find_element_by_class_name("submit" ...

The useEffect alert is triggered before the component is re-rendered

Can someone help me understand why the HP in the code below is displayed as "1" when the alert is thrown, and only set to "0" after I confirm the alert? Shouldn't the component be rerendered before the alert is thrown so that it has already been displ ...

Modifying the size of an element with D3 when hovering with the mouse

In a previous project, I created a stacked bar chart with some interesting mouseover effects. Now, I want to take it a step further by changing the size of the rectangle that the user hovers over, returning it to its original size once they move away. My ...

Why does every element appear identical in selenium?

When attempting to convert my Steam game-hours into a pandas dataframe, I am encountering an issue where all the games and hours appear identical. Is there a mistake in my code causing this problem, and if so, how can it be resolved? Output: title ...

React code is displaying as plain text and the components are not being rendered properly

My latest creation is a component named "componentRepeater" with the main purpose of displaying multiple instances of child components. The props within the "componentRepeater" include properties for the child components, the number of repeats for the chil ...

How come the values in my object remain inaccessible even after assigning values to it with navigator.geolocation.getCurrentPosition() and returning it?

After successfully assigning values to my pos object within the whereAmI function using navigator.geolocation.getCurrentPosition(), I can confirm that lat and lng are present inside the object. However, attempting to access these properties later on resu ...

Chart: Observing the Discrepancy in the Initial X-Axis Points

I'm working on incorporating multiple charts onto one page, with each chart centered and stacked one after the other. I've set a fixed width for the graph canvas. The challenge arises from the varying ranges of tick values - one chart may have a ...

the function presence_of_all_elements_located does not provide the entire list when used for web scraping using Selenium

Trying to retrieve a complete list of food names from this menu seems to be presenting a challenge. Despite the fact that there are more elements with the specified class name, only 9 items are being retrieved. Utilizing Google Developer tools, it is evi ...

"Encountering difficulties while setting up an Angular project

I am currently working on setting up an Angular project from scratch. Here are the steps I have taken so far: First, I installed Node.js Then, I proceeded to install Angular CLI using the command: npm install -g @angular/cli@latest The versions of the ...

Accessing a hyperlink in an alternative browser

Is there a way to transfer a link from one browser to another? For example, moving a link from Firefox to Chrome or from a Chrome Incognito window to a regular Chrome window. Let me provide more context. I have a webpage that refreshes every second and us ...

Issue with ReactJS: onChange event does not function properly when value is changed using jQuery

This is the reactjs code I am working with: <input name="date" id="date" value={this.state.listManage.date} onChange={this.handleForm} type="text" /> When I manually type in the input field, the onChange function works ...

What causes performance issues when utilizing mouseover events in JQuery?

var mouseX; var mouseY; $(document).mousemove( function(e) { mouseX = e.pageX; mouseY = e.pageY; }); $(".test").mouseover(function(){ $('#DivToShow').css({'top':mouseY,'left':mouseX, 'display':'block&ap ...

Invoking controller from a view using a JavaScript function in CakePHP 1.3

I am working with a map in Javascript and I need to select a rectangular zone on my Google Map without clicking anywhere. Once I have the two corner coordinates, I want to send them to my CakePHP Controller. Can anyone help me figure out how to do this? H ...

Implementing data updates in Vue.js within a Mongoose database, along with making API

I've encountered an issue where I need to update a count variable representing the votes each video receives after using GET and POST functions to retrieve and save URLs in my database. Additionally, I'm looking to disable the voting button once ...

Learn the process of dynamically adding components with data to a list of objects using React JS

In my current project, I am working with a component list that consists of MUI chips. These chips have specific props such as 'label' and 'callback', which I need to incorporate into the list when an onClick event occurs. Each chip shou ...

What is the best way to transfer data from MongoDB (utilizing the Mongous module) to a Node.js view (using the Jade templating

Hello everyone, I have a quick question regarding passing data from a model (database) into a view. I am using Express, Mongous (not Mongoose) to access MongoDB, and Jade for my views. Despite trying to use Mongoose, I have not been successful in achieving ...