Navigating to an element in Selenium with intern.js and leadfoot

Trying to pinpoint the issue with my current setup, as I'm facing a challenge. The problem arises when using intern.js for JavaScript functional testing in conjunction with SauceLabs.

While the test itself passes without any errors, upon checking the screenshot on SauceLabs for window behavior, it becomes evident that there is an issue with scrolling to the element. It seems like the .moveMouseTo function is not functioning correctly.

There is some scroll happening, but the desired element remains out of sight. I've researched Selenium and the focus feature, but being relatively new to intern.js, I'm uncertain how to incorporate these based solely on Selenium documentation.

Here's the specific test scenario:

'added comment shows the comment added': function () {
        return this.get('remote')
            .get(require.toUrl('index.html'))
            .setFindTimeout(500)
            .setWindowSize(800, 600)
            .findByCssSelector('.ht-comment-box')
            .click()
            .type('My New Comment')
            .end()
            .findByCssSelector('#addComment')
            .click()
            .end()
            .setFindTimeout(500)
            .findByCssSelector('.commentRow:last-child > .commentContent ')
            .moveMouseTo()
            .getVisibleText()
            .then(function (text) {
                assert.strictEqual(text, 'My New Comment',
                    'Adding a comment should display the comment. Showed instead ' + text);
            });
    },

On inspection, it appears that the added comment is not visible due to scrolling issues.

Answer №1

In order to use the moveMouseTo function, you must pass an element as a parameter.

var remote = this.get('remote');

return remote.get( … )
  // …
  .findByCssSelector( … ).then(function (element) {
    return remote.moveMouseTo(element);
  })
  .getVisibleText();

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

Incorporating a YouTube or Vimeo video while maintaining the proper aspect ratio

On my video page, I embed Vimeo videos dynamically with only the video ID. This causes issues with the aspect ratio as black bars appear on the sides due to the lack of width and height settings. The dynamic video ID is implemented like this: <iframe ...

Troubleshooting difficulties integrating NodeJS with R using an R script

I have been attempting to execute an R-script from a js-file but I am consistently receiving a null value as the return. Here is my folder structure: -R_test --example.js --helloWorld.R The contents of example.js are as follows: var R = require(" ...

Steps for including screenshots in HTML reports created by pytest-html plugin using pytest and selenium

I've been attempting to incorporate screenshots of failed tests into the HTML reports created by the pytest-html plugin and pytest libraries. I tried following the steps mentioned in this helpful Question on Stackoverflow: How do I include screenshot ...

How can we ensure that the second function is executed only after the AJAX click method has finished in Javascript?

var err=0; $("#addsell").click(function(e) { e.preventDefault(); var data = { title: $('#title').val(), author: $("#author").val(), genre: $('#genre').val(), price: $('#price').val(), ad ...

There is an excessive amount of recursion happening in angular.js when it comes to

I've been troubleshooting a recursion error in my angular.js web application. The error message listed below keeps popping up multiple times (twice per second) in the console whenever the issue occurs. Since the log statements only point to errors in ...

Using Electron to Show a Video Stored in the Local File System Using a Custom Protocol

Currently, I'm facing challenges while using electron to develop a basic video display application. Despite my efforts, I am struggling to show a video in the renderer by correctly implementing the registerSchemesAsPrivileged method. Although there ar ...

overlaying an image with a CSS box and then dynamically removing it using JavaScript

I am new to JavaScript, so please bear with me if this question seems quite simple. I am facing an issue with my current task. There is an image on a web page. My goal is to place a black box on top of the image (using CSS) to cover it up. Then, with th ...

Having trouble toggling classes with mouseup in Wordpress Underscores theme

While I'm utilizing Underscores as the foundation theme for my website, one aspect that I particularly appreciate is its incorporation of a functional mobile navigation component. However, since my site is essentially single-page, the navigation remai ...

Vue.js: Incorporating a client-side restful router using vue-router and a state manager

Trying to set up a client-side restful api with vue.js and vue-router where route params can be utilized to showcase a subset of a store's data into components. All the necessary data for the client is loaded into the store during initialization (not ...

Delay in real-time updates with Axios post in NodeJS and ReactJS

I am facing a peculiar issue with an axios post request. Within an onSubmit function on a react component, I have an axios post that sends a UID and retrieves the count of items associated with that UID in a collection (in this case, items in the basket fo ...

Production Server experiencing issues with sending Large Lists via Http Post

I'm experiencing an issue where the server is unable to read values from a large list when sent using Post. Oddly enough, this works on the homologation server but not on the production server. Http post AngularJs $http({ url: $rootScope.raiz_ws ...

How does Code Sandbox, an online in-browser code editor, manage file storage within the browser?

What are the ways in which Code Sandbox and StackBlitz, as online in-browser code editors, store files within the browser? ...

Unable to manipulate popup window of Chrome extension through Selenium in Python

Looking to automate a task on Chrome using Python and Selenium. However, facing an issue where the task requires clicking on a button within a Chrome extension popup to complete it. Struggling to initiate the click() function on the popup itself using Sele ...

Managing Login Credentials Pop-up Using Selenium in Java

Currently working on authenticating our website . The process requires us to enter a username and password through our selenium java code. Any assistance would be greatly appreciated. Thank you, Rachit ...

Retrieve the value of an li element and send it to an AJAX request

I am experiencing an issue with my treeview list where I am trying to send the id of the selected li element via ajax, but for some reason, the code is not functioning as expected. You can view the old code here: http://jsfiddle.net/esS4k/379/ Check out ...

Convert a document into a PDF format and then transfer it to a server for safekeeping

I am in need of a solution for saving completed web forms as PDFs, which I can then store in my database for future reference. My staff often fill out these forms for various purposes and being able to convert them into PDFs would greatly streamline our wo ...

Using Three.js to create a variety of distinct lines

When creating maps using three.js, we typically incorporate dashed lines for borders and isolines. However, I am interested in exploring different line patterns for added visual interest. Does texturing offer a better approach to achieve this? UPD: The ma ...

Guide on connecting an Express v4 server with Socket.io 1.3.2 to share a session

For the past few days, I've been struggling to share an express session with socket.io. My setup includes express 4.11.1 and socket.io 1.3.2, along with other dependencies like express-session 1.10.1, cookie-parser 1.3.3, and body-parser 1.10.2. Essen ...

Experiencing difficulties with a click event function for displaying or hiding content

Struggling with implementing an onClick function for my two dynamically created components. Currently, when I click on any index in the first component, all content is displayed. What I want is to show only the corresponding index in the second component ...

Utilizing a parent scope variable in a callback function

This question delves more into the concept of JavaScript Closures rather than Firebase. The issue arises in the code snippet below, where the Firebase callback fails to recognize the variable myArr from the outer scope. function show_fb() { var myAr ...