html代码:
<iframe title="javascript:''" src="PageName.aspx" _events="[object Object]">
<htlml>
<head>
<body>
<form name="FormName">
<div>
<span>
<input name="ButtonName>
我的问题:如何找到名称为“ButtonName”的元素?我当前的 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
任何帮助表示赞赏。