Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6384507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:47:05+00:00 2026-05-25T02:47:05+00:00

I am trying to loop list A and compare each element in list A

  • 0

I am trying to loop list A and compare each element in list A to list B looking for a match I can’t figure out why this while loop is only executing once?

for (WebElement webElement : inputs) 
{
    if (webElement.getAttribute("type").equalsIgnoreCase("text")) 
    {       
        String element = webElement.getAttribute("id").toString();
        System.out.println("Element: " + element);

        while(e.hasMoreElements())
        {   
            String param = (String) e.nextElement();
            System.out.println("Parameter: " + param);     

            System.out.println(element.matches(param));
            if(element.matches(param))
            {
                webElement.sendKeys(vars.get(param));
                //inputs.remove(element);
            }
        }
    }           
}       

Sorry here is the rest of the code, is referenced before the code above

        Hashtable vars = new Hashtable();

vars.put("USERNAME","slider"); vars.put("POSTCODE","LU1 3LU"); vars.put("EMAIL","david.cunningham@lumesse.com"); vars.put("DOB","02 Mar 1983"); Enumeration<String> e = vars.keys();

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:47:06+00:00Added an answer on May 25, 2026 at 2:47 am

    My guess is that you’ve got something like:

    Enumeration e = vector.elements();
    

    outside the for loop. You need to put it inside the for loop, before the while loop. Otherwise you’re iterating all the the way through it, but never going back to the start.

    (I’d also advise you to use the Iterable/Iterator interfaces if you possibly can, and generic collections.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to compare a user input to every element of a list,
I am trying to loop through a list and get an output like this:
I'm trying to loop through items of a checkbox list. If it's checked, I
Trying to do it through a loop that traverses through the list. In the
I am trying to loop though my users database to show each username in
I am trying to loop from 100 to 0. How do I do this
In the below code I'm trying to loop through each child node and append
I'm confused. I'm trying to loop though 2 files looking at the first token
I'm trying to sort each Position (which is a list) in a Position list.
I am trying to loop through each value in my dictionary and then go

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.