The website has the following elements:
It has 3 different frames, how do I navigate myself to the desired frame?
In my following code, using trial and errors I found that frameIndex = 1
allows me to find those elements (welcome, config, instruments, etc).
But does this index number stay the same all the time? Is there a more reliable way for me to know which frame is which?
[TestClass]
public class Test2
{
IWebDriver driver;
string url = "http://10.116.33.6/";
[TestInitialize]
public void TestSetup()
{
var IEOption = new InternetExplorerOptions();
var IEService = InternetExplorerDriverService.CreateDefaultService();
IEOption.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
IEOption.IgnoreZoomLevel = true;
IEService.HideCommandPromptWindow = true;
driver = new InternetExplorerDriver(IEService, IEOption);
driver.Navigate().GoToUrl(url);
}
[TestMethod]
public void NavigateMenu()
{
driver.SwitchTo().Frame(1);
var welc = driver.FindElement(By.Name("welcome"));
var conf = driver.FindElement(By.Name("config")) ;
var inst = driver.FindElement(By.Name("instruments"));
var stat = driver.FindElement(By.Name("status")) ;
var help = driver.FindElement(By.Name("help")) ;
conf.Click();
}
}