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 8927769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:17:15+00:00 2026-06-15T08:17:15+00:00

I am automating a web page. i have captured and saved the Links in

  • 0

I am automating a web page. i have captured and saved the Links in a file.

Link Url_0="gmail.com"
Link Url_1="ymail.com"
Link Url_2="hotmail.com"
Link Url_3="outlook.com"

The below statement will click on each url.

HomePage.Url_0.Click();//Homepage is the Class name

I want to Click these URLs one by one. So I am using a for loop.

for(int i=0;i<3;i++)
{
String url=String.Format("Url_{0}",i);
HomePage.url.Click(); //This is throwing me error (I think that this is not correct way to do.)
Sleep(2000);
}

How can I proceed here ? Can this be done in any way ? Any help is appreciated.

  • 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-06-15T08:17:16+00:00Added an answer on June 15, 2026 at 8:17 am

    You should put the variables into a collection, rather than having a different variable with a different name for each. It’s technically possible to access the variable in the manor you describe, but it’s not what a language like C# is designed to do, and would be very bad practice.

    There are several collections to choose from. Here a List is probably appropriate, an array could work as well.

    List<string> urls = new List<string>()
    {
        "gmail.com",
        "ymail.com",
        "hotmail.com",
        "outlook.com"
    };
    
    foreach (string url in urls)
    {
        //do whatever with the url
        Console.WriteLine(url);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web page with an embedded text file. The text file is
I have a C++ library (Win32) that fills some fields in a web page
I have an asp.net web application in c# script. I want this application page
I have a variety of image sets that I'm displaying on a web page
I have a complete automatic notification system running on my web page, that is
I have a web page that basically contains a large table, I use ajax
i am autpmating a web site that have different function page. i am making
I have a web page that contains a few <section> s that should be
I want to start automating more of my web development process so I'm looking
I have a web app (MVC) where I need some automatic service to run

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.