I have following issue:
- I have a checkbox which is hidden and there is another layer used to make it nice and shiny
- I can easily change its value by accessing its ID however I also need to access this element using my custom locator which uses xpath (that has to stay variable)
So, here's my script:
Custom Select Checkbox id=my_checkbox #that works fine
Custom Select Checkbox customLocatorStrat #that doesn't work at all
*** Keywords ***
Custom Select Checkbox
[Arguments] ${locator} ${timeout}=${global_timeout}
Execute Javascript document.getElementById("${resultLocator}").checked = true;
OR
${el}.checked = true; #need to get the ${el} variable if the ${locator is not an id}
My Custom Locator
[Arguments] ${criteria} ${tag} ${constraints}
... #assembling xpath
${el}= Get Webelements xpath=${path}
[Return] ${el}
There is no issue with the locator strategy - it workes fine. I only need to use it/force it in my Custom Select Checkbox keyword. I need to get the ${el} variable and considering there's more than one Custom Locator keyword calling it directly will not work for me. Any idea how to do this please? Many thanks in advance.
You can get the variable before executing ${el}.checked = true;
Custom locators in the selenium2library require activation through the
Add Location Strategy
[Doc]. This seems to me to be the missing from your example.