18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Issues with Javascript and _lastAlert()
Hi Narayan.
I'm having some problems while i try to do an assertion in a multiline alert.
The text that I expect in the alert, its the same that the alert returns to me, but Sahi keeps saying that it isn't the same.
Let me show you the code:
And the alert:
As you can see, they are EXACTLY the same.
In the source code of the log we can see the same thing:
I have two images of the log:
Can you help me with this?
I'm having some problems while i try to do an assertion in a multiline alert.
The text that I expect in the alert, its the same that the alert returns to me, but Sahi keeps saying that it isn't the same.
Let me show you the code:
function test(){
save();
var $text = "Verifique se todos os campos obrigat?s foram preenchidos.\n\nProduto:required.\nDescri? oficial:required.\nDescri? usual:required.\nFabricante:required.\nUnidade de compra:required.\nRela?:required.\nUnidade de estoque:required.\nRela?:required.\nEstoque m?mo:required.\nEstoque m?mo:required.\nPrazo de validade (dias):required.\nLocal de armazenamento:required.\nTipo:required.\n1. Agrupamento:required.\n2. Agrupamento:required.\nValor compra inicial:required.";
var $text2 = "Verifique se todos os campos obrigatórios foram preenchidos.\n\nProduto:required.\nDescrição oficial:required.\nDescrição usual:required.\nFabricante:required.\nUnidade de compra:required.\nRelação:required.\nUnidade de estoque:required.\nRelação:required.\nEstoque mínimo:required.\nEstoque máximo:required.\nPrazo de validade (dias):required.\nLocal de armazenamento:required.\nTipo:required.\n1. Agrupamento:required.\n2. Agrupamento:required.\nValor compra inicial:required.\n";
_popup("elis57772cspshivas00iuLogincls")._assertEqual($text, _lastAlert());
_popup("elis57772cspshivas00iuLogincls")._assertEqual($text2, _lastAlert());
}
And the alert:
http: // img717.imageshack.us/img717/6924/sahijs3.jpg
As you can see, they are EXACTLY the same.
In the source code of the log we can see the same thing:
Expected:[Verifique se todos os campos obrigat?s foram preenchidos.<br/><br/>Produto:required.<br/>Descri? oficial:required.<br/>Descri? usual:required.<br/>Fabricante:required.<br/>Unidade de compra:required.<br/>Rela?:required.<br/>Unidade de estoque:required.<br/>Rela?:required.<br/>Estoque m?mo:required.<br/>Estoque m?mo:required.<br/>Prazo de validade (dias):required.<br/>Local de armazenamento:required.<br/>Tipo:required.<br/>1. Agrupamento:required.<br/>2. Agrupamento:required.<br/>Valor compra inicial:required.
Actual:[Verifique se todos os campos obrigat?s foram preenchidos.<br/><br/>Produto:required.<br/>Descri? oficial:required.<br/>Descri? usual:required.<br/>Fabricante:required.<br/>Unidade de compra:required.<br/>Rela?:required.<br/>Unidade de estoque:required.<br/>Rela?:required.<br/>Estoque m?mo:required.<br/>Estoque m?mo:required.<br/>Prazo de validade (dias):required.<br/>Local de armazenamento:required.<br/>Tipo:required.<br/>1. Agrupamento:required.<br/>2. Agrupamento:required.<br/>Valor compra inicial:required.
Expected:[Verifique se todos os campos obrigatórios foram preenchidos.<br/><br/>Produto:required.<br/>Descrição oficial:required.<br/>Descrição usual:required.<br/>Fabricante:required.<br/>Unidade de compra:required.<br/>Relação:required.<br/>Unidade de estoque:required.<br/>Relação:required.<br/>Estoque mínimo:required.<br/>Estoque máximo:required.<br/>Prazo de validade (dias):required.<br/>Local de armazenamento:required.<br/>Tipo:required.<br/>1. Agrupamento:required.<br/>2. Agrupamento:required.<br/>Valor compra inicial:required.
Actual:[Verifique se todos os campos obrigat?s foram preenchidos.<br/><br/>Produto:required.<br/>Descri? oficial:required.<br/>Descri? usual:required.<br/>Fabricante:required.<br/>Unidade de compra:required.<br/>Rela?:required.<br/>Unidade de estoque:required.<br/>Rela?:required.<br/>Estoque m?mo:required.<br/>Estoque m?mo:required.<br/>Prazo de validade (dias):required.<br/>Local de armazenamento:required.<br/>Tipo:required.<br/>1. Agrupamento:required.<br/>2. Agrupamento:required.<br/>Valor compra inicial:required.
I have two images of the log:
http: // img690.imageshack.us/img690/2158/sahijs.jpg
http: // img341.imageshack.us/img341/5998/sahijs2.jpg
Can you help me with this?
Comments
After the last update, it's working fine with the following code:
Thank you very much!!!
I have the following assertions:
When I run a script with only these two assertions (of course that the script also access the system, the page that I'll test and clicks on one or two buttons), the assertions works fine as you can see here:
But when I integrate these two assertions with my full test script, it always fail:
What could this be?
Change the file encoding of the .sah file to UTF-8. You may have to re-copy the assertions, since the initial characters are in some other encoding.
That should fix it.
Regards,
Narayan
Its perfect now.