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.
Help reqd: Verfiying a file ulpload in popup window
Hi,
I am new to Sahi. I am trying check the file upload element in a popup window. The assertion for file is failing. I am not able o figure out wats the problem. I was able to verify links, buttons & texts. Please reply asap.
Below is the script that I used:
function checkUsr($username,$password)
{
//Form.jsp
_setValue(_textbox("username"),$username);
_setValue(_password("pass"),$password);
_click(_submit("submit"));
//success.jsp
_assertNotNull(_link("Back"));
_assertNotNull(_link("popLink"));
_assertExists(_span("msg"), "This is success page.");
//pop.jsp
_click(_link("popLink"));
_assertExists(_popup("popup")._span("popMsg"), "This is a popup window");
_assertNotNull(_popup("popup")._setFile(_file("test_file"), "test.txt"));
_assertExists(_popup("popup")._button("popClose"));
_assertNotNull(_popup("popup")._submit("submit"));
_click(_popup("popup")._button("popClose"));
_navigateTo("/SahiExample/Form.jsp");
}
//test cases
//valid data
checkUsr("nilesh","jug");
//password empty
checkUsr("nilesh","sdf");
//username empty
checkUsr("sdf","jug");
//empty username & password
checkUsr("sdfd","sd");
Following is the Log:
_setValue(_textbox("username"),"nilesh"); at Dec 30, 2010 10:50:54 AM
_setValue(_password("pass"),"jug"); at Dec 30, 2010 10:50:54 AM
_click(_submit("submit")); at Dec 30, 2010 10:50:54 AM
_assertNotNull(_link("Back")); at Dec 30, 2010 10:50:55 AM
_assertNotNull(_link("popLink")); at Dec 30, 2010 10:50:55 AM
_assertExists(_span("msg"), "This is success page."); at Dec 30, 2010 10:50:55 AM
_click(_link("popLink")); at Dec 30, 2010 10:50:55 AM
_assertExists(_popup("popup")._span("popMsg"), "This is a popup window"); at Dec 30, 2010 10:50:56 AM
_assertNotNull(_popup("popup")._setFile(_file("test_file"), "test.txt"));
Assertion Failed. at Dec 30, 2010 10:51:06 AM
_assertExists(_popup("popup")._button("popClose")); at Dec 30, 2010 10:51:08 AM
_assertNotNull(_popup("popup")._submit("submit")); at Dec 30, 2010 10:51:08 AM
_click(_popup("popup")._button("popClose")); at Dec 30, 2010 10:51:08 AM
_navigateTo("/SahiExample/Form.jsp"); at Dec 30, 2010 10:51:08 AM
I am new to Sahi. I am trying check the file upload element in a popup window. The assertion for file is failing. I am not able o figure out wats the problem. I was able to verify links, buttons & texts. Please reply asap.
Below is the script that I used:
function checkUsr($username,$password)
{
//Form.jsp
_setValue(_textbox("username"),$username);
_setValue(_password("pass"),$password);
_click(_submit("submit"));
//success.jsp
_assertNotNull(_link("Back"));
_assertNotNull(_link("popLink"));
_assertExists(_span("msg"), "This is success page.");
//pop.jsp
_click(_link("popLink"));
_assertExists(_popup("popup")._span("popMsg"), "This is a popup window");
_assertNotNull(_popup("popup")._setFile(_file("test_file"), "test.txt"));
_assertExists(_popup("popup")._button("popClose"));
_assertNotNull(_popup("popup")._submit("submit"));
_click(_popup("popup")._button("popClose"));
_navigateTo("/SahiExample/Form.jsp");
}
//test cases
//valid data
checkUsr("nilesh","jug");
//password empty
checkUsr("nilesh","sdf");
//username empty
checkUsr("sdf","jug");
//empty username & password
checkUsr("sdfd","sd");
Following is the Log:
_setValue(_textbox("username"),"nilesh"); at Dec 30, 2010 10:50:54 AM
_setValue(_password("pass"),"jug"); at Dec 30, 2010 10:50:54 AM
_click(_submit("submit")); at Dec 30, 2010 10:50:54 AM
_assertNotNull(_link("Back")); at Dec 30, 2010 10:50:55 AM
_assertNotNull(_link("popLink")); at Dec 30, 2010 10:50:55 AM
_assertExists(_span("msg"), "This is success page."); at Dec 30, 2010 10:50:55 AM
_click(_link("popLink")); at Dec 30, 2010 10:50:55 AM
_assertExists(_popup("popup")._span("popMsg"), "This is a popup window"); at Dec 30, 2010 10:50:56 AM
_assertNotNull(_popup("popup")._setFile(_file("test_file"), "test.txt"));
Assertion Failed. at Dec 30, 2010 10:51:06 AM
_assertExists(_popup("popup")._button("popClose")); at Dec 30, 2010 10:51:08 AM
_assertNotNull(_popup("popup")._submit("submit")); at Dec 30, 2010 10:51:08 AM
_click(_popup("popup")._button("popClose")); at Dec 30, 2010 10:51:08 AM
_navigateTo("/SahiExample/Form.jsp"); at Dec 30, 2010 10:51:08 AM
This discussion has been closed.
Comments
Replace popup code with this:
Regards,
Narayan
This worked.
-Nilesh