Navigating array usage in Selenium IDE

I am trying to extract emails from a webpage using Selenium for future testing. I need to compare these emails with ones displayed in a selection later on.

I attempted to read the emails within a while-loop but struggled with handling arrays in IDE. Unfortunately, my current approach is not working:

store | 0 |i
store | 17 | line
storeElementPresent | //html/body/div/div[4]/*/div[3]/table/tbody/tr/td/table/tbod/tr[${line}]/td[3]/a |adresseDa
while | ${adresseDa}!='0' 
storeEval | javascript{new Array()} | array
storeText | //html/body/div/div[4]/*/div[3]/table/tbody/tr/td/table/tbody/tr[${line}]/td[3]/a | mail
storeEval | storedVars.array[storedVars.i]=storedVars.mail 
echo | ${array}
storeEval | storedVars.line++
storeEval | storedVars.i++
storeElementPresent | //html/body/div/div[4]/*/div[3]/table/tbody/tr/td/table/tbod/tr[${line}]/td[3]/a | adresseDa
endWhile

The echo | ${array} output is null, indicating that something is wrong with my method.

I need guidance on how to properly store the emails in an array and access them later. Any suggestions would be greatly appreciated!

Thank you!

Answer №1

Successfully discovered a solution :) Storing emails in an array:

store   | 17    | line
storeElementPresent  |//html/body/div/div[4]/*/div[3]/table/tbody/tr/td/table/tbod /tr[${line}]/td[3]/a | adresseDa
while | ${adresseDa}!='0'   
storeText | //html/body/div/div[4]/*/div[3]/table/tbody/tr/td/table/tbody/tr[${line}]/td[3]/a  | tempMail
store   | javascript{storedVars['tempMail'].substring(7,100)} | mail
push    | ${mail}  | mailArray
echo    | ${mailArray} 
storeEval | storedVars.line++       
storeElementPresent | //html/body/div/div[4]/*/div[3]/table/tbody/tr/td/table/tbody/tr[${line}]/td[3]/a | adresseDa
endWhile 

Verification of email array against DropDownMenu on a different webpage:

verifySelectOptions |   //*[@id="mainForm:Emailadresses"] | ${mailArray}

For the push and while functions, you can access an extension from this link:

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

Navigating to JSON input in Express correctly

I have successfully created a basic Express-based API to serve JSON data, but now I want to enhance its functionality. The JSON file follows this structure: (some sections are excluded) [{ "ID": "1", "NAME": "George Washington", "PAGE": "http://en.w ...

Is there a way to declare the different types of var id along with its properties in Typescript?

I recently received a task to convert a JavaScript file to a TypeScript file. One issue I am currently facing is whether or not I should define types for the 'id' with this expression, e.g., id={id}. So far, I have tried: Even though I defined ...

What is the best way to utilize this resulting value as an input?

I am trying to generate a random number using math.random and use that value in the following script: let bday = Math.floor( Math.random() * (30 - 1 + 1) + 1 ); await test.page.select('select[name="day_select"]',bday); However, I am ...

The server is indicating that the validation for the user has failed due to the required field "foo" not being provided in the Node.js

An error message was received with the following details: "User validation failed: email: Path email is required., display_name: Path display_name is required." The error name returned is: ValidationError. The AJAX call code snippet is as follows: f ...

Ways to resolve the angular error "Encountering an unhandled exception: Unable to locate module 'typescript' "?

I'm encountering errors when running ng serve. I've attempted the following code as well, but I'm still facing the same error: npm install -g typescript Error displayed in text format D:\xampp\htdocs\angular\axen>ng ...

Using a Javascript while loop to iterate through an array and display the elements in the .innerHTML property

As a newcomer to Javascript, I am in the process of teaching myself. My current task is to develop a function that will display each element of the array AmericanCars with a space between them. I have successfully been able to show an individual element u ...

"Comparing arrays based on their position in PHP - a step-by-step guide

I need assistance with comparing two arrays based on their positions: $mission = array(1,1,0,0,0); $user = array(1,1,1,0,0); The goal is to determine if the user's array matches the positions of the mission array. In the example above, the user can ...

The application of the Same Origin Policy appears to be ambiguous when utilizing the jQuery AJAX

I'm exploring the application of the Same Origin Policy (SOP) in various scenarios. Here is some JavaScript code that I have written in a local HTML file and executed using Chrome on Windows: $(document).ready(function () { $.get("http://www.qu ...

Error message thrown: "The reference to $ is undefined. Are you using Jsfiddle?"

As a newcomer to javascript, I decided to experiment with creating a navigation bar that only appears when the user scrolls down using JSFiddle. However, when I transferred the code to Dreamweaver, it stopped functioning. Why is this happening? I've ...

"What is the best way to use jQuery to create a toggle effect where one button controls the state

I'm looking to improve the efficiency of my code, but I'm not sure where to start in terms of making it more concise and organized. Any suggestions on how to streamline this code and keep it neat would be greatly appreciated. $(document).ready(fu ...

Tips for storing a link as a variable in Python 3 with selenium

I am in the process of creating an Instagram bot using Selenium on Python-3. Currently, it successfully logs into my Instagram account, navigates to my saved content, and clicks on the first image. After clicking on the first image, it then clicks on the ...

JavaScript code that opens a URL in a new tab with proper formatting

I'm having trouble figuring out how to make my JavaScript open a URL in a new tab. Here is the script: function viewSource(){ var webcache = "http://webcache.googleusercontent.com/search?q=cache:"; var request = "&prmd=ivn&strip=0& ...

What is causing the malfunction with this JQuery/AJAX request?

Currently in the process of setting up an autocomplete feature. Following the guidance from php academy at the moment. My goal is to display "suggestions go here" below the input field whenever something is typed in. I have two files for this task: home.ph ...

Combining JSON objects in Node.js

I am extracting data from my database and converting it to JSON format. However, I now want to merge all the JSON data into a single JSON object. I have attempted various methods, but due to my limited knowledge of JavaScript syntax, I have not been able ...

Vue.js has mysteriously stopped functioning

My Vue.js project suddenly stopped working and I've been trying to figure out the issue for hours with no luck. Here's an overview of my HTML file which includes dependencies and a table displaying data from users. <!DOCTYPE html> <html ...

Storing a variable in an array in a separate file: A step-by-step guide

What I have tried: To tackle this issue, I began by creating a new file named links.js, inside which is a single array. In my main file (index.js), the program scrapes URLs. The goal is to save these URLs in the specified format within the links.js file ...

Show side by side using javascript

My dilemma lies in having a set of cards that are meant to be displayed inline, but I have to initially hide them using "display: none". When a specific button is clicked, I aim to reveal these cards; however, upon doing so, each card seems to occupy its o ...

Getting a JSON response from a JSP page through an AJAX request

I'm encountering an issue with a JSP page that is supposed to send a JSON response when requested through an AJAX call. However, the response is being directed to the error part of the AJAX call instead of the success part. Below is the code in my JS ...

Break down for me what Json is in a way that a five-year-old could understand

Let me clarify one thing, I may not be a Javascript expert but I'm far from being 5 years old. Json is one concept that's been confusing me lately as I dive into the world of programming. Can someone please explain json to me in a simplified mann ...

What is the process of integrating ES6 modules with app.get in a Node/Express routing application?

After researching the benefits of ES6 export, I made the decision to implement it in a NodeJS/Express project instead of using module exports. The MDN documentation explained that export is used as shown below: export function draw(ctx, length, x, y, color ...