Skip to main content

Não estou conseguindo utilizar o método FirstOrDefault com o selenium

 public IWebElement RetornaRegistro(string titulo)
    {
        var trs = _driver.FindElement(By.CssSelector("table tbody tr"));
        var alvo = trs.FirstOrDefault(tr => tr.Text.Contains(titulo));

        if (alvo == null)
        {
            throw new System.ArgumentException("Erro ao buscar a tarefa cadastrada.");
        }

        return alvo;
    }
public IWebElement RetornaRegistro(string titulo)
{
    var trs = _driver.FindElement(By.CssSelector("table tbody tr"));
    var alvo = trs.FirstOrDefault(tr => tr.Text.Contains(titulo));

    if (alvo == null)
    {
        throw new System.ArgumentException("Erro ao buscar a tarefa cadastrada.");
    }

    return alvo;
}

Apresenta o seguinte erro: Severity Code Description Project File Line Suppression State Error CS1061 'IWebElement' does not contain a definition for 'FirstOrDefault' and no extension method 'FirstOrDefault' accepting a first argument of type 'IWebElement' could be found (are you missing a using directive or an assembly reference?) Mark7 C:\Users\rodrigo.rebes\source\repos\Mark7\Mark7\Pages\TaskPage.cs 33 Active

Severity Code Description Project File Line Suppression State Error CS1061 'IWebElement' does not contain a definition for 'FirstOrDefault' and no extension method 'FirstOrDefault' accepting a first argument of type 'IWebElement' could be found (are you missing a using directive or an assembly reference?) Mark7 C:\Users\rodrigo.rebes\source\repos\Mark7\Mark7\Pages\TaskPage.cs 33 Active

Não estou conseguindo utilizar o método FirstOrDefault com o selenium

 public IWebElement RetornaRegistro(string titulo)
    {
        var trs = _driver.FindElement(By.CssSelector("table tbody tr"));
        var alvo = trs.FirstOrDefault(tr => tr.Text.Contains(titulo));

        if (alvo == null)
        {
            throw new System.ArgumentException("Erro ao buscar a tarefa cadastrada.");
        }

        return alvo;
    }

Apresenta o seguinte erro: Severity Code Description Project File Line Suppression State Error CS1061 'IWebElement' does not contain a definition for 'FirstOrDefault' and no extension method 'FirstOrDefault' accepting a first argument of type 'IWebElement' could be found (are you missing a using directive or an assembly reference?) Mark7 C:\Users\rodrigo.rebes\source\repos\Mark7\Mark7\Pages\TaskPage.cs 33 Active

Não estou conseguindo utilizar o método FirstOrDefault com o selenium

public IWebElement RetornaRegistro(string titulo)
{
    var trs = _driver.FindElement(By.CssSelector("table tbody tr"));
    var alvo = trs.FirstOrDefault(tr => tr.Text.Contains(titulo));

    if (alvo == null)
    {
        throw new System.ArgumentException("Erro ao buscar a tarefa cadastrada.");
    }

    return alvo;
}

Apresenta o seguinte erro:

Severity Code Description Project File Line Suppression State Error CS1061 'IWebElement' does not contain a definition for 'FirstOrDefault' and no extension method 'FirstOrDefault' accepting a first argument of type 'IWebElement' could be found (are you missing a using directive or an assembly reference?) Mark7 C:\Users\rodrigo.rebes\source\repos\Mark7\Mark7\Pages\TaskPage.cs 33 Active

Fonte Link

Não consigo utilizar o método FirstOrDefault em um tipo IWebElement

Não estou conseguindo utilizar o método FirstOrDefault com o selenium

 public IWebElement RetornaRegistro(string titulo)
    {
        var trs = _driver.FindElement(By.CssSelector("table tbody tr"));
        var alvo = trs.FirstOrDefault(tr => tr.Text.Contains(titulo));

        if (alvo == null)
        {
            throw new System.ArgumentException("Erro ao buscar a tarefa cadastrada.");
        }

        return alvo;
    }

Apresenta o seguinte erro: Severity Code Description Project File Line Suppression State Error CS1061 'IWebElement' does not contain a definition for 'FirstOrDefault' and no extension method 'FirstOrDefault' accepting a first argument of type 'IWebElement' could be found (are you missing a using directive or an assembly reference?) Mark7 C:\Users\rodrigo.rebes\source\repos\Mark7\Mark7\Pages\TaskPage.cs 33 Active