The specified element at coordinates (x,y) could not be found: solutions for clicking on a series of WebElements individually

Currently, I am tasked with a project that involves taking user input, scraping data from TripAdvisor.it based on that input, storing it in a database, and using machine learning to rearrange the data for future requests. This process aims to offer users choices tailored to their past behavior.

I am facing challenges specifically in the web-scraping phase as I encounter an error stating "Unknown Error: Element is not clickable at point (x,y);..." while trying to click on attractions on the website to save relevant data to my database.

In attempting to resolve this issue, I have explored various solutions such as implementing explicit waits and methods to ensure JavaScript has loaded completely on the webpage. However, the problem persists despite these efforts.

  1. Using Thread.sleep(1000) to force a wait
  2. Implementing a script to check if JavaScript has fully loaded
  3. Applying ExpectedCondition .visibilityOf(WebElement elem) instead of .elementToBeClickable(WebElement elem)

The code snippet causing the exception is as follows:

...
    By locator = By.xpath("//a[contains(@class, 'attractions-attraction-overview-main-TopPOIs__name')]");
    
    int numberOfElementsFound = getNumberOfElementsFound(driver, locator);
    
    for (int pos = 0; pos < numberOfElementsFound; pos++) {
        
        WebDriverWait wait = new WebDriverWait(driver, 10);
        wait.until(ExpectedConditions.elementToBeClickable(getElementWithIndex(driver, locator, pos))).click();
        ...
    }

The full error message reads:

org.openqa.selenium.WebDriverException: unknown error: Element ... is not clickable at point (360, 14). Other element would receive the click: ...

If you want to view the actual webpage causing the issue, please visit this link.

Ultimately, I suspect that incomplete JavaScript loading is the root cause of this problem. This assumption is based on my observation that the specific tag "ui_column wrap_column responsive_inline_hidden label_column" cannot be located on the page.

What steps should I take to rectify this error?

Answer №1

One common reason for encountering the Error: Other element would receive the click message is due to new elements being added to the screen.

It seems likely that a dropdown from the top navigation bar is triggering an overlay, obstructing the area you are attempting to click.

Upon hovering over "Firenze" in the top nav, it becomes evident that the dropdown covers part of the "Gite di un giorno" image. If the automation mistakenly detects the cursor over "Firenze" upon page load, the dropdown will appear and be clicked instead of the intended image, resulting in the error.

To address this issue, consider implementing a "clickOut" method before clicking on any links. This method essentially involves clicking on the <body> tag, effectively repositioning the cursor and causing any dropdowns to disappear.

While this solution may seem unlikely, it has proven effective in resolving similar issues during test development.

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

Verify the length of an array within an object using JavaScript

I am facing a problem with an object. Here is what it looks like: const array = { "entities": [ { "annexes": [ { "buildingUniqueIds": [] }, { ...

Having trouble with the speed of multiple jQuery posts?

We have encountered some challenges with calling multiple jQuery posts since switching to our new server. On certain pages, we are making multiple jQuery post requests as shown below: $.ajax({ type: "POST", url: "../files/processed/includes/proce ...

Ways of transferring session variables from one page to another?

Initially, I am working with multiple webpages in express. After saving a variable into a session during a post request, the page redirects to another page. However, when trying to access the variable on that new page, it is returned as "Undefined." Upon f ...

Personalized Text Input

Is there a way to incorporate a custom editText using a specific library or method?https://i.sstatic.net/u9Qhm.jpg The custom editText was implemented by enclosing it within a custom layout inside a textInputLayout https://i.sstatic.net/lyLaO.png ...

How can you use JavaScript to iterate through every object using a for loop?

I'm trying to determine if a button is clickable based on certain requirements, but I can't seem to get the initial function to work. Within this object array, each object represents a button with specific requirements. For example, the "story" ...

Node.js process.exec() function allows you to asynchronously spawn a subprocess

After writing the code, I ran it and found that the terminal was unresponsive with no output, causing the program to be stuck. var util=require('util') var exec=require('child_process').exec; exec('iostat 5',function(err,stdo ...

JavaScript function is not callable

Currently facing a strange issue or maybe it's just me missing something obvious. I've searched for the error but couldn't find the right solution. I am attempting to execute some Javascript code when the key "/" is pressed in a text box. ...

adjusting the height of a div using jQuery UI's layout feature

Recently, I have been playing around with the adjustable grids plugin (jquery ui layout) to set the width of each div using the plugins. However, I've encountered a challenge when it comes to adjusting the height of inner divs within the layout. Speci ...

Selenium explicit waits failing while time.sleep proves effective

As a newcomer to using selenium, I am attempting to refresh the page once the list has loaded. The HTML code is as follows: <span class="" title="Refresh"> <button class="MuiButtonBase-root MuiButton-root MuiButton-text ...

The variable __dirname has not been defined

Can anyone explain why my Google Cloud Run instance is unable to recognize the __dirname variable? My expressjs server contains the following code: import path from 'path'; const App = express() .get('/*', (_req, res) => { ...

The program does not end even when selenium has closed and exited

I am encountering an issue with my basic web scraping program. public static void main(String[] args) throws InterruptedException { File file = new File("C:/Users/JohnDoe/Desktop/chromedriver.exe"); System.setProperty("webdri ...

Page alignment cannot be achieved using the body selector, but can be achieved with the div page wrap

Hey there, currently working on a HTML site and encountered an issue with centering the page. The code looks like this: HTML: <body> --Rest of code-- </body> CSS: body{ width:70%; margin-left:auto; margin-right:auto; } ...

Effective Techniques for Integrating Cookie Consent in a Multilingual PrestaShop Store

:) Has anyone successfully integrated the cookie consent feature from insites.com into a Prestashop website before? I'm wondering if it's possible to load different head.tpl files depending on the selected language since the code would vary. Any ...

Issues with Drag and Drop functionality in Selenium using Python

I am trying to incorporate a drag and drop functionality using selenium with Python. I have set up the Chrome WebDriver and written the following code, but it doesn't seem to be working as expected. Any assistance would be greatly appreciated. from s ...

Implement a vertical scrolling animation in datatables

I am trying to utilize datatables to display all data. My goal is to have the data automatically scroll row by row every 3 seconds. This is my code, and you can also check it out on jsfiddle The intention is to showcase this data on a large screen. < ...

Mocha might be postponing the fulfillment of Chai expectations

As a beginner in test driven development using mocha, selenium, and chai, I am seeking feedback on whether my approach is correct. Below is an excerpt from my functional_tests.js file: test.it('Hamid visits the first page of tests', function ...

Modifying browser.location.href Cancels AJAX Requests

I am facing an issue with my HTML page. I have a button that, when clicked by the user, updates the window.location.href to the URL of a text file. In order to ensure that the file is downloaded and not opened in the browser, the text file is served with C ...

JavaScript Async Ordering

I have a specific question regarding asynchronous operations in Javascript. I am currently building a Node.js API to interact with an OrientDB database, using the Node-orient package for basic connectivity functions. Some of these functions are as follows: ...

Detecting Whether a Vue/Vue Router Navigation was Triggered by the Back/Forward Button or a Manual Router Push

When using vue/vue-router, I have set up a watcher on $route that is triggered in two different ways: By clicking back or forward on the browser. When the user interacts with a form. There are watchers on the variables that the form uses, and these watch ...

expanding the input and duplicating the outcomes

I'm attempting to clone and add values to results in my project. Here's the link to what I have so far: http://jsfiddle.net/QNP3r/175/ Currently, it is functioning adequately with a table element. However, I'd like to make it work with a di ...