loop through UI elements
Posted: Fri Nov 30, 2018 10:50 pm
hello,
iam trying to loop through 11 Li elements to extract the inner text of h2 and h3 tags. iam getting errors below. please help
this is my sample code
void ITestModule.Run()
{
Mouse.DefaultMoveTime = 300;
Keyboard.DefaultKeyPressTime = 100;
Delay.SpeedFactor = 1.0;
var repo = BottomLineIIRepository.Instance;
var accname = repo.DigitalBanking.Accounts.accname;
var checkingacccont = repo.DigitalBanking.Accounts.checkingacccont;
var cardslist = repo.DigitalBanking.Accounts.cardslist;
//string[] list= new string[] {(List)cardslist};
IList mylist = accname.InnerText.ToList();
string acc_name = "";
foreach (var accname in accname)
acc_name=accname.GetAttributeValueText();
the error is:
A local variable named 'accname' cannot be declared in this scope because it would give a different meaning to 'accname', which is already used in a 'parent or current' scope to denote something else (CS0136) - C:\Dev\Git\Online\BottomLineII\BottomLineII\Small Business\Accounts\accountvalidation.cs:58,26
foreach statement cannot operate on variables of type 'Ranorex.H2Tag' because 'Ranorex.H2Tag' does not contain a public definition for 'GetEnumerator' (CS1579) - C:\Dev\Git\Online\BottomLineII\BottomLineII\Small Business\Accounts\accountvalidation.cs:58,13
iam attaching scapshot of the elements iam trying to loop.
iam trying to loop through 11 Li elements to extract the inner text of h2 and h3 tags. iam getting errors below. please help
this is my sample code
void ITestModule.Run()
{
Mouse.DefaultMoveTime = 300;
Keyboard.DefaultKeyPressTime = 100;
Delay.SpeedFactor = 1.0;
var repo = BottomLineIIRepository.Instance;
var accname = repo.DigitalBanking.Accounts.accname;
var checkingacccont = repo.DigitalBanking.Accounts.checkingacccont;
var cardslist = repo.DigitalBanking.Accounts.cardslist;
//string[] list= new string[] {(List)cardslist};
IList mylist = accname.InnerText.ToList();
string acc_name = "";
foreach (var accname in accname)
acc_name=accname.GetAttributeValueText();
the error is:
A local variable named 'accname' cannot be declared in this scope because it would give a different meaning to 'accname', which is already used in a 'parent or current' scope to denote something else (CS0136) - C:\Dev\Git\Online\BottomLineII\BottomLineII\Small Business\Accounts\accountvalidation.cs:58,26
foreach statement cannot operate on variables of type 'Ranorex.H2Tag' because 'Ranorex.H2Tag' does not contain a public definition for 'GetEnumerator' (CS1579) - C:\Dev\Git\Online\BottomLineII\BottomLineII\Small Business\Accounts\accountvalidation.cs:58,13
iam attaching scapshot of the elements iam trying to loop.