Using selenium grid with robot framework

1,172 views
Skip to first unread message

David Losinski

unread,
Sep 27, 2011, 11:11:46 AM9/27/11
to robotframework-users
Hello All,

I've been looking into using selenium grid to run our testsuite in
parallel to reduce the run time.

I have looked at the useful guide Thomas produced (http://
code.google.com/p/robotframework-seleniumlibrary/wiki/
UseSeleniumGRIDwithRobotFramework) and got our test suite running on
selenium grid by splitting up the suite by tag and running multiple
instances of pybot.

When I attempt to use the parabot script provided in the guide I get
the following error:

Starting Selenium Hub ...
Traceback (most recent call last):
File "C:\SVN\parabot.py", line 328, in <module>
seHub = startSeleniumHub()
File "C:\SVN\parabot.py", line 70, in startSeleniumHub
process = subprocess.Popen(hubScript, cwd=seCwd, stdout=hubLog,
stderr=hubLo
g)
File "C:\Python26\lib\subprocess.py", line 633, in __init__
errread, errwrite)
File "C:\Python26\lib\subprocess.py", line 842, in _execute_child
startupinfo)
WindowsError: [Error 3] The system cannot find the path specified

has anyone else come across this error and has anyone managed to get
this script working.

Thanks

David

Pekka Klärck

unread,
Sep 27, 2011, 4:16:23 PM9/27/11
to david.l...@gmail.com, robotframework-users
2011/9/27 David Losinski <david.l...@gmail.com>:

>
> When I attempt to use the parabot script provided in the guide I get
> the following error:
>
> Starting Selenium Hub ...
> Traceback (most recent call last):
>  File "C:\SVN\parabot.py", line 328, in <module>
>    seHub = startSeleniumHub()
>  File "C:\SVN\parabot.py", line 70, in startSeleniumHub
>    process = subprocess.Popen(hubScript, cwd=seCwd, stdout=hubLog,
> stderr=hubLo
> g)
>  File "C:\Python26\lib\subprocess.py", line 633, in __init__
>    errread, errwrite)
>  File "C:\Python26\lib\subprocess.py", line 842, in _execute_child
>    startupinfo)
> WindowsError: [Error 3] The system cannot find the path specified
>
> has anyone else come across this error and has anyone managed to get
> this script working.

My guess is that 'hubScript' has a space in it and when executed like
'subprocess.Popen(hubScript, <args>)' the space is not escaped. You
can check does the path have a space by adding 'print hubScript'
before 'subprocess.Popen'. If 'subprocess.Popen' gets the command (and
possible arguments) to run as a list, it will escape possible spaces
correctly. If the path has a space, changing the code to
'subprocess.Popen([hubScript], <args>)' should thus fix the problem.

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

David Losinski

unread,
Sep 28, 2011, 11:07:25 AM9/28/11
to robotframework-users


On Sep 27, 9:16 pm, Pekka Klärck <p...@iki.fi> wrote:
> 2011/9/27 David Losinski <david.losin...@gmail.com>:
Thanks that solved the problem

Pekka Klärck

unread,
Sep 28, 2011, 4:47:46 PM9/28/11
to david.l...@gmail.com, robotframework-users
2011/9/28 David Losinski <david.l...@gmail.com>:

>>
>> > When I attempt to use the parabot script provided in the guide I get
>> > the following error:
>>
>> > Starting Selenium Hub ...
>> > Traceback (most recent call last):
>> >  File "C:\SVN\parabot.py", line 328, in <module>
>> >    seHub = startSeleniumHub()
>> >  File "C:\SVN\parabot.py", line 70, in startSeleniumHub
>> >    process = subprocess.Popen(hubScript, cwd=seCwd, stdout=hubLog,
>> > stderr=hubLo
>> > g)
>> >  File "C:\Python26\lib\subprocess.py", line 633, in __init__
>> >    errread, errwrite)
>> >  File "C:\Python26\lib\subprocess.py", line 842, in _execute_child
>> >    startupinfo)
>> > WindowsError: [Error 3] The system cannot find the path specified
>>
>> > has anyone else come across this error and has anyone managed to get
>> > this script working.
>>
>> My guess is that 'hubScript' has a space in it and when executed like
>> 'subprocess.Popen(hubScript, <args>)' the space is not escaped. You
>> can check does the path have a space by adding 'print hubScript'
>> before 'subprocess.Popen'. If 'subprocess.Popen' gets the command (and
>> possible arguments) to run as a list, it will escape possible spaces
>> correctly. If the path has a space, changing the code to
>> 'subprocess.Popen([hubScript], <args>)' should thus fix the problem.
>
> Thanks that solved the problem

Great! I looked at the script a bit more closely and noticed that a
correct way to start the hub would be this:

process = subprocess.Popen([antBatch, "launch-hub"], cwd=seCwd,
stdout=hubLog, stderr=hubLog)

Could you test does that work for you? If it does, I can update the
script on the wiki page to contain this line.

David Losinski

unread,
Sep 29, 2011, 11:22:00 AM9/29/11
to robotframework-users
I made the change and the script still runs.

I'm now haveing another issue in that when I run the script (with and
without this change) its reporting that my testsuite contains no test
cases. I've tagged them as parallel like the guide says, and when I
add 'print suite, suite.tests' I get the suite name but suite.tests is
showing []. Any suggestions to why this is happening?

Cheers,
David

On Sep 28, 9:47 pm, Pekka Klärck <p...@iki.fi> wrote:
> 2011/9/28 David Losinski <david.losin...@gmail.com>:

David Losinski

unread,
Sep 30, 2011, 10:55:17 AM9/30/11
to robotframework-users
Further to my last message, the issue occurs when my test suite is a
directory. Running the script against a single test suite file it
works fine, but it is not processing any files or sub -directories
with in the parent test suite. Am I missing something regarding the
robot.running api?

Cheers,
David

Pekka Klärck

unread,
Sep 30, 2011, 2:16:34 PM9/30/11
to david.l...@gmail.com, robotframework-users
2011/9/30 David Losinski <david.l...@gmail.com>:

> Further to my last message, the issue occurs when my test suite is a
> directory. Running the script against a single test suite file it
> works fine, but it is not processing any files or sub -directories
> with in the parent test suite. Am I missing something regarding the
> robot.running api?

The test suite structure returned by robot.running.TestSuite is
recursive. If you have a directory, the top level suite has no tests
itself but only suites. Those lower level suites then can contain
tests, if they are created from files, or other suites, if created
from directories. To go through all the tests you thus need to use
something like this:

def process_suite(suite):
for subsuite in suite.suites:
process_suite(subsuite)
for test in suite.tests:
process_test(test)

I briefly looked at the parabot script at it seems to only go through
tests in the top level suite. That obviously explains why no tests are
run if you use the script with a directory. Are you interested to try
fixing the script? If yes, you might even consider starting a new
project for that so that the script can be versioned.

David Losinski

unread,
Oct 3, 2011, 5:43:44 AM10/3/11
to robotframework-users
I am keen to try and fix the script, however I am quite new to python
so it may take a while and I will probably have more questions. Once I
get it working I would be happy to consider starting a new project.

Cheers,
David

On Sep 30, 7:16 pm, Pekka Klärck <p...@iki.fi> wrote:
> 2011/9/30 David Losinski <david.losin...@gmail.com>:

David Losinski

unread,
Oct 12, 2011, 10:06:07 AM10/12/11
to robotframework-users
I've fix the scripts for parallel execution and have started to play
around with the number of tests running at anyone time. Does anyone
have any ideas on the optimum number of test blocks to run at a time
on a single machine without getting a browser is already running
error?

Cheers,
David

DISHA MUNSHI

unread,
Sep 8, 2016, 12:35:50 PM9/8/16
to robotframework-users, david.l...@gmail.com
Hi David,


Could you help me with the same. I am kind of struggling to set up selenium grid with robotframework.


Regards,
Disha
Reply all
Reply to author
Forward
0 new messages