Users Pricing

forum

Home Forums C# - Access variable Names dynamically – MindStick

C# - Access variable Names dynamically

Anonymous User 2755 31 Jan 2014

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 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md