I want to go through my dropdown menu and check if the correct page is opened.
Here is what have I done so far and faced the Keyword ‘Functions.Check if user is navigated to the corresponding category page’ expected 1 argument, got 0.
Show the code where you call Check if user is navigated to the corresponding category page. You probably did not pass a list variable to the argument ${Dropdown_menu_options}.
No sure ,what is best approach to automate the testing of a dropdown menu with multiple options, where each option navigates to a corresponding page?
Is my start good actual with this approach ?
Well, you did not show the calling of Check if user is navigated to the corresponding category, bu I do see your calling of Validate the [Category] is displayed if the dropdown index is [2].
This is calling an embedded arguments keyword. Originally, maybe before Robot Framework 6, it was only possible to use embedded arguments or positional/named arguments, but not simultaneously.
Embedded arguments is not a good strategy when passing lists. But possible.
In your case you could have:
*** Keywords ***
Validate the [${Category}] is displayed if the dropdown index is [${index}]
Should Be True "${Category}" "${my_list_of_categories[${index}]}"
There’s a couple of syntax issues I see, so let’s deal with them first:
You for is iterating over a scalar:
You didn’t show what the contents of ${Dropdown_menu_options} looks like? So I’ll guess it’s a list something like ['page1', 'page2', 'page3']
When you do this:
FOR ${option} IN ${Dropdown_menu_options}
On the first iteration ${option} is ['page1', 'page2', 'page3'], and then on the second iteration it’s nothing so that’s the end of the loop, I’m guessing that’s not what you want?
So try this:
FOR ${option} IN @{Dropdown_menu_options}
Notice ${Dropdown_menu_options} changes to @{Dropdown_menu_options}, this tells RF that it’s a lit of things to iterate the FOR loop over