Once an email address is entered, kindly instruct the driver to press the tab key twice for navigation

Adding a user to a website involves entering an email address first, which is then checked against the server's list of users. However, the issue arises when the email validation doesn't occur until clicking outside the input box or pressing tab twice. This delay causes the other form fields like first name and last name to become read-only and invisible, hindering the completion of the form.

I attempted the following code snippets:

element.all(by.css("input[type$='text']")).first().sendKeys(protractor.Key.TAB);
browser.driver.sleep(3000);
//below is the first name element
element(by.xpath("(//input[@type='text'])[2]")).sendKeys("a First Name");

 element.all(by.css("input[type$='text']")).first().sendKeys('<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="61000f040c00080d00050518210f04160c0013...
//similar attempts were made using different methods.

In addition, I tried accessing the elements based on their position in an array, wondering if 'input[type$='text']:nth-of-type(2)' refers to the second item on the list, such as the first name field.

The HTML of the page contains various input fields for editing user permissions.

Answer №1

If you are having trouble with the "TAB" method, it could be due to an issue related to Chrome version 44 and Selenium test compatibility. To resolve this, consider using the latest versions of Chrome or Firefox.

Regarding accessing elements like email addresses and names within an array, if you want to select the second input for first name, you can do so by using

input[type$='text']:nth-of-type(2)
since it is the second item in the list.

To streamline your process, define the list of inputs once and utilize methods like first(), get(), or last():

var inputs = element.all(by.css("input[type$='text']"));
var email = inputs.first();

email.sendKeys("<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f2939c979f939b9e9396968bb29c97859f93809997869b9c91dc919d9f">[email protected]</a>", protractor.Key.TAB, protractor.Key.TAB);

inputs.get(1).sendKeys("a First Name");

If you encounter further issues, consider clicking outside of the modal as a workaround:

browser.actions().mouseMove({x: 5, y: 5}).click().perform();

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

Removing border of the top and bottom of jspdf pages

In my project, I am utilizing a combination of html2canvas, canvg, and jspdf to convert HTML content (which includes SVG graphs) into canvases for the purpose of creating a PDF file. To address some page-break issues, I have resorted to creating multiple c ...

The (ReactJS + Redux) form fails to load when the /new segment is appended to the URL

I'm currently working on a project using React, Redux, and Rails. I've encountered an issue with loading the form. In my App.js file, I have set up a Router that defines the routes. import React, { Component } from 'react'; import { Br ...

What is the most efficient method for conducting cross-browser compatibility testing on a web application with Selenium automation?

After dedicating a significant amount of time to research without finding a suitable solution, I turned to StackOverflow for help. I have been using Selenium Webdriver to automate testing on various browsers. However, recently I encountered issues with ol ...

Prevent any unauthorized modifications to the ID within the URL by implementing appropriate security measures

I am currently developing an application using React and Express. The URL structure is similar to this: /dashboard?matchID=2252309. Users should only have access to this specific URL, and modifying the match ID should not allow them to view the page. Is ...

Utilizing JavaScript and PHP to dynamically load HTML content on a webpage

Below is the code snippet I'm working with: <?php if ($x == 1){ ?> <b>Some html...</b> <?php } else if ($x==2){ ?> <b> Other html...</b> <?php } ?> Now, I want to create two links (a ...

Moving from $.ajax to $http in AngularJS can improve the performance and efficiency of your

For the purpose of testing (to utilize $httpBackend), I am looking to switch my Service from using jQuery $.ajax to Angular's $http. This is how my current service is structured: app.service('myService', function() { return { getUse ...

A simple method for bulk editing in Angular UI Grid

Is there a way to enable mass editing in Angular UI Grid by allowing all rows to show editable input fields at once, rather than just one at a time? I have searched online for a solution without success and am now turning to this forum for help. If anyone ...

send additional form elements to the AJAX suggestion box script

** shifted to this location: Numerous similar AJAX suggestion boxes without IDs I enlisted the help of a developer to create a jQuery AJAX suggestion box script some time ago, and it has been working flawlessly. Now, I am striving to understand it better ...

Update the variable values in the Onclick function

I am trying to modify the onClick function attached to a button. My goal is to change the function var from 'create' to 'update' when the page loads and also through other functions. I attempted the code below but it did not work as exp ...

Tips for utilizing Async/Await within an expressjs router

Having trouble with Async/Await in my Nodejs project. I'm a beginner with Nodejs and facing an issue connecting to my mongodb collection through my repository. When I integrate my controller with the repository, I end up getting a null response. Take ...

Troubleshooting: How to Fix Missing Sum Display in HTML Input Fields

I am new to the world of website programming and I am currently working on creating a basic sum equation using two input fields from the client-side. <!DOCTYPE html> <html> <head> </head> ...

Passing data from a child component to a parent component in Vue 3: How

Struggling with Vue 3 app authentication through event-emission from child to parent. Below is a snippet of the code: Child <template> <form class="msform"> <input @click="goToLogin" type="button" name=&q ...

Utilizing jQuery AJAX to transfer files from the client side in .NET platform

I need to upload files from the client side using a jQuery Ajax function to a location on a different server, rather than sending them to my application's web server. This is to prevent unauthorized or virus-infected uploads to the application web ser ...

Character count in textarea does not work properly when the page is first loaded

As English is not my first language, I apologize in advance for any grammar mistakes. I have implemented a JavaScript function to count the characters in a textarea. The code works perfectly - it displays the character limit reducing as you type. However, ...

Apple Automation: Extract a targeted string from text and transfer it to a different spot within the page

Apologies for my lack of expertise in this area, but I hope to convey my question clearly. I am working on a form where I need to input text in order to copy specific items and paste them elsewhere on the same webpage. For example, if the input text is " ...

What is the most efficient approach to completing everyday tasks directly in a Vuex store?

Currently, I am working on making API calls from within a Vuex store action object. Here's an example of one of my actions: /** * Check an account activation token * */ [CHECK_ACTIVATION_TOKEN] ({commit}, payload) { Api.checkActivationToken(payl ...

Saving the object returned by the useRef hook into the Redux state

I have a question. I am developing a music platform similar to Spotify using Next.js. To manage states, I am utilizing Redux Toolkit. In order to play music, I have integrated the audio element within a component that includes controls to adjust the music ...

Incorporation of a dynamic jQuery animation

I'm a beginner in jquery and I'm attempting to achieve the following: I want each menu to collapse separately when the mouse hovers over it. The issue is that both menus collapse simultaneously! I know it's probably something simple, but I ...

How to Use Vanilla JavaScript to Fetch a JSON File, Convert the Data into an Array, and Iterate Through Each Object

Imagine having a JSON file called map.json: { "images":{ "background": ["images/mountains.png","images/sea.png"] } } The goal is for JavaScript to retrieve "images/mountains.png" from map.json and us ...

Tips for displaying JSON data in HTML without the use of placeholder DIV elements

Customer Scenario: A user wants to search through Wikipedia. The search results should be limited to 5 articles, and the user should be able to view the title and introduction of each article. Developer Scenario: User input is provided via an HTML input f ...