I'm creating some test cases using Selenium WebDriver in C# for a web application. That web application uses different frames for different elements and those frames are not having any Name and ID. After doing some googling I found that frames can be referred with the number too, starting from '0'. So, I used the same; as some of the elements which were throwing error earlier are now working after I used
driver.SwitchTo().Frame(1);
I used it randomly and it worked, but when I use driver.SwitchTo().Frame(0);
for referring to the earlier frame it didn't work, for this I have to use driver.SwitchTo().DefaultContent();
for going back to the last frame.
Questions:
- Is this the correct method of handling frames without Name and ID?
- How to provide correct numbering to frames? Lets say there are 7-8 frames then, how I know which frame is at 0, 1 , 2 ...etc
- Why this reverse method of handling frame is not working?