html code:
<iframe title="javascript:''" src="PageName.aspx" _events="[object Object]">
<htlml>
<head>
<body>
<form name="FormName">
<div>
<span>
<input name="ButtonName>
My question: how can I find the element with name "ButtonName"? My current code in C#
//To find the iframe
IWebElement Object = driver.FindElement(By.XPath("XPath to the iframe"); //works
//To switch to and set focus to the iframe
driver.SwitchTo().Frame(Object); //works
//To find element with name "ButtonName"
IWebElement Button = driver.FindElement(By.Name("ButtonName")); //error: cannot find the element
Any help is appreciated.