Selenium User Extension: Unknown Command

So at work we are setting up a selenium RC 1 grid. We decided to use RC1 and not web drivers since we can setup user-extensions to create locations and custom actions for our QA team.

We’ve slowly got the grid running with our python test cases running the client drivers. Somewhere in the setup (we still don’t know the cause) our user extensions weren’t working anymore. We would receive the Unknown Command error from the selenium nodes. Testing on the ide confirmed we had the user extension correctly written because they would run in the ide.

After some research I came across Stuvel’s blog post about the same issue. For some reason this fix didn’t work for me. So after some digging around in the selenium source I came up with a slight modification to Stuvel’s fix, but the concept of what is happening is the same.

1
2
3
4
5
//This is a fix to get the user-extensions working for RC.  The check is to prevent a runtime error in the IDE
//since the IDE does not contain command factory.
if(this['commandFactory']){
    commandFactory.registerAll(selenium);
}

Place the above code at the bottom of your user extension file. Hopefully this works for you as it did for me. Let me know how it goes in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *