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

What is the method to determine the size of a file in Node.js?

Have you ever wondered how to accurately determine the size of a file uploaded by a user? Well, I have an app that can do just that. The code for this innovative tool is provided below: Here is the snippet from server.js: var express = require('expr ...

Express Node fails to launch

I recently decided to try my hand at Express and learn more about it. However, I encountered an issue while trying to start a server. Initially, I attempted to access 127.0.0.1:8080 through Express but nothing seemed to be happening. Although I copied most ...

Adding a child node before an empty node in Chrome with JavaScript Rangy

When attempting to insert a node before an empty element at the start of another element, a problem was noticed. Here is the initial setup: <p>|<span />Some text</p> By using range.insertNode() on a Rangy range to add some text, Chrome ...

Using React refs to target multiple elements dynamically with the help of the map

My code effectively catches when the dropdown is clicked outside, and it's working well: displayOptions() { return _.map(this.props.selections, (option, index) => { return ( <div className="ui icon top dropdown" ...

Guide on utilizing Vue to trigger an API call when the input box loses focus

I am currently facing challenges while trying to learn vue, and I am not sure how to proceed. I would greatly appreciate any assistance! To begin with, I want to acknowledge that my English may not be perfect, but I will do my best to explain my issue tho ...

The issue of jQuery POST methods consistently failing

I have set up a Node.js server using Express with a fairly straightforward configuration: var express = require('express'); var app = express(); app.configure(function() { app.use(express.urlencoded()); app.use(express.json()); app ...

Rails 3.2 - form mistakenly submitted repeatedly

I am working on a project involving the Box model, which includes many box_videos. I have created an edit form to allow users to add box_videos to the box after it has been created: <%= form_tag "/box_videos", { method: :post, id: "new_box_videos", rem ...

Instructions on how to insert a hyperlink into the information within the generated div utilizing an API

Currently, I am fetching information from an API based on the user's input (zipcode). The data retrieved includes the name of the institution, address, and webpage. I've been trying to make the webpage link clickable by adding a hyperlink to the ...

Can you explain the functionality of this code snippet from a slate.js demonstration?

Trying to grasp the concepts of Slate.js, I delved into the rich text example. Within it, I encountered a code snippet that has left me puzzled. const isBlockActive = (editor, format) => { const [match] = Editor.nodes(editor, { match: n => ...

Tips for getting UpdateTargetId to function properly in Ajax.ActionLink!

Within the controller, I have a method like this: [HttpDelete] public void DeleteDocument(int id) { //Handling document deletion in the database } In the view, there is a call to a method that returns a partial view: @{ Html.RenderAction("GetDocument ...

WebDriverManager is retrieving the chrome browser version from a predetermined location, bypassing any specified configurations

I have exhausted all possible solutions to make WebDriverManager recognize the correct version of the chrome browser, but nothing seems to work. My goal is to detect the browser driver version from the chrome.exe file located at C:\Program Files\ ...

Transform the JavaScript object received from an AJAX request into HTML code

Here is an example of what the result (data) looks like: <tr> <td> Something... </td> </tr> <div id="paging">1, 2, 3... </div> This is using ajax to retrieve data. ... dataType: "html", success: function( ...

Retrieving Distinct Values in CouchDB

In my database, there are documents that represent different rooms. Each room has properties like "floor" and "hotel", among others. What I need to do is fetch all the floors associated with a specific hotel from the database. Something like getAllFloorsOn ...

Customize Loading Screen for Datatable Server-Side Processing

Currently, I am utilizing datatable with server-side rendering. The issue at hand is that by default Datatable displays a small processing message which becomes invisible if the loading records exceed 50 in the default view. I attempted to set an overflow ...

The pagination in React using React Query will only trigger a re-render when the window is in

Currently, I am utilizing React-Query with React and have encountered an issue with pagination. The component only renders when the window gains focus. This behavior is demonstrated in the video link below, The video showcases how the component re-renders ...

Would this code effectively disable the right-clicking menu for MathJax?

My current approach involves utilizing the following code snippet: <script type="tet/x-mathjax-config"> MathJax.Hub.Config({ showMathMenu: false }); </script> I intended for this code to disable the right-click menu on my math webs ...

Encountering a Selenium timeout problem while making a call

When I run this code in Access VBA: Private Sub cmd_OpenFirefox_Click() Dim driver as New FirefoxDriver driver.Get "http://www.google.com" End Sub A new Firefox window opens, but it remains empty. An error with code "21" appears with the message: "Tim ...

Determine the vertical dimension of an element through a JavaScript event listener

I've been working on creating an Apple-style image sequence scroller from a codepen demo. Here's the link to the original: https://codepen.io/jasprit-singh/pen/LYxzQjB My goal is to modify the JavaScript so that the scroll height is based on a p ...

Concealing specific HTML elements with ng-view in AngularJS

I recently started a project in AngularJS and I'm utilizing ng-view with $routeProvider for templating. However, I've encountered a minor issue where I don't want the navbar to display on specific pages like the landing, login, and registrat ...

Unable to retrieve the present aria-pressed value using the .attr() method

Currently, I am utilizing a bootstrap toggle from this source: https://codepen.io/aanjulena/pen/ZLZjzV The main function of this toggle is to reskin a button. When the status is "on," the aria-pressed attribute is set to true, and vice versa. Here is an e ...