0

I need to write a simple application in C# to read values ​​from excel, which later unearths to change the value of the page using Selenium WebDriver. How to remember which line the program stopped when an error occurred so that you can continue later from where the error occurred?

0

1 Answer 1

1

In your iteration you can use an integer variable and i++ it whenever it reads an item of data from Excel.

In an another approach. You can find the raw by using any internal method of library you are using. It will depend on your library.

Like in Java Workbook library we have a method like

Workbook wb=WorkbookFactory.create(fis);
wb.getSheet(sheetName).getRow(rowNum).getCell(cellNum).getStringCellValue();
Sign up to request clarification or add additional context in comments.

7 Comments

The only thing I was concerned about was that after the error occurred. The file will be read again from the beginning. How and where to save the value of the line, which will remember when the error occurred.
I believe you have any catch block and in that block you can write a operation which will get the last line. Actually it is totally depend upon your framwork. another thing if you using testng or junit then you can write an function in listeners which will run that piece of code for you
ok, but in try catch black i can write value to file or something, but how to read this value when i start test again?
You can set the value on a sheet on excel each time once a raw is executed successfully. If the code fail the catch block will extract the same value and +1 value is the line of code where you are getting error
I dont want write to excel. One thing what i need is to save one value of variable and remember it somewhere. Because when i run test again the value will be 0. int tmp = 0; for (; tmp < 200; tmp++), how save and later read tmp value?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.