"ExceptionThrownByMoveTargetOutOfBounds in Selenium WebDriver for IE9 and Firefox

Having trouble with the FireFox/IE9 driver in Selenium? When using the Actions class and its moveToElement method, I keep encountering a MoveTargetOutOfBoundsException error. Despite trying different solutions like Coordinates, Point, and javascriptexecutor, nothing seems to work. Oddly enough, the moveToElement method works perfectly fine with my Chrome driver. Why is it that Firefox33/IE9 are causing issues when they are native to Selenium?

Take a look at this code snippet:

WebElement requiredCheckbox = new WebDriverWait(driver,15).until(ExpectedConditions.presenceOfElementLocated(By.name("tc_n_cs_subscribe_1")));

    // Point points = requiredCheckbox.getLocation();
    // System.out.println(points.getX());
    // System.out.println(points.getY());
    // actions.moveByOffset(points.getX(), points.getY()).perform();

    // ((JavascriptExecutor)
    // driver).executeScript("window.scrollBy(0, "+points.getY()+");");

    // ((JavascriptExecutor) driver).executeScript(
    // "arguments[0].scrollIntoView();", requiredCheckbox);

    // Coordinates coordinate =
    // ((Locatable)requiredCheckbox).getCoordinates();
    // coordinate.onPage();
    // coordinate.inViewPort();

    actions.moveToElement(requiredCheckbox).build().perform();

    requiredCheckbox.click();

Answer №1

What is your objective? If you wish to move the screen to the 'requiredCheckbox', use this code:

((Locatable) requiredCheckbox).getCoordinates().inViewPort();

Answer №2

Successfully resolved the issue by utilizing the JavascriptExecutor code.

((JavascriptExecutor) driver).executeScript(
        "arguments[0].scrollIntoView();", requiredCheckbox);

The solution was effective after incorporating the DesiredCapabilities setJavascriptEnabled method.

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

Space around the flex container

I am facing an issue with a flex display that splits the screen into two sections: one for login information and the other for a background picture. When setting up the flex layout, I notice unwanted margins on both sides (highlighted as orange bars in the ...

Enhance user interactivity on your website by incorporating jQuery and CSS for

<table id="tab"> <tr aaa="one" bbb="ooo"><td>xxx</td><</tr> <tr aaa="two" bbb="one"><td>xxx</td><</tr> <tr aaa="three" bbb="one"><td>xxx</td><</tr> ...

Exploring the object structure received from AngularFire

Here is the Firebase query that I am running: var ref = new Firebase('https://<myfirebase>.firebaseio.com/companies/endo/status'); data = $firebaseObject(ref); console.dir(data); The object that I receive looks like this: d ...

Can you please elaborate on the concept of type coercion in JavaScript?

I've come across information stating that when comparing an object with a number, type-coercion occurs. ToPrimitive is called on the object which then invokes valueOf and, if necessary, toString. However, I'm struggling to understand how this pro ...

Embed images within the JavaScript bundle

Here is my scenario: I have developed a components library for React. Within this library, there is a package bundled with Rollup that contains various assets, including a GIF picture used in one of the components. The specific component utilizing this p ...

Why is my CSS selector automatically converted to uppercase in Internet Explorer?

I am facing an issue with my CSS file. Here is how it looks: /*mycss.css*/ body { margin: 0px; padding: 0px; } a:link { color: rgb(255, 255, 255); font-weight: normal; text-decoration: underline; } a:visited { color: rgb(255, 255, 255); font-weight: norm ...

Clear the local storage once the URL's view has been fully loaded

When retrieving details of a specific item by passing URL parameters stored in local storage, I encountered an issue. I need to delete the local storage variables after the view is loaded. However, what actually happens is that the local storage variable ...

Tabbed horizontal slider

I am trying to combine two scripts in order to create a tab-based system with a scrollbar located at the bottom of the content. I have merged the following Ajax tabs: with this slider: However, when I open the slider's tab, I am unable to move the s ...

Styling certain UL and LI elements with CSS properties

Greetings everyone! I constantly struggle when it comes to making my CSS cooperate. I have some code that involves using ul and li tags. However, I only want to apply that styling to specific sections of my HTML code rather than all instances of the ul and ...

Issue with Google Maps functionality within the jQuery easytabs platform

Upon clicking the contact tab, the gmaps loads but unfortunately only shows the left corner of the map. Quite intriguing... Any thoughts on how to fix this? Here is the corresponding jsfiddle This is the structure of my HTML code: <div id="menu-contai ...

Having trouble accessing the webpage using Seleniumwire

Encountering an issue while trying to load a web page with seleniumwire, causing this error message to appear in the browser: This page isn't working xxx.xyz didn't send any data. ERR_EMPTY_RESPONSE However, when swapping out seleniumwire for se ...

Performing a Google search using Selenium in Python, selecting a specific URL from the search results

I came across this script that works well for printing the result list by title. Now, I am looking to learn and add python script to click on a chosen URL from Google search results. For example, clicking on a URL from the result containing the domain na ...

I'm using Python with Webbot and I'm not quite sure how to activate the button on the Chrome PDF viewer

Currently, I have a Python application that is utilizing Webbot to navigate through a website. One of the final pages of this process involves rendering and streaming a PDF document to the browser without an endpoint URL. The document appears in the Chrome ...

Seeking further explanation regarding ANT and MAVEN

During my interview, I was faced with this common question: Is it possible to use Ant and Maven together in a single project? If anyone can provide guidance on this topic, I would greatly appreciate it. ...

angularJS controller does not seem to be functioning properly due to a certain

var today = new Date(); var dd = today.getDate(); var mm = today.getMonth() + 1; //January is 0! var yyyy = today.getFullYear(); var currentdate = yyyy + ',' + mm + ',' + dd; var appointmentDate = moment($scope.AppointmentsList[i].J).f ...

Utilizing JSON Data for Dynamically Displaying Database Objects on a Google Map

After carefully reviewing the information provided in the initial responses and working on implementation, I am updating this question. I am currently utilizing the Google Maps API to incorporate a map into my Ruby on Rails website. Within my markets mode ...

MacGyver's innovative Angular mac-autocomplete directive fails to properly auto-complete

I have incorporated the .css and .js files for MacGyver in my HTML document. Additionally, I have added 'Mac' as a dependency in my Angular application. The following code snippet is included in my HTML: <mac-autocomplete ng-model="selected" ...

When a user clicks on a child element in ReactJS, the onclick event returns as undefined

I am experiencing an issue with my restaurants list component. While I have an onClick event set up for each list item, clicking on a child element of the list item does not trigger the expected response. When this occurs, nothing happens or I see an undef ...

Unexpected behavior from Bootstrap within React

I recently started working on a React project that I initiated with the create-react-app command. To incorporate Bootstrap into my project, I added the necessary CDNs to the public/index.html file after generating the project. <link rel="stylesheet" hr ...

Choose All Box for Dynamic Tables in AngularJS

Hi everyone, I'm currently working on adding a select-all checkbox to the top of my list of checkboxes using a custom directive. I found some guidance on how to do this in a thread that I came across: https://github.com/lorenzofox3/Smart-Table/issues/ ...