Datasource C# - Problem reading multiple data

Asked

Viewed 61 times

1

I have a code, where he opens the browser and works within a certain page. On this page, I have some fields, where I look for information from a spreadsheet in excel (xlsx). On this same page, there is a zip code field where there is a magnifying glass (which serves to search for more zip code), however, when clicking this magnifying glass, it closes my browser and opens the other browser (that is, taking the next data of the spreadsheet in excel).

How I get him to keep working inside this page, without him having to go out and get another data in my spreadsheet in excel?

[CodedUITest]
public class TesteCEP: loginSistema
{
    //Test case nº...

    [TestMethod]
    [DeploymentItem("Teste\\ArquivoExcel.xlsx")]
    [DataSource("ExcelCEP")]
    [DeploymentItem("Teste\\chromedriver.exe")]
    public void testarCEP()
    {
        LogarNoSistema();

        //Inicio Código
        //Declaração de variáveis
        var cep = this.TestContext.DataRow["CEP"].ToString();
        ...  
        WebDriver.FindElement(By.Id("campo_CEP")).SendKeys(CEP);
        WebDriver.FindElement(By.Id("lupa_CEP")).SendKeys(click);
       }
    }

This is a demonstration, trying to explain a little better than I’m trying to do.

1 answer

0

Try to place these two lines inside a for each for each DataRow:

WebDriver.FindElement(By.Id("campo_CEP")).SendKeys(CEP);
WebDriver.FindElement(By.Id("lupa_CEP")).SendKeys(click);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.