Selenium – What Programming Language You Should Learn

2 shares, 657 points
Which language should I learn in order to get into Test Automation
Which language should I learn in order to get into Test Automation

Which language should I learn in order to get into Test Automation?

Many people struggle to figure out the answer for the following question : Which language should I learn in order to get into Test Automation?

When I started my first Selenium project I choosed Java as a language because of the following reasons:

  • I had experience in OOP languages as C++, which helped me to easily pick up java syntax
  • The support in my project/company was very good in java
  • The overall support online I could easily find any documentation for what I needed

As the years passed I figure out that it doesn’t really matters , the OOP concepts you learn in one language can be applied in almost 90% of the other programming languages.

The programming language that everyone should learn for Selenium….

Selenium is a widely used open source, portable software testing framework for web applications. Though Selenium comes with a test domain specific language (Selenese), other programming languages (Java, C#, Ruby, Python) can be used to script tests as well.

So the key into this is , pick up the language that you know the best and start developing tests. Here it can be just one problem being in a Linux environment and you want to write your tests in c#, that might be a bit tricky.

If you follow the WebDriver documentation you can see that the Selenese syntax is pretty much the same in all programming languages :

driver.get ""

But … which one do you recommend?

You might find my answer really annoying  , but I will tell you from my experience what made me to choose the automation programming language.

In one of the positions that I’ve worked I was the only QA out of 4 that had automation experience and the company was working in a OSx/linux environment. I was first thinking to choose Java and just start the project but at some point I figured out that it might be really hard to for the other QA to pick up Java so I decided to go for Ruby and capybara in top of the Selenium API.

Because Ruby is relatively easy as a language, capybara made it more easily and accessible for people with less or no experience in automation and just have a look what I’m talking here :

click_link('Link Text')
click_on('Link Text') # clicks on either links or buttons
click_on('Button Value')
fill_in('First Name', with: 'John')
fill_in('Password', with: 'Seekrit')
fill_in('Description', with: 'Really Long Text...')
choose('A Radio Button')
check('A Checkbox')
uncheck('A Checkbox')
attach_file('Image', '/path/to/image.jpg')
select('Option', from: 'Select Box')

page.has_selector?('table tr')
page.has_selector?(:xpath, './/table/tr')


expect(page).to have_selector('table tr')
expect(page).to have_selector(:xpath, './/table/tr')

expect(page).to have_xpath('.//table/tr')
expect(page).to have_css('table')
expect(page).to have_content('foo')
Ruby capybara

When I was working in a purely Microsoft environment of course I wasn’t going to choose any of the open source languages because all the support in terms of coding , deployments , continuous integration was on Microsoft technologies, so of course I choose to write the UI tests using selenium C#.

On my last project I was given free hand what language to choose between Python , Ruby and Java and I choosed Ruby with capybara in top of the selenium API.

If you asked me why … was because I knew ruby , other QA had only ruby experience and few of them no automation experience at all , so we went with Ruby because is quite handy.

If you are the only one to decide …?

Personally if you have to decide and you don’t have any experience in coding I suggest you to go with one of the dynamic languages as Ruby or Python .

Using dynamic languages allows you to achieve your goals with the least amount of code in the shortest amount of time.

For example, Ruby has always been my go language , because it has a good support , quite friendly , no big differences between the versions

My answer – recommendation

So, to recap: What language should you use to learn Selenium?  The answer is : it’s up to you , and your team , and the circumstances to choose the programming language.

Here you can find 50 websites where you can learn Ruby.

Get started with automation and Selenium today, here you can find the best way to start with selenium and will give all you need.

Like it? Share with your friends!

2 shares, 657 points
Test engineer


Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.