Using Selenium with interactive interpreter shells?

6 Nov

Just wondering if anyone has used Selenium with interactive interpreter shells, via Python or Ruby. I believe those are the only such options aside from their Java/.NET equivalents of JRuby, Jython, IronPython, etc.

If so, how have you used it and why use it? Just wanted to get some ideas.

I’ve found it quite useful for debugging Selenium commands for a test and finding locators. Sure there’s Firebug, but you still have to test locator in action with Selenium via code, etc.

And for other languages but also including Python and Ruby, guess you can set breakpoints in code via IDE/debugger and do single stepping of test execution.

But using interpreter shell, I can bring up and teardown Selenium as I choose, w/o an IDE/debugger either. Quick way to test things out. Course for testing something that has dependency of being on certain state or page (logged in, etc.) requires additional work. Either type them all manually to interpreter shell or invoke a stub script from interpreter that executes all the commands up to the point you want to test/debug.

Another advantage of this shell approach is that Selenium will feel more like a stateless API or web service. Send a command and watch Selenium do something. You can also manually make changes in the Selenium browser (faster than coding) and then do some follow up Selenium command tests after the manual configuration. That kind of thing is harder to do when running a script (it has to have sleeps or is slow enough for manual config, while it is waiting for element, etc. or you’d have to set breakpoints in debugger).

But of course this works best if your test is written as Python or Ruby. Might be ok if it was in Java/.NET if you use Jython/JRuby or IronPython.

It can work if using other languages too. Just that you have to translate API calls back and forth and you can’t utilize any test framework/library classes you build in your language because you can’t call from Python/Ruby (unless is Java or .NET).

Update 1: you can use Java with interpreter shell for Selenium and WebDriver w/o Jython, JRuby, rather using Beanshell. See my related post on how to do so: Developing and debugging in Java via an interpreter

3 Responses to “Using Selenium with interactive interpreter shells?”

  1. David February 7, 2012 at 2:17 am #

    It would also be interesting to see how this might be adapted for SauceLabs. Connect to SauceLabs and run test via shell rather than code/script and see it in action live and on demand on SauceLabs job video page.

    You can test and debug from SauceLabs live this way. The only drawback is that automation run this way tends to be slower than fully automated code/scripts and hence you would be burning up precious minutes in your account.


  1. A Selenium IDE alternative for other browsers and another record & playback method « autumnator - May 3, 2012

    […] Using Selenium with interactive interpreter shells? […]

  2. Thoughts on a Selenium interactive exploratory test and debug tool | autumnator - January 24, 2014

    […] Using selenium with interactive interpreter shells […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Anastasia Writes

politics, engineering, parenting, relevant things over coffee.

One Software Tester

Trying To Make Sense Of The World, One Test At A Time

the morning paper

an interesting/influential/important paper from the world of CS every weekday morning, as selected by Adrian Colyer

RoboSim (Robot Simulator)

Visualize and Simulate the Robotics concepts such as Localization, Path Planning, P.I.D Controller


open notebook

a happy knockout mouse.

my journey into computer science

Perl 6 Advent Calendar

Something cool about Perl 6 every day


Inspire and spread the power of collaboration

Niraj Bhatt - Architect's Blog

Ruminations on .NET, Architecture & Design

Pete Zybrick

Bell Labs to Big Data

Seek Nuance

Python, technology, Seattle, careers, life, et cetera...


New Era of Test Automation

Der Flounder

Seldom updated, occasionally insightful.

The 4T - Trail, Tram, Trolley, Train

Exploring Portland with the 4T

Midnight Musings

Thoughts on making art

Automation Guide

The More You Learn The More You Play...!

The Performance Engineer



Thoughts related to software development

%d bloggers like this: