Moving Webdriver from Java to Python

2,028 views
Skip to first unread message

Raja sankar

unread,
Jun 1, 2012, 2:48:08 AM6/1/12
to seleniu...@googlegroups.com, webd...@googlegroups.com
Hi All,

I thought of changing to Python bindings from Java for Webdriver.

Is there any issues in Webdriver wrt to Python?

If anyone moved to Python, please share your comments.

Thanks,
ராஜசங்கர்
(Rajasankar)

Deepak Jangid

unread,
Jun 1, 2012, 2:55:48 AM6/1/12
to webd...@googlegroups.com, seleniu...@googlegroups.com
I am using python biding and it is working awesome. I am still
learning the python, but couldn't face any issue which can't be fixed
in this binding.
> --
> You received this message because you are subscribed to the Google Groups
> "webdriver" group.
> To post to this group, send email to webd...@googlegroups.com.
> To unsubscribe from this group, send email to
> webdriver+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/webdriver?hl=en.

darrell

unread,
Jun 1, 2012, 8:54:18 AM6/1/12
to webdriver
I had always used Selenium with Java. The Java implementations always
seem to come out first, were a little more stable and had features
other bindings did not have. In the recent past I worked at a company
who insisted on Python as the language to use for Selenium 2.0
development. So I learned Python and proceeded to create a test
automation framework. As far as Selenium went, it was fine. There were
subtle differences and as I had found in the past, features and
workarounds which existed in Java didn't exist in Python. All in all,
the issues I encountered weren't show stoppers. At any given time you
need to look at what the Java client has but hasn't been implemented
in the Python bindings yet. If these are features/workarounds you can
live without then there is no Selenium based reason to not use Python.

On the other hand, if the people coding and maintaining the test code
are familiar with the Java APIs but not Python modules, there are
things outside of Selenium which they might be able to do faster and
more effiicently in Java. For example, if I need to parse an XML file
and I know how to do it in Java but not Python, I have to spend the
time learning how to do this in Python. As a Java programmer with 15
years experience, it wasn't hard to figure out how to do things in
Python which I knew how to do in Java.

I did find as a person who has been doing software programming for 30
years and Java programming for 15 years, the tools for programming
Python were less mature than the tools for programming C# or Java. I
think in part because I was used to using an integrated development
environment (IDE) and Python programmers tended to use it as a dynamic
language. As a C, C++, Java, C# programmer I am used to programming
the code, running it, debugging it, making small changes. As a Python
programmer I believe they tend to use the interactive shell, try
various things, save the session, clean up the session. The IDE
becomes less important to a Python programmer. Having 30 years of IDE
programming could have made the transition to Python harder for me.
Whether or not it will be an issue for you and your team is something
to consider.

Darrell

Raja sankar

unread,
Jun 2, 2012, 2:07:52 PM6/2/12
to webd...@googlegroups.com
Thanks Darrell for your detailed reply.

I use Python in BDD format to get Java Code for Webdriver. The reason for going into Python is less work to do things compared to Java. Such as File reading and writing and it is easier to understand for a tester with non coding background.

That is the reason why I am trying to switch to Python after using Se+Java for three years.

ராஜசங்கர்
(Rajasankar)

Raja sankar

unread,
Jun 2, 2012, 2:08:26 PM6/2/12
to webd...@googlegroups.com
Thanks Deepak for your reply. I hope there wont be any issues for me too.


ராஜசங்கர்
(Rajasankar)

Aaron

unread,
Jan 31, 2013, 10:21:23 AM1/31/13
to webd...@googlegroups.com
I am a long-time Selenium/Webdriver developer who is also thinking of switching to Python bindings. I am starting a project to build a framework on top of Selenium2 and am thinking of doing it in Python, in order to gain productivity. I am both a Java and Python programmer, and IMO Python would be more suitable for test writing, even though folks have been writing tests in Java for years.

Does anybody else have experience with the Python bindings? Who maintains them? Sauce labs uses them a lot right?

Would there be a good way to be able to use both the Python and Java APIs? Maybe using Jython or something? Then, only if need be, a tester could jump into the python API?

Aaron

unread,
Feb 5, 2013, 8:10:11 PM2/5/13
to webd...@googlegroups.com
Anybody?

Luke Inman-Semerau

unread,
Feb 5, 2013, 11:15:22 PM2/5/13
to webd...@googlegroups.com
The mozilla guys use them quite a bit. One of them even maintains them :)  I like to dabble with them too and use them 'recreationally' but I do use Java for my tests at work (I can't change everyone...).

I'm sure you could try Jython... I just have never tried with Selenium.

On Tue, Feb 5, 2013 at 5:10 PM, Aaron <kahun...@gmail.com> wrote:
Anybody?

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

To post to this group, send email to webd...@googlegroups.com.

darrell

unread,
Feb 6, 2013, 8:28:04 AM2/6/13
to webdriver
It has been a year since I used the Python binding. I work for people
who use different languages. I have used the C#, Python and Java
bindings. What I found with all three is that basic functionality is
the same. You will find 90% of your code will work the same in all the
bindings. It is the gotcha code that will be different. Sometimes I
find concepts which work fine in one binding is a different mindset in
another binding. Basically, the quirks of the binding will be
different. So if you are a guru in Selenium-Java you might finding
yourself dropping a notch or two when you switch to Selenium-Python.

Additionally, as I pointed out before, the tools can make a big
difference as well. When I was using Python I was using Eclipse and
Eric4. I was comfortable with Eclipse from Java but the Python
implementation wasn't as good as the Java tools. When I tried Eric4 it
was a very good (not great) environment but just isn't as mature as
Java IDEs. IDEA has a community edition you can try for free.
JetBrains released a Python plugin in November. That might be a better
opinion if you are used to IDEA but I cannot tried it yet.

Darrell

On Feb 5, 8:10 pm, Aaron <kahunaco...@gmail.com> wrote:
> Anybody?

Aaron

unread,
Feb 6, 2013, 9:24:47 AM2/6/13
to webd...@googlegroups.com
Thanks for the input. Does anybody have experience with jython? My understanding is that you can program in Python and import Java libraries, correct? Would this allow us to take advantage of the ease of Python, but also allow us to use the Java bindings if necessary? Or could you just drop into Java if needed?

David

unread,
Feb 17, 2013, 6:58:50 PM2/17/13
to webd...@googlegroups.com
It would probably be best not to use Jython, it could bring up unknown issues that also won't be supported by Selenium team (as a supported language binding).

If using Jython, you could use Python bindings but via Jython runtime instead of native Python, this only works provided the WebDriver Python libraries are able to run in Jython (e.g. pure Python code w/o dependency on C libraries, etc.) The other Jython option is to code in Python via Jython but use the Java bindings. This latter approach is better, but you could potentially run into issues like data structure mapping between the two languages. Because there is such issues when using Beanshell (an interpreter shell version of Java) to use the Java bindings interactively in an interpreter shell.

For me, the best reason to go Python is being able to test out WebDriver code via an interpreter shell session. The only other official binding to offer that would be Ruby. Java is best supported by Selenium team but it's a pain to test out code by writing script & run & debug w/ debugger (or System.out.printlns), I prefer interactive shell approach.

Both bindings work well, you just have to figure out what the corresponding API calls are between the two.

One dislike for Python binding though is if I'm not mistaken (from what I last recall), you have to run Safari Driver as RemoteWebDriver? Would be nice if you can instantiate it just the same as in Java as a local driver.

darrell

unread,
Feb 18, 2013, 1:18:41 PM2/18/13
to webd...@googlegroups.com
I'd agree with David. If you have Java questions there are a lot of Java programmers using Selenium. If you have Python questions there are a lot of Python programmers using Selenium. The moment you move to Jython you'll find the Jython/Selenium community to be a lot smaller and therefore less likely to encounter the same problems you might encounter.

Additionally, the mindset for a Java programmer is very different from the mindset of a Python programmer. The tricks and techniques used for maintaining code in one language is very different from the other language. For example, Python programmers like the trial and error approach of IDLE. You can quickly try something, get some feedback, try something else based on the feedback, get more feedback, try something else, et cetera. You quickly track down the right solution to a problem. With Java a Python programmer might try something, compile it, run to break point, get some feedback, stop the debugger, make a change based on the feedback, compile it, run to breakpoint, get some feedback, et cetera. This loop is MUCH slower and could be very frustrating to a Python programmer.

Essentially, Java has good support and works well for people with a Java background. Python support isn't quite as good as Java but it is a close and works better than Java for Python programmers. Jython looks like the best of both worlds but if history repeats itself, it will have all the problems of both bindings.
Reply all
Reply to author
Forward
0 new messages