How to export validations in javascript

Hi all

I’m exporting my selenium scripts to jruby, but I have some functions in
my
user-extensions.js file, here is one of them

    if

(selenium.browserbot.getCurrentWindow().document.getElementById(id).style.display==‘none’)
{
storedVars[value] = true;
}
else
{
storedVars[value] = false;
}

how can I run that kind of validation in jruby, or how can I execute js
code
in jruby?

Thanks

Why don’t you use json to abstract the javascript information
(serializing and deserializing it)? It will be a bit than running
Nitro to run js server-side.

On Mon, Mar 8, 2010 at 5:11 PM, Moises S. [email protected]
wrote:

    else
    {
        storedVars[value] = false;
    }

how can I run that kind of validation in jruby, or how can I execute js code
in jruby?

Thanks


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

You can continue to use your user-extensions.js file with selenium RC
and
JRuby. See
http://seleniumhq.org/docs/08_user_extensions.html#using-user-extensions-with-selenium-rcfor
information about how to use it. There’s no need to port this code to
ruby if you already have it working in JS.

Joe

On Mon, Mar 8, 2010 at 10:13 AM, Maarten M.

What I have to do is to verify if the element is displayed in the page
or
not, to do that I was thinking in verify if the style.display = ‘none’
or
‘block’, but not sure if this is the best way to check it.

On Mon, Mar 8, 2010 at 10:13 AM, Maarten M.

mmmmm, but I don’t want to use Selenium RC, I’m using celerity.
:S

On Mon, Mar 8, 2010 at 10:11 AM, Moises S. [email protected]
wrote:

Hi all

I’m exporting my selenium scripts to jruby, but I have some functions in my
user-extensions.js file, here is one of them

how can I run that kind of validation in jruby, or how can I execute js code
in jruby?

I’m not quite sure what you need, but you could always pull in Rhino
(the OSS Java-based JavaScript implementation) to run JavaScrit. Since
it’s “just another jar file” it works fine with JRuby.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

thanks Joe “It looks like celerity has a couple “visible?” methods that
should probably work for you” this is what I’m trying to do, I will
research
to see if I can found examples about the “visible?” methods you mention.

thanks

I think if you are moving away from selenium to another product you will
need to look at all your user defined functions and port them one at a
time. There isn’t any general way of just moving all your JS code to
work
with celerity when it was designed to run with selenium.

In the particular JS function you posted, it looks like you are checking
whether a given dom element is visible or not. It looks like celerity
has a
couple “visible?” methods that should probably work for you. You would
check it’s visible status and then run your assertion against the
returned
value.

Joe

On Mon, Mar 8, 2010 at 10:44 AM, Charles Oliver N.

yep thanks, that should work with “visibility”, I have another question
what
about if the element is with display = ‘none’ or block. :S

This is what I was looking at:

http://celerity.rubyforge.org/yard/Celerity/Element.html#visible%3F-instance_method

If Celerity doesn’t expose the functionality you need, you can delve
down into the underlying HtmlUnit to do almost anything.

  • George

Moises S. wrote:

        In the particular JS function you posted, it looks like you

            how can I execute js code
            ---------------------------------------------------------------------
            To unsubscribe from this list, please visit:

               http://xircles.codehaus.org/manage_email



To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs