1

I just started using selenium webdriver. I am trying to find an input field located in a table (can be found here https://i.stack.imgur.com/H1ZMt.jpg)

I've tried right clicking -> Copy -> Copy XPath, but when I start my program, i get the following error:

Unable to locate element: {"method":"xpath","selector":"/html/body/div/table[2]/tbody/tr[3]/td[2]/input"}

The input field I would like to find is the one called "loginanvid". Any help is appreciated.

1 Answers1

2

For switching to Iframe use this code:

IWebElement iframeEle = driver.FindElement(By.Name("main")); driver.SwitchTo().Frame(iframeEle);  

then use this Xpath :

//tr[@class='bgmork']/descendant::input[@name='loginanvid']
cruisepandey
  • 28,520
  • 6
  • 20
  • 38