我无法在C#visual studio中获取硒的.Click()intellisense
本文关键字:Click intellisense 获取 C#visual studio | 更新日期: 2023-09-27 18:21:13
这是我的代码。简单登录的形式,我想点击不能访问您的帐户,在C#中使用visual studio 13,测试脚本selenium。提前谢谢。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Chrome;
using System.Threading;
namespace test1
{
class Program
{
static void Main(string[] args)
{
var driver = new FirefoxDriver();
driver.Url = "http://mysite/Account/Login";
driver.FindElements(By.LinkText("Can't access your account?")).
}
}
}
web元素数组上没有可用的Click()
方法。替换:
driver.FindElements(By.LinkText("Can't access your account?")).Click();
带有:
driver.FindElement(By.LinkText("Can't access your account?")).Click();
看"s"。
try:
static void Main(string[] args)
{
var driver = new FirefoxDriver();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(30));
driver.Navigate().GoToUrl("http://mysite/Account/Login");
driver.FindElement(By.LinkText("Can't access your account?")).Click();
}