Has the character escaping regression issue affected ElementExplorer in versions 1.8.0 and 2.0.0 of Protractor?

Currently, I am utilizing Node version 0.10.30. In Protractor 1.6.1, I successfully managed to escape a single quote character within the ng-show to retrieve a value. For instance:

element.all(by.css('[ng-if="user"]')).all(by.css('[ng-show="user.name === \'Jhonny\'"]').getText()

However, upon updating to Protractor 1.8.0 and 2.0.0, the escaping of characters no longer functions (Upon reverting back to Protractor 1.6.1 post-update, it worked as expected). Consequently, I attempted another snippet of code

element.all(by.css('[ng-if="user"]')).map(function(ele) {return ele;});

The above code leads elementExplorer to crash with the following error:

(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at Client.addListener (events.js:160:15)
    at CommandRepl.evaluate_ (C:\Users\test\AppData\Roaming\npm\node_modules\protractor\lib\debugger\modes\commandRepl.js:111:15)
    at CommandRepl.stepEval (C:\Users\test\AppData\Roaming\npm\node_modules\protractor\lib\debugger\modes\commandRepl.js:33:8)
    at WdRepl.stepEval_ (C:\Users\test\AppData\Roaming\npm\node_modules\protractor\lib\debugger\clients\explorer.js:48:16)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.emit (events.js:95:17)
    at Interface._onLine (readline.js:202:10)
    at Interface._line (readline.js:531:8)
    at Interface._ttyWrite (readline.js:760:14)
    at ReadStream.onkeypress (readline.js:99:10)

I have made attempts to execute elementExplorer using both Node or directory from Protractor --elementExplorer, yet encountered similar problems on both fronts. Has anyone else faced this issue?

Answer №1

I encountered the same problem when attempting to escape an apostrophe in a CSS locator using elementExplorer with Protractor. The workaround I found was to use double backslashes:

element.all(by.css('[ng-if="user"]')).all(by.css('[ng-show="user.name === \\'Jhonny\\'"]').getText()

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

Changing the value of a nested object in React's state

In my web application, I am using React/Redux with a Description Class that allows users to edit descriptions. The Props description and propertyTypes are fetched through AJAX calls. import React, { PropTypes } from 'react'; const defaultDesc ...

What is the best practice for AngularJs service methods: accepting an object or multiple parameters?

When creating Angular JS service methods, what is the recommended approach: accepting multiple parameters or utilizing an object? var getMessages = function (appid, userId, limit) { var data = { "appid": appid, "userId": userId, ...

Tips for refreshing only a portion of a webpage using JavaScript/jQuery

I have two distinct navigational sections on my website. The left column has its own navigation menu, while the right column (main content area) contains a separate set of links: My goal is to click on a link in the left-hand sidebar (such as "Resume", "E ...

The implicit wait feature in WebDriver JavaScript seems to be ineffective

Waiting for the error message to appear seems to be a bit tricky. I tried using browser.driver.manage().timeouts().implicitlyWait() but had to resort to using browser.driver.sleep() instead. this.getErrorMessage = function () { var defer = protracto ...

Is there a way for me to conduct multiple counts and choose the highest one especially if they are all promises?

Here is my voting controller for a post. If the user has not already voted on the post (their voterId is not in the votes array), their vote is added by adding their voterId to the votes array of the post. The voteCount is then reset to the length of that ...

Displaying Images on top of Images with React/Javascript/NextJS

I have two images. Let's say image 1 is a thumbnail for news content. I would like to overlay a promotional PNG banner on top of this image and create a new output image. This output image will be used as the OG (Open Graph) image. How can I achieve t ...

Is there a way to bring in an NPM module without utilizing the keywords 'require' or 'import'?

After spending hours searching for a solution, I am still struggling with importing third-party libraries into my project that does not support 'import' or 'require'. It's frustrating to hit a roadblock like this, especially when w ...

A step-by-step guide on setting up an event listener for dynamically generated HTML using JavaScript objects

In my JavaScript code, I am creating object instances that include HTML elements in the form of buttons. These buttons are dynamic and have words generated dynamically as well. I want these buttons to execute certain functions when clicked. The challenge I ...

Initiating external libraries at the right time in Angular 4

I am currently experimenting with a UI kit (you can check it out here) that comes with multiple JavaScript files, jQuery, Bootstrap, and its own components. I have included them in my index.html file and everything works perfectly as long as the checkbox ...

Tips for providing arguments in the command line to execute a yarn script

Just starting out with JavaScript. I understand that npm allows for passing variables in the command line using process.env.npm_config_key like this: npm run --key="My Secret Passphrase" test:integration How can I achieve the same thing with yarn? I&apo ...

Share an image using a subdomain in Express.js

Suppose I have the following code for testing on a local environment. sendImage: async function(req, res) { console.log(req.hostname); var filepath = path.join(__dirname, '../../img/uploads/' + req.params.year + '/' + req.para ...

Webpack encountered an error: SyntaxError due to an unexpected token {

I recently implemented Webpack for my Django and Vue project, but I encountered an error when trying to run webpack. Can anyone help me troubleshoot this issue? $ node --use_strict ./node_modules/.bin/webpack --config webpack.config.js node_modules/webp ...

Begin the process of setting up PDF.js on the website

I've been attempting to incorporate PDF.js into my website, but I'm struggling to do it correctly. When I try to display the PDF file on the screen, I encounter this issue: https://i.sstatic.net/aixrP.png Although I can't see the PDF file ...

Arrange the elements in the array based on their parent relationships (using topological sort) and their importance within

My array contains objects with elements that are dependent on each other. To properly store this data in a database, I need to order the array by importance (based on parent dependency) and update all children's parent property with the corresponding ...

Issues with javascript and php carousel functionality not performing correctly

I am currently in the process of creating a slideshow/carousel for a website. Recently, I implemented a PHP for-loop to iterate through a folder of images, allowing me to use the slideshow with an unspecified number of images. However, after making this ch ...

Strange rendering issues when using the react material-ui dialog

Exploring the Project Recently, I developed a front-end project focusing on a delivery service using React and Material UI. One interesting feature I added was a Dialog window that pops up when users click on an item, allowing them to customize it. Here i ...

Guide to displaying a progress bar while submitting a form using JavaScript and AJAX

After successfully creating the progress bar for my project, I encountered a technical issue. When I choose to upload a file, it gets uploaded twice - once when selecting the file and then again when submitting the form. This creates a poor user experience ...

Discover the index of the row when the value in the dropdown list is updated

I'm faced with a challenge regarding an HTML Table that contains a dropdown list in every row. I would like the background of each row to change whenever the value in the dropdown list is modified. Below is the code snippet: <table id="table1"> ...

Reinitialize the nested property of an object in JavaScript

I've encountered an issue while using the Vue3 composition API where attempting to reset a form with nested properties using Object.assign does not work as expected. const initialForm = { name: "", details: { type: "" } }; const f ...

Incorporate a file into all API endpoints with Next.js API functionality

Is there a way to incorporate a "bootstrap" file (a file with side-effects) as the first file included in all Next.js APIs? The main issue is that I have a Winston logger in a file that needs to be added to every API endpoint, but this process hinders dev ...