Remote Robot Framework with Selenium2Library

1,708 views
Skip to first unread message

alans09

unread,
Oct 30, 2013, 1:46:22 AM10/30/13
to robotframe...@googlegroups.com
Hi all, 
 
 I'm kind of new user of robotframework. I have one question. I need to run robot from one place and tests from another.  I found that there exists remote library that works as xml-rpc proxy. Problem is that I cant find proper way how to use it with selenium2library on remote machine.

Can somebody help me with this?  I just need to 'send' commands to other machine and execute them on that remote machine.

Thank you in advance


Tomas

Tatu Aalto

unread,
Oct 30, 2013, 2:19:33 AM10/30/13
to ala...@gmail.com, robotframework-users

Ugh

Could you tell more about your requirements?  Is your purpose to open the browser in local or remote machine (both are possible, with standard tools). And do you just want to use Selenium2Library keywords from/to remote machine or do you want use other libraries too?

-Tatu

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/groups/opt_out.

alans09

unread,
Oct 30, 2013, 3:31:23 AM10/30/13
to robotframe...@googlegroups.com, ala...@gmail.com
So.

I have very complex test environment. Testing of web environment is only one part of it.
We have our own keyword framework (xmlrpc, tool independent) but unluckily our main developer left team and we don't have right person to finish ours framework. 

So I have about 22 virtual machines with different Operating systems and configurations. I have also different browsers and different application (outlook, notepad, excel, web applications...)
We are able do develop our own selenium connector that will fits to our framework but problem is that our framework is 'dead' for now.

What I need is to execute keywords on remote machines. That means I have one 'TestExecution Server with robot in it' and 22 client machines.  I need to spawn (using jenkins) 22 browsers on 22 different machines and do some tests.

So I need way how to "Include selenium2library" to remote xmlrpc server in order to send keywords from TestExecution server to that remote machines.
                  
If this will be successful I can start with changing our ranorex xmlrpc server , that is able to execute keywords using ranorex to one that will be supported by robot framework.

I will be also in need of androind testing, but that is another story.

My example testcase consist of:
--------------------------------------------------
Install .net application   #using ranorex xmlrpc connector   
   step 1 
   step 2
   step 3
Open Browser and Navigate to page "xy"  # I want to use selenium for this
  step 1
  step 2
  step 3
  Close Browser
Open .net application and check logs  # I need to use ranorex for it
  step 1
  step 2
  step 3
  step n

So I want to use one robot framework testscript for this and execute it on remote machine. I n script i will only specify  IP of that machine and 2 different ports, where are XMLRPC servers listening  and i will send these different command (ranorex/selenium) to corresponding ports

Is this enough to describe what i want to achieve?


On Wednesday, October 30, 2013 7:19:33 AM UTC+1, Tatu Aalto wrote:

Ugh

Could you tell more about your requirements?  Is your purpose to open the browser in local or remote machine (both are possible, with standard tools). And do you just want to use Selenium2Library keywords from/to remote machine or do you want use other libraries too?

-Tatu

On 30 Oct 2013 07:46, "alans09" <ala...@gmail.com> wrote:
Hi all, 
 
 I'm kind of new user of robotframework. I have one question. I need to run robot from one place and tests from another.  I found that there exists remote library that works as xml-rpc proxy. Problem is that I cant find proper way how to use it with selenium2library on remote machine.

Can somebody help me with this?  I just need to 'send' commands to other machine and execute them on that remote machine.

Thank you in advance


Tomas

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

Tatu Aalto

unread,
Oct 30, 2013, 3:56:09 AM10/30/13
to robotframe...@googlegroups.com
Ugh

So your requirement is to test browser, os, and other sw compatibility in a set of server.  Nice setup, by the way.

For Selenium (and also with Selenium2Library) there is grid [1], which could easy your pain. With grid you do not need a RF remote server, the grid does it for you, out of the box. It is quite easy to setup and configure.

For Selenium2Library to use the grid, only difference is in the Open Browser [2] keyword. One must defined the desired_capabilities argument, which is not so clearly document. But reading the corresponding documentation from the selenium side [3], it comes quite clear.

For other issues, I am not able to help you.

-Tatu

[1] http://code.google.com/p/selenium/wiki/Grid2
[29 http://rtomac.github.io/robotframework-selenium2library/doc/Selenium2Library.html#Open%20Browser
[3] http://code.google.com/p/selenium/wiki/DesiredCapabilities
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

David

unread,
Oct 30, 2013, 9:52:02 PM10/30/13
to robotframe...@googlegroups.com
If you don't already have your own Ranorex (XML-RPC) remote server implementation that is compatible with Robot Framework, you are kind of in luck. Somebody did the work for you:


and for a generic .NET XML-RPC server for Robot Framework to load your own .NET libraries for testing:


Kevin O.

unread,
Oct 31, 2013, 10:11:39 AM10/31/13
to robotframe...@googlegroups.com
If I understand you correctly, you require utilizing remote libraries that are served from the same machine that is also launching the browser and doing Selenium tests.
I tried running Selenium2Library as a remote library and it seemed to work except for screen captures.
I'm not so sure that you need to use Selenium2Library as a remote library - why not just run it locally and have the machine with the browser be remote? This is a feature built-in to Selenium.

Assuming you elect to have Selenium2Library on the TestExecution server and the browser being remote, the question you have to answer is - do you want to use Selenium grid to select the test machine or are you going to select it manually?
If you are going to pick the node, then run the Selenium standalone server and connect to it by using Open Browser's remote_url that corresponds to the node.
If you are going to use the Grid to select the node, use the hub's url for remote_url. There is a little extra work - you have to get the hostname/IP of the node that the grid hub selected. Using that IP, you can then connect to your remote libraries.
Either way you go, this is a pretty complicated setup, so don't expect it to be easy.

Here's a snippet to get the IP of the node that the grid selected...

import urllib2, json
from robot.libraries.BuiltIn import BuiltIn
from robot.api import logger
from urlparse import urlparse


    def get_node_hostname(self, hub_url):
        '''Returns the hostname/IP of the node executing the session belonging to the active browser.'''
        
        session_id = _get_instance()._current_browser().session_id
        parse_result = urlparse(hub_url)
        host = parse_result.hostname
        port = parse_result.port
        query_url = 'http://%s:%s/grid/api/testsession?session=%s' % (host, port, session_id)
        req = urllib2.Request(url=query_url)
        resp = urllib2.urlopen(req).read()
        logger.debug('GET of %s returned: %s' % (query_url, resp))
        json_blob = json.loads(resp)
        if 'proxyId' in json_blob:
            proxy_id = json_blob['proxyId']
            print '*INFO* proxyId is %s' % proxy_id
            parse_result = urlparse(proxy_id)
            return parse_result.hostname
        else:
            raise Exception('Failed to get hostname. Is Selenium running locally? hub response: %s' % resp)
Reply all
Reply to author
Forward
0 new messages