Is Java needed for Selenium?

Hello all Testers,

For some few day I am thinking about Selenium and also wants to learn some automation. But, in every tutorial website I encountered with Java as prerequisite. So, is it really necessary to learn java or any other programming language first to get hands in Automation?

1 Like

Hi there,

Java is not a requirement, and theoretically you do not need a programming language but if you want to get into automation you really need to start learning a language. I was part of a group creating the curriculum for a technical tester education and there we chose to teach Python, so I would suggest to learn Python. Not because it is so great with selenium but since it is applicable in a lot of test automation scenarios.

Other factors I generally take account for is what language is the product you are working with written in. If you can learn the same you typically will be surrounded by a lot of people that can help you on the way. And you get the added benefit of understanding more of the code.

For reference for selecting a language to learn.


One of the main reasons test automation fails is the effort to maintain the test automation suite becomes too expensive (time, money, expertise, etc.)

In theory, you can use HTML tables and automation plugins to create your test automation suite but my experience has been modern websites are rather complex.

There are two options for this. One is to hire a lot of QA automators and have the software developers put things in the application to make it easier to test and for the test suite to be easier to maintain. The other is to apply software development techniques to make the test automation suite easier to maintain.

If you are using Selenium without programming knowledge and depending on the application developers to make the application more testable you might as well just use an automation tool like HP Quality Center. It will give you a more complete package and handled a variety of other things that core Selenium won’t do for you.

I have seen teams start with depending on the application developers to make the application more testable or reduce how much you automate with Selenium but with the long term goal of moving to option Two. So you start with core Selenium but expect to learn programming techniques to make the test suite more maintainable. In this case, some tests don’t need much to keep them maintainable. As you get into tests which are a little harder to write without some programming knowledge than the Selenium automators are expected to learn programming.

Of course the ideal use of Selenium is to start with programming knowledge and not be dependent on the application team (or not as much) to keep the application more testable and the test suite easier to maintain.

The programming language controls the Selenium client. The client calls the Selenium APIs to control the browser. Each language implements a client. So the Java client will be developed separately from the Python client. This means there are subtle differences between the Java and Python implementations of Selenium. There are other languages as well. I have found that Java has been around longer, the tools (like IDEs) and language are more stable. So learning Java tends to be ‘safer’. But really, if I work in a company using Ruby for development, I might just use the Ruby implementation of Selenium client. Especially as a consultant. I tend to create something then leave the client to maintain it. So I pick a language they are comfortable with.

Now it is important to understand that you aren’t going to be using frameworks, plugins and extensions that a modern Java developer uses in order to create and maintain a Selenium framework. Things like Spring, Lombok, Flyway, etc. won’t be necessary for Selenium development. Really, you want to keep it simple. So the programming knowledge you’ll need for an intro to Java is all that is really necessary.



Thanks @Darrell for giving such a detailed explanation.

The selenium libraries are available on several languages, but I share you experience of finding many online tutorials are based on java.

Check out Udemy which has many courses for about $10 teaching selenium with C#, Python etc if you think java is heavy weight.

However, commercially my experience has been that most Enterprises using Selenium usually are Java or .Net houses and it makes so much sense to write your tests in the same languages as your primary Devs. If this is your goal, I’m afraid Java or C# is probably on the cards at some point.


I would agree with what Darell and Ola have written.

First you need to decide what you are automating, if it is only web based applications, then the best option in the market is Selenium. There are methods/processes you can use to do this, called frameworks, like cucumber, gauge, etc. which can provide the structure and a BDD type of readable language for the other users like the BA and Dev.

If you have some desktop based applications, then better to go with tools like Tricentis Tosca, Microfocus UFT (HP QTP), TestComplete, etc.

Both these approaches do require that you have some basic language understanding. With Selenium, you get a lot of flexibility in using the language of choice. I would say that go with something which your team is working with (like mentioned above, use Ruby, Python, Java, C#, etc.), depending on the comfort level for yourself and your team also, so that maintainability is not an issue later. That said, if it is a dedicated QA team, then decide among the team as to the comfort level of the majority and then work on that language.

Automation with tools like Tricentis Tosca (C#) or Microfocus UFT (VB Script), also requires a level of language grasp, to create complex structures which are common in web applications. Selenium also requires that you write the code to recognize objects and control them.

To summarize, I would say, it is best to learn a language for Automation to be a success and also to provide something which is maintainable. You can go to sites like to get snippets of the code that you can put in your test automation, but it would create an un-maintainable piece of work, which you yourself would not be proud of or be able to maintain for long.

Sites like Pluralsight and eDX are good starting points. And there is a wealth of information available on the itself.

Technology is changing every day and in the field of QA software testing services if you are an automation engineer, and you have to automate any website then selenium is the best option available.
Selenium WebDriver interface will only give you power to control the webpages but being a tester it is totally up to you how and what logics you want to implement.
For designing the logics, creating the scripts or create framework, you would need knowledge of at least one programming language.
It is generally observed that every beginner usually starts with Java+selenium, but it is not mandatory.
In fact I believe python is much easier and less complex than java when it comes to scripting.
Selenium can be used with many languages such as Java, C#, Python, Ruby etc.
At the end you should choose the language on the basis of following parameters.

  1. Programming language you are more comfortable with.
  2. The language in which your co-workers/in-house developers are more expertise, so that they can provide you better support.

I always find it disturbing when a thread gets Necro (resurrected after a long period of sleep/death.) But I’m keen to know what answer you ended up forming @nitin1387 ? As a programmer-turned-tester I’ve never had to ask this, but I have had to form opinion as well, mainly because JavaScript is new to me. My answer, is eventually yes. My 2 reasons.

  1. Selenium webdriver is an implementation of a protocol for controlling browsers. The protocol spec itself is not perfect and is like all software fallible as well as continuously evolving. JavaScript is the language of the web browser, and sometimes you will have to use some JS to perform or to investigate something that Selenium does not or cannot do. Sometimes writing a small Java script fragment is necessary to then get the answers you seek from a page.
  2. Selenium webdriver uses javascript to control the browser under test, and when it fails to, it’s often easier to write a tiny bit of javascript yourself directly in the page under test to understand why Selenium-webdriver and whatever framework you might use on top of Selenium, did, what it did. Because that test framework is probably going to use some JS injected into the page to do that. It’s a bit like knowing that a car runs on petrol, and then learning about how petrol is made later.

To get started in web automation, you don’t need to know JavaScript (not Java, Java is something else entirely), but you need to learn about it gradually as you go. Hope it was worth the 'Necro.

1 Like