DataSource C # - Problem reading multiple data

1

I have a code, where it opens the browser and works inside a certain page. On this page, I have some fields, where I look for information from an excel sheet (xlsx). In that same page, there is a zip code field where you have a magnifying glass too (which is used to search for more ZIP code), but when you click on that magnifying glass, it closes my browser and opens the other browser (ie, ).

How do I get it to continue working within this page, without it having to go out and get another data in my excel spreadsheet?

[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 what I'm trying to do.

    
asked by anonymous 02.03.2016 / 12:53

1 answer

0

Try to put these two lines within a for each for each DataRow :

WebDriver.FindElement(By.Id("campo_CEP")).SendKeys(CEP);
WebDriver.FindElement(By.Id("lupa_CEP")).SendKeys(click);
    
01.08.2016 / 18:12