Encountering an Issue Executing Selenium Test on jQuery v2.0.2 and Play Framework

While I may not be a selenium expert, it seems that I've stumbled upon a bug when trying to utilize jQuery v2.0.2 with my Play Framework 2.2.1 application instead of the default jQuery v.1.9.0. Whenever I run "play test", I encounter the following error:

[error] Driver info: driver.version: HtmlUnitDriver
[error]     at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:367)
[error]     at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:346)
[error]     at org.fluentlenium.core.Fluent.goTo(Fluent.java:228)
[error]     at IntegrationTest$1.invoke(IntegrationTest.java:22)
[error]     at IntegrationTest$1.invoke(IntegrationTest.java:20)
[error]     at play.test.Helpers.running(Helpers.java:433)
[error]     at IntegrationTest.test(IntegrationTest.java:20)
[error]     ...
[error] Caused by: com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot find function addEventListener in object [object HTMLDocument]. (http://localhost:3333/assets/javascripts/jquery-2.0.2.min.js#4)

To replicate this issue, I created a new Play Java project using "play new tmp". After setting up the project, I could successfully run "play test" without any errors. Then, I added jquery-2.0.2.min.js to the public/javascripts folder and updated the main.scala.html file to reference this version instead of jquery-1.9.0.min.js. This simple switch triggered the same error when running "play test".

Even attempting to use the FIREFOX WebDriver helper class didn't resolve the issue.

If anyone has suggestions on how to make Selenium / Fluentlenium compatible with jQuery version 2.0.2, I would greatly appreciate any insights! Thank you :)

Answer №1

As per the information provided on the Selenium Wiki, the HtmlUnitDriver is designed to simulate the JS behavior of real browsers. The browser being emulated can be changed to alter its behavior, which might offer a solution for your issue. However, it's important to note that the JS and DOM implementation in HtmlUnitBrowser may not be fully complete, resulting in potential bugs or problems like the one you are currently facing.

If possible, try accessing the website using a different browser (such as Firefox or Chrome) to see if the issue persists. Be sure to open the JavaScript console (or Firebug if using Firefox) to verify that your jQuery version is functioning correctly.

Answer №2

We can find more information about this issue at the following link: https://github.com/playframework/playframework/issues/2607

Although it has been resolved for the latest Play and HtmlUnit versions, I am still experiencing difficulties and have resorted to reverting back to JQuery 1.x to make things work smoothly.

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 react-redux developer tool appears to be disabled and is not displaying the current state of the application on the extension toolbar

Just finished the redux-tutorial and attempting to view the state in the redux-devtools. However, the redux-devtools seems to be inactive on the extensions bar. Upon clicking it, a menu appears with options like "to right, to left etc". Selecting one of ...

In JavaScript, I would like to be able to input an end date and have the program calculate and display the number of days remaining until the deadline

I'm working on a school project that involves JavaScript code. I'm struggling with converting a date prompt from string to number format. As a beginner in JavaScript, I could really use some guidance. <script> enddate = prompt('Wh ...

Obtain product pricing information from a JSON file

Trying to fetch product details from an adidas API using the code snippet below: import requests url = "https://www.adidas.com/api/plp/content-engine?" params = { 'sitePath': 'us', 'query': 'women-athl ...

The percentage height setting for a div is not functioning properly, but setting the height in pixels or viewport

Within a dialog box body, I am attempting to display a table and have applied a CSS class to the wrapping div. When specifying the height in pixels or viewport height units, it works as expected. However, when using a percentage like 50%, the height of the ...

preventing users from selecting past dates on Full Calendar Plugin

Is there a way to disable the previous month button on the full calendar? Currently it is April. When I click on the previous button, the calendar shows March instead of disabling. How can this be prevented? http://jsfiddle.net/6enYL/ $(document).ready( ...

Encountering a problem with React router

Hello, I'm currently facing some issues with setting up routes in my project. Below is the code snippet from my route.js file: import React, { Component } from 'react'; import Home from './Home'; import Add from './Add' ...

Addressing the issue of empty ngRepeat loops

Utilizing ngRepeat to generate table rows: <tr ng-repeat="User in ReportModel.report" on-finish-render> <td><span>{{User.name}}</span></td> </tr> An on-finish-render directive triggers an event upon completion of t ...

Encountering issue: The parseInt method in the Integer type does not accept the parameters (String, Duration)

Looking for some insights, Encountering this error message: The method parseInt(String, int) in the Integer type cannot be used with arguments (String, Duration) Code Implementation: Selenium 4 driver.manage().timeouts().implicitlyWait(Integer.parseInt(C ...

Is it possible to capture a screen recording in Selenium using JavaScript?

While my tests are running, I am looking for a way to record my screen. I came across a post about screen recording using Java at . However, the code provided is in Java and I require something in JavaScript. Is it possible to record the screen using Jav ...

The D3 force layout is currently displaying just a single connection

I've been experimenting with a graph that I found in this demo and now I want to modify it to display data from Spotify. I created a sample JSON file and adjusted the script accordingly for the new data format, everything seems to be working fine exc ...

Gaining entry to information while an HTML form is being submitted

After a 15-year break, I am diving back into web development and currently learning Node.js and ExpressJS. I have set up a registration form on index.html and now want to transfer the entered data to response.html. However, when I hit Submit, the form is p ...

Issues have been reported regarding compatibility between iOS7, jquery.touchSwipe, on click and webkit-touch-callout

I'm in the process of developing a web application, but I've encountered an issue with iOS7 where there seems to be a conflict between jquery.touchSwipe and my "on click" events. Interestingly, the web app functions perfectly on older iOS versio ...

Elements in Motion

Working on a parallax effect, I've managed to assign unique scroll speeds to (almost) every element. Moreover, these elements are programmed not to activate their scroll speed until they enter the viewport. Below is the JavaScript code for trigger co ...

Switching from React version 15.6.2 to 16 results in disruptions to the functionality of the web

Currently, I am encountering an issue where none of my index.js files are rendering. After using the react-scripts to build my web application in version 16.2.0, I receive an error stating that r.PropTypes is undefined when trying to access the localhost a ...

Troubleshooting: Problems with AJAX POST request in Spring MVC Controller

Here are two different ways to submit form data to a Spring Controller. 1. $("#formData").submit(function(event){ event.preventDefault(); var jqxhr = $.post("submitdata", $("#formData").serialize(), function(data){ ...

Is it possible to test a Node CLI tool that is able to read from standard input with

I'm looking for a way to test and verify the different behaviors of stdin.isTTY in my Node CLI tool implementation. In my Node CLI tool, data can be passed either through the terminal or as command line arguments: cli.js #!/usr/bin/env node const ...

Is there a way to locate a null string within this data arrangement?

I am looking to create functionality where, when a button is clicked, the application checks the state and takes different actions based on the result. Specifically, I want to ensure that there are no empty "value" fields, and if there are, redirect to ano ...

I require assistance in implementing a button for executing this specific HTML code

Can someone assist me in embedding my HTML code into a button so that when the button is clicked, my code executes? function loadProgressBar() { var bar = document.getElementById('progressBar'); var status = document.getElementById(&ap ...

Keep your eyes peeled for updates in jquery movements

Is there a way to detect changes in HTML content? I have a button that adds more HTML, but when I save the data using ajax, it doesn't capture the added HTML. Currently, when I click save, the new HTML is not recognized. $("#more_column").click(func ...

Null Value Returned When Making an Ajax Post Request

I'm having trouble retrieving the id of the last inserted row after posting via ajax. When I var_dump the result, the function returns HTML instead of the id data. What am I missing here? Note: The save method should return the id of the last inserte ...