Forum Discussion
rraghvani
Please, what version of Windows are you using? I'm using Windows 11 Pro 24H2 edition.
Regarding the incorrect way we're using it, I discussed it internally and we couldn't agree that it's wrong, especially since we've been using this standard here for years, since we started automating the company, and we've never had this type of problem. We believe that if it were incorrect, it wouldn't have worked from the start.
We also tried to reproduce the scenario you described (we copied your code exactly) and we couldn't get it to work in either Windows 10 or Windows 11, which gave the same error. We tried another way but were unsuccessful, as it always presented a similar error.
We made changes and adjustments to work around the error and arrived at the code below. We also had to change the file extension to .xls, which prevented the print error, but we still couldn't inspect the variable via Alt+W. The same problem occurred: TestComplete froze and closed.
Note: This same code caused the problem in Windows 11, but I didn't have the problem in Windows 10 and the inspection went through normally.
function Test()
{
if (!Project.Variables.VariableExists("DadosPedidoComercial")) {
Project.Variables.AddVariable("DadosPedidoComercial", "Table");
}
var t = Project.Variables.VariableByName("DadosPedidoComercial");
if (t.ColumnCount == 0) {
t.AddColumn('nCdPedidoComercial');
t.AddColumn('nCdUsuarioResponsavel');
t.AddColumn('nCdEmpresa');
t.AddColumn('nCdModalidadeBoleto');
t.AddColumn('nPreco');
t.AddColumn('nQtde');
}t.RowCount = 0;
var row = 0;
var caminho = "C:\\Temp\\Book1.xls";
var nomeAba = "Dados";var excelDriver = DDT.ExcelDriver(caminho, nomeAba, true);
if (excelDriver != null) {
try {
while (!excelDriver.EOF())
{
t.RowCount = row + 1;
t.$set("nCdPedidoComercial", row, excelDriver.Value(0));
t.$set("nCdUsuarioResponsavel", row, excelDriver.Value(1));
t.$set("nCdEmpresa", row, excelDriver.Value(2));
t.$set("nCdModalidadeBoleto", row, excelDriver.Value(3));
t.$set("nPreco", row, excelDriver.Value(4));
t.$set("nQtde", row, excelDriver.Value(5));
row++;
excelDriver.Next();
}
} catch (e) {
Log.Error("Erro ao ler linha do Excel: " + e.message);
}
DDT.CloseDriver(excelDriver.Name);
} else {
Log.Error("Erro 'Sheet1$' detectado. Ação necessária: Abra o seu arquivo Excel e renomeie a aba de 'Sheet1' para 'Dados' e tente novamente.");
}if (t.RowCount > 0) {
Log.Message("Total de linhas importadas: " + t.RowCount);
}
}
This is my version of Windows
Could you try - change your Windows language settings to English. Create a new project in TestComplete, and try the example that I have provided please? Create an Excel spreadsheet with six columns with data.
Excel 365
- Modesto10 days agoOccasional Contributor
Regarding changing the language, I tried here and couldn't. I sought help from our support team, and this change is blocked on our network.
However, I adjusted the tab name in the spreadsheet, and this error occurred with your code. We made the adjustment, but the same problem persists; TestComplete froze and closed.
- rraghvani10 days ago
Champion Level 3
You are still using your existing project - create a new project as your current project settings may cause issues.
It also seems like you are not using the exact code that I had provided, as I am only passing two parameters -
DDT.ExcelDriver("C:\\Temp\\Book1.xlsx", "Sheet1");and you seem to have two DDT's (on line 23 and 26)!
- Modesto8 days agoOccasional Contributor
rraghvani
I wanted to thank you for your help and availability. We've run several test scenarios here over the past few days, all without success. The understanding here is unanimous that TestComplete needs an update to be executed correctly in this version of Windows regarding the debug function.
We are internally studying what actions we will take. Everything indicates that reverting to Windows version 10 is the best option, although it's not the best choice.
Thank you for now.