So what selenium programming language for automated tests should you learn? I recently received the following email in my inbox:
Hi Joe,
I am interested in learning Selenium under your guidance. So will you please guide me from where I will start my learning? What language should I learn to program Selenium in?
Subash
I get this type of email request at least once every few weeks, so in this video, I'm going to reveal the selenium programming language every beginner should use to learn Selenium.
- the selenium programming language every beginner should use to learn Selenium
- how to create automated Selenium test scripts using Python
INDEX
The Selenium Programming Language everyone should learn is…
Why what language you choose doesn't it matter?
But … which one would you recommend?
My final answer/recommendation
Discover how easy it is to learn Python
The Selenium Programming Language everyone should learn is…
Ok. Are you ready? The secret is – honestly, it doesn't matter. 89.2% of the concepts you learn in one language can be applied to any other language.
The real key to learning Selenium is just to select any language that you are drawn to, roll up your sleeves, and jump in.
Why what language you choose doesn't it matter?
In Dima Kovalenko's book Selenium Design Patterns and Best Practices, he discusses how the common Selenium command sendkeys translate in most of the other major Selenium WebDriver Language bindings.
Check out the example below:
(*Also, be sure to check out my interview with Dima for more Selenium automation testing awesomeness)
This uniformity between the different Selenium language bindings applies to most of the commands in the Selenium API.
So, the process of porting test knowledge of one programming language to another becomes simplified using Selenium.
Also — the general programming concepts you learn in one language can easily be applied to another. Once you learn things like program design, control structures, software testing, data structures, and basic operation, learning other programming languages becomes simply a matter of learning its particular syntax.
But … which one would you recommend?
If you were to force me to name the language you should use, I would have to give you the famous (and annoying) reply, “It depends.” Some factors that might help you decide are:
- What programming language does your company currently use for its development? If you work in a Microsoft shop and everyone uses Visual Studio with C#, then maybe that's the language you should start with; if your developers are open to helping you out.
- Java holds an advantage because it is widely used, and easily finding examples on Google to help you out when you're stuck is a plus.
- If you were to do a search for Selenium automation jobs near where you live, what is the most popular language requirement that comes up? That might be a good place to start.
- The cons of starting with an object-oriented programming language like Java is that it can be overly complicated since the syntax tends to be verbose.
All programming languages have their pros and cons. One is not better or worse than any other. It really does depend on your situation and what you are trying to accomplish.
If I was forced to choose
I personally feel that if you have never programmed before, it would be best to start by using Python or Ruby language as they are script-friendly.
Using a scripting language allows you to learn to write Selenium tests and automation scripts with the least amount of code in the shortest amount of time.
For example, Python has always been my go-to language for absolute beginners because it has a really gentle learning curve. It works on Windows, Linux, and MAC and is still considered a serious programming language that many professional developers and test engineers use.
My final answer/recommendation
So, to recap: What language should you use to learn Selenium? The answer is that there is no definitive answer — but hopefully, this has helped you narrow down which language for Selenium is right for your personal situation.
Discover how easy it is to learn Python
I recently interviewed Al Sweigart, author of the book Automate the Boring Stuff with Python: Practical Programming for Total Beginners. I highly recommend that you listen in to get an idea of how easy it is to get started creating automated Selenium test scripts using Python.
Get started programming today! To get up to speed faster, go to my The Best Resources for Learning Selenium Quickly guide.
I would choose Java as a programming language. You are right that commands to work with Selenium and browsers look similar for different languages. And there are not much difference on this level. I would say it’s the first level. But you will going to build solid framework and you will have to add the several levels of abstraction above the Selenium command. So you will create abstraction of the domain (Web pages, flows, etc) you work with. And it’s important to do right choice here. I would vote to Java (even for .Net projects) because it has huge support and comunity, it has great frameworks you will need and infrustructure. And the most important this language has great capabilities (classes, interfaces, types etc.) to build and manipulate the levels of abstractions to build your solid framework.
Great info Stan and many other automation experts like Alan Richardson would agree with you.Also you reminded me that for testers that have to learn Java to start automated in their companies Alan’s Java for Testers book is a great resource. I’m personally torn because sometime I think some teams create over complicated frameworks that only a few can understand and maintain were frameworks created with the scripting languages like Python tend to me to be more straight forward.
I personally love to build selenium frameworks in ruby. In addition to be able to write solid test automation frameworks, the agility and the speed with which we can write and spin off tests is very important. The learning curve of the testing team adopting test automation is also very important. Ruby scores extremely high on these parameters. In my recent gig of automating a middle ware containing message queues, web services, API and gateways, the test automation framework I have written in ruby was adopted so easily by the team and they were able to write 100s of tests organically.
Best Resource that actually answers this very important question!! THANK YOU!!!!!!
Thanks Adam!
Nice one Joe!
I would also like to put in a plug for Robot Framework. It has its quirks and issues, but if you have to vet your test cases with non-technical stakeholders, it is ideal. It is written in Python, and you can extend it with either Python or Java. Besides Selenium testing, it can also do database (SQL and Mongo), SSH and Telnet, Process management, mobile testing (IOS and Android), etc.
Check it out at: http://robotframework.org/
Thanks Greg – I agree. I actually have an upcoming TestTalks episode where I talk with the creator of RobotFramework Pekka Klärck
Please
I want to ask , what are the best tools I can use to apply model based testing , and recommend me an adapter if it is required
I’m late to the party – but I agree that it depends on the company. However – one language that seems obvious but is still barely discussed because of how QA has been conducted over many years – is JAVASCRIPT.
I am currently implementing an automated test suite in javascript at a startup – and a good deal of startups these days center around javascript apps.
But I’ve been absolutely astonished at the paucity of resources concerning things like Selenium-webdriver for node.js. It seems the entire QA industry has persisted in using Java so stubbornly in isolation of trends that it rarely occurs to even the most seasoned pros to use javascript for testing. Protractor has helped a bit to popularize the concept but that’s too angular focused. People should really begin taking webdriver.js (Official Selenium bindings) seriously, along with other alternatives like casperJS, Nightwatch, and webdriver.io.
My prediction would be to stop thinking of Java as the default language for tools like selenium, and to begin using javascript with node.js. WordPress.com uses the node bindings for selenium webdriver and if it works for them it can work for any javascript app that requires testing.
Hi great points – and I agree! The last year I’ve been hearing more and more folks raving about javascript. I have to admit I hate the syntax myself but it really has become the must know language of the web.
Hi Sally hope I understand your question – for “model based testing” the tool I’ve used and liked is CA Agile Requirement Generator http://www.ca.com/us/products/ca-agile-requirements-designer.html
Is it feasible to use F# – Functional Programming Language ?
Actually there is a tool called Canopy that you can use F# with Selenium
You see the problem is you can learn a language like Java set up a framework and then your all good, but then the market changes and everybody and they dog wants you to know C#…with Selenium the issue for me is that recruiters here in UK will not waste time looking at you if your CV does not have some sort of job where you have used so then your are screwed.
Even with code examples on my github and course after course after damm course i cannot get a look in all because i was not a dev in my former life!
Its chicken and egg! You cannot expect a manual tester to spend several years learning automation and just because he does not have it on his CV the title of automation engineer say “oh you cannot do that job” “but we have a good manual role”
UI Automation is messing up the testing industry because tester s like myself who spend the time and put in that work cannot get a role for love nor money!
RANT OVER!