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.
Not able to click Menu Item. Requesting Help
Hi,
I have the following script to run. What i am trying to do with this automation script is
1. Login to an application
2. Click a folder (represented as hyper link) in the home page
3. Click a Menu
4. Click a menu item
I am able to go till clicking menu successfully. But, the script fails in clicking menu item
Script fails in the line
_click(top.view.workarea.content.document.getElementsByTagName('div')[450]);
with the following error - "Error: The parameter passed to _click was not found on the browser"
I am getting the same error if i use _click(_div("Import")); to click the menu item ("Import" is the
menu item name). Interestingly, in the sahi recorder, if i click the "Click" button keeping the line "_div("Import")" in the accessor field of the recorder it clicks the "Import" Menu Item.
Here is the complete automation script
_setValue(_textbox("Login_username_0"), "username");
_setValue(_password("Login_password_0"), "password");
_click(_button("Login"));
_assertExists(_span("User Name"));
_assertContainsText("User Name", _span("User Name"));
_click(_span("My Folder"));
_doubleClick(_image("My Folder"));
_click(_div("MenuBar_file_menu_0html_id"));
_click(top.view.workarea.content.document.getElementsByTagName('div')[450]);
_click(_button("Logout"));
Please guide me how to proceed further.
Thanks
I have the following script to run. What i am trying to do with this automation script is
1. Login to an application
2. Click a folder (represented as hyper link) in the home page
3. Click a Menu
4. Click a menu item
I am able to go till clicking menu successfully. But, the script fails in clicking menu item
Script fails in the line
_click(top.view.workarea.content.document.getElementsByTagName('div')[450]);
with the following error - "Error: The parameter passed to _click was not found on the browser"
I am getting the same error if i use _click(_div("Import")); to click the menu item ("Import" is the
menu item name). Interestingly, in the sahi recorder, if i click the "Click" button keeping the line "_div("Import")" in the accessor field of the recorder it clicks the "Import" Menu Item.
Here is the complete automation script
_setValue(_textbox("Login_username_0"), "username");
_setValue(_password("Login_password_0"), "password");
_click(_button("Login"));
_assertExists(_span("User Name"));
_assertContainsText("User Name", _span("User Name"));
_click(_span("My Folder"));
_doubleClick(_image("My Folder"));
_click(_div("MenuBar_file_menu_0html_id"));
_click(top.view.workarea.content.document.getElementsByTagName('div')[450]);
_click(_button("Logout"));
Please guide me how to proceed further.
Thanks
Tagged:
This discussion has been closed.
Comments
Use _div("Import"). The other accessor (div 450) may vary later.
In your application, does the page refresh during any of these lines?
_click(_span("My Folder"));
_doubleClick(_image("My Folder"));
Also, during play back, can you tell us if the _click(_div("MenuBar_file_menu_0html_id")); happens correctly?
It seems to me like a page should have refreshed on clicking or double clicking a link, but the next step happened before the page could refresh, causing subsequent steps to fail.
Thanks for your attempt to solve the problem.
Here are the details:
1. I tried with _div("Import") in the script. But, it didn't work.
2. Yes. The code _click(_span("My Folder")); and _doubleClick(_image("My Folder")); do refresh the page
3. Yes. _click(_div("MenuBar_file_menu_0html_id")); works perfectly fine.
4. I don't think page refresh is the problem. Reason: I first login to the application. It goes fine. Then i click the "My Folder". Though it refreshes the page, it goes fine. Then i doublclick. This also goes fine. Now I am clicking the menu (Note: This menu click doesn't refresh the page. It just drops down a list of menu items). I think this also goes fine. Problem comes only while clicking the Menu Item as per the log message.
I tried using mouseover and link too. It didn't work.
I am posting the log message here.
_setValue(_textbox("Login_username_0"), "username"); at Jul 26, 2009 10:27:49 PM
_setValue(_password("Login_password_0"), "password"); at Jul 26, 2009 10:27:49 PM
_click(_button("Login")); at Jul 26, 2009 10:27:49 PM
_assertExists(_span("User Name")); at Jul 26, 2009 10:27:59 PM
_assertContainsText("User Name", _span("User Name")); at Jul 26, 2009 10:27:59 PM
_click(_span("My Folder")); at Jul 26, 2009 10:27:59 PM
_doubleClick(_image("My Folder")); at Jul 26, 2009 10:28:07 PM
_click(_div("MenuBar_file_menu_0html_id")); at Jul 26, 2009 10:28:18 PM
_click(_div("Import"));
Error: The parameter passed to _click was not found on the browser
One brute force way to verify if it is a timing issue, is to introduce an _wait(2000) between each line after your _assertContainsText.
Let us know the outcome.
Regards,
Narayan
Could you share what fixed the issue? It will help us in future.
Thanks and regards,
Narayan
One small note though. Using hardcoded waits in the script will cause unnecessary delays to your execution. When you have the time, try to remove waits which are not needed and use only those which are required.
I will make a separate post as to when Sahi needs wait statements, and what the best way to use waits is.
Regards,
Narayan