0

I have written a custom assert function in user-extensions.js that uses a custom locator function - also implemented in user-extensions.js - to locate a particular element on a page.

Without getting into details; I need the custom locator function because I'm trying to locate an element in a different namespace on the page - something Selenium doesn't seem to support natively.

When calling the custom assert function from Selenium IDE, it uses the custom locator function "implicitly" to lookup the element I'm looking for, does the assert and everything works fine. With "implicitly" I mean that I call the assert function with a Target "abc=..." and Selenium IDE then knows that should use the locateElementByAbc locator function to lookup the particular element.

However, when calling the same custom assert function from Selenium RC (Python), using the do_command function in Python, the custom locator function is apparently not called implicitly, and the element is not found.

How do I make my Selenium RC Python script to use the locateElementByAbc function? Note that the user-extensions.js is loaded when starting the Selenium server, so that part is working. The assert function can also be called using the Selenium do_command function from Python.

Thanks for your help, it is well appreciated!

  • Why did you create a new account? Use the same account you used to post http://stackoverflow.com/questions/6747441/cannot-execute-custom-selenium-assert-function-from-user-extensions-js-file-when. – agf Jul 24 '11 at 14:55
  • Please also add some code so people can see what you're doing. – agf Jul 24 '11 at 15:04

1 Answers1

0

The problem is most likely that your custom locator function (LocateElementByMyprefix()) is not being registered. Selenium RC does user-extension.js setup just a little differently from Selenium IDE, and the timing can get in the way. Try calling selenium.browserbot._registerAllLocatorFunctions() after your function is defined.

Ross Patterson
  • 9,527
  • 33
  • 48