C# 在web窗体的字段集中查找元素

C# 在web窗体的字段集中查找元素,c#,selenium,C#,Selenium,对于selenium来说,c#是个新手,我试图在字段集表单上找到单选按钮: driver.FindElement(By.TagName("html")).Click(); driver.SwitchTo().Frame(".//*[@id='fieldset'"); driver.FindElement(By.XPath("(//a[contains(text(),'Complaints and suggestions')])[2]")).Clic

对于selenium来说,c#是个新手,我试图在字段集表单上找到单选按钮:

        driver.FindElement(By.TagName("html")).Click();
        driver.SwitchTo().Frame(".//*[@id='fieldset'");
        driver.FindElement(By.XPath("(//a[contains(text(),'Complaints and suggestions')])[2]")).Click();
        driver.FindElement(By.CssSelector(".wpcf7-list-item.first>label>input")).Click();

        driver.FindElement(By.XPath("//input[@name='CatalystResident' value='Yes']")).Click();
        var location = driver.FindElement(By.ClassName("wpcf7-form-control wpcf7-select wpcf7-validates-as-required"));
        SelectElement catalystLocation = new SelectElement(location);
        catalystLocation.SelectByText("London-Brent");
找不到获取错误消息元素。谢谢

相关html代码

<div class="anti-social-form">


您确定它在页面上吗?您是否已尝试使用wait()一段确定的时间来查看它是否出现?您是否可以共享相关的html?相关的html代码