Hello again,

This is a followup on my problem with getting SeleneseRunner to recognize a function defined in user-extensions. I have a simpler test now.

1. <before> I use the TestSelect test from the dist and run it in TestRunner and through SeleneseRunner using both python and ruby - all three tests succeed

2. <after> Using user-extensions.js, shown below, I modified the tests to use the new 'verifySelectlength' command. The TestRunner test succeeds and both the python and ruby tests fail - the TestRunner log and the SeleneseRunner error are show below. The scripts are also listed below - the only difference between the scripts used in the <before> case and those used in the <after> case is the one line calling 'verifySelectLength'.

Unless I've done something wrong, which is possible :-), there appears to be a problem with the way SeleneseRunner handles user-extensions.js. I can't really pursue this much farther because I'm not sure where to start. If someone could point me in the right direction, I'd be happy to look at this some more.

By the way, these results are from my ibook (10.3.9) - they are consistent with my previous whining, which referred to work done on my linux box (fedora-3)


Thanks,

Warren
++++++++++++++++++++++++++++++
[selenium_driver]$ cat user-extensions.js
alert('start');
Selenium.prototype.assertSelectLength = function(target, num) {
    var element = this.page().findElement(target);

    Assert.equals(parseInt(num), element.options.length);
};
alert('finish');

+++++++++++++++++++++++++++++
TestRunner log

    * Executing: |open | ./tests/html/test_select.html | |
    * Executing: |verifySelectLength | theSelect | 7 |
    * Executing: |assertSelected | theSelect | Second Option |
    * Executing: |select | theSelect | index=4 |
    * Executing: |verifySelected | theSelect | Fifth Option |
    * Executing: |select | theSelect | Third Option |
    * Executing: |verifySelected | theSelect | Third Option |
    * Executing: |select | theSelect | label=Fourth Option |
    * Executing: |verifySelected | theSelect | Fourth Option |
    * Executing: |select | theSelect | value=option6 |
    * Executing: |verifySelected | theSelect | Sixth Option |
    * Executing: |select | theSelect | value= |
    * Executing: |verifySelected | theSelect | Empty Value Option |
    * Executing: |select | theSelect | id=o4 |
    * Executing: |verifySelected | theSelect | Fourth Option |

+++++++++++++++++++++++++++++++++++
[examples]$ cat testselect.py
import xmlrpclib

# Make an object to represent the XML-RPC server.
server_url = "http://localhost:8080/selenium-driver/RPC2";
app = xmlrpclib.ServerProxy(server_url)

# Bump timeout a little higher than the default 5 seconds
app.setTimeout(35)

import os
os.system('sh ./run_firefox.bat')

print app.open('http://localhost:8080/selenium-driver/tests/html/ test_select.html')

print app.verifySelectLength('theSelect', '7')

print app.verifySelected('theSelect', 'Second Option')
print app.select('theSelect','index=4')
print app.verifySelected('theSelect','Fifth Option')
print app.select('theSelect','Third Option')
print app.verifySelected('theSelect','Third Option')
print app.select('theSelect','label=Fourth Option')
print app.verifySelected('theSelect','Fourth Option')
print app.select('theSelect','value=option6')
print app.verifySelected('theSelect','Sixth Option')
print app.select('theSelect','value=')
print app.verifySelected('theSelect','Empty Value Option')
print app.select('theSelect','id=o4')
print app.verifySelected('theSelect','Fourth Option')

print app.testComplete()

+++++++++++++++++++++++++++++++++++
[examples]$ cat testselect.rb
require "xmlrpc/client"

# Make an object to represent the XML-RPC server.
server = XMLRPC::Client.new( "localhost", "/selenium-driver/RPC2", 8080)

# Bump timeout a little higher than the default 5 seconds
server.call('setTimeout',35)

system 'sh ./run_firefox.bat'

puts server.call('open', 'http://localhost:8080/selenium-driver/tests/html/test_select.html')

puts server.call('verifySelectLength','theSelect','7')

puts server.call('verifySelected','theSelect','Second Option')
puts server.call('select','theSelect','index=4')
puts server.call('verifySelected','theSelect','Fifth Option')
puts server.call('select','theSelect','Third Option')
puts server.call('verifySelected','theSelect','Third Option')
puts server.call('select','theSelect','label=Fourth Option')
puts server.call('verifySelected','theSelect','Fourth Option')
puts server.call('select','theSelect','value=option6')
puts server.call('verifySelected','theSelect','Sixth Option')
puts server.call('select','theSelect','value=')
puts server.call('verifySelected','theSelect','Empty Value Option')
puts server.call('select','theSelect','id=o4')
puts server.call('verifySelected','theSelect','Fourth Option')


puts server.call('testComplete')

+++++++++++++++++++++++++++++++++++
[examples]$ python testselect.py
OK
Traceback (most recent call last):
  File "testselect.py", line 15, in ?
    print app.verifySelectLength('theSelect', '7')
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/xmlrpclib.py", line 1029, in __call__
    return self.__send(self.__name, args)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/xmlrpclib.py", line 1316, in __request
    verbose=self.__verbose
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/xmlrpclib.py", line 1080, in request
    return self._parse_response(h.getfile(), sock)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/xmlrpclib.py", line 1219, in _parse_response
    return u.close()
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/xmlrpclib.py", line 742, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 8001: 'function verifySelectLength not found'>

+++++++++++++++++++++++++++++++++++
[examples]$ ruby testselect.rb
OK
/usr/local/lib/ruby/1.8/xmlrpc/client.rb:541:in `do_rpc': Wrong content-type: (RuntimeError)
<?xml version='1.0'?>
<methodResponse>
<fault>
<value><struct>
<member>
<name>faultCode</name>
<value><int>8001</int></value>
</member>
<member>
<name>faultString</name>
<value><string>function verifySelectLength not found</string></value>
</member>
</struct></value>
</fault>
</methodResponse>
        from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:409:in `call2'
        from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:399:in `call'
        from testselect.rb:13

_______________________________________________
Selenium-users mailing list
Selenium-users@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users

Reply via email to