C# 无法使用XPath-NoTouchElementException查找元素

C# 无法使用XPath-NoTouchElementException查找元素,c#,selenium,xpath,webdriver,C#,Selenium,Xpath,Webdriver,我试图在c#中使用Selenium web驱动程序查找元素。 我的代码是: var pathToLinkGeneral = Driver.FindElement(By.XPath("//div[@class='form-control'][label[text()='Get direct link:']]/input")); 第页中的源代码是: <div class="form-group"> <label>Get direct link:</label>

我试图在c#中使用Selenium web驱动程序查找元素。 我的代码是:

var pathToLinkGeneral = Driver.FindElement(By.XPath("//div[@class='form-control'][label[text()='Get direct link:']]/input"));
第页中的源代码是:

<div class="form-group">
<label>Get direct link:</label>
<input class="form-control" type="text" style="cursor: auto; value="http://ds2.dev.polebeary.com/api/download/1521723231257836/qa_yaakov_tevel.dmg" readonly="">
有人能帮忙吗?

这应该有帮助:

var pathToLinkGeneral = Driver.FindElement(By.XPath("//div[@class='form-group'][label[text()='Get direct link:']]/input"));

您需要的是表单组,而不是控件

div具有类
表单组
,而不是
表单控件
var pathToLinkGeneral = Driver.FindElement(By.XPath("//div[@class='form-group'][label[text()='Get direct link:']]/input"));