Python or Java for Selenium?


I apologise if this has been asked already, but I couldn’t find a similar thread.

I wonder which is better for selenium, Python or Java? Why?

I currently use python because the programmers at my company also use Python. However, I was browsing job ads to see what sort of skills employers are looking for and Java seemed to be the more popular choice.

Should I learn both?

Java is indeed the most popular choice. But your best source of information are you developers.

I would say excel in Python and when you’re ready to pick up a second language go with Java


Go with your developers. Looks like your team has already decided to go with Python as a scripting language. Follow the below activities to get hands-on with Java for automation scripting.

-Answer Java related automation testing questions.
-Prepare Python and Java Selenium Cheat sheets.
-Publish automation testing blog posts using Java and Python scripting languages.
-Explore Page Object Libraries.
-Publish an automation testing utility which is useful for automation testing community in Maven central repository.

I have 13+ years experience in automation testing. I still setup automation testing frameworks using Python, Java, JavaScript, and C#. Nowadays, companies are looking for passionate automation testers. Don’t worry about the scripting languages.

Asiq Ahamed
Test Automation Architect at Codoid.

1 Like

I am starting to follow the Python route myself, our tests are in Python already. I do some totally unconnected coding in Java though, but persevering with Python, even though most examples are Java.

There is no absolute winner or absolute truth but I tend to go with interpreted languages for tests because I think it is easier to move them around or change them.

In your case, I would say you want to follow what your team if you yourself are not feeling skilled enough to lead in other languages. I would go for Python and master that to a degree. After that, you can move to Java or other forms of testing. But always stick to one thing and don’t split your focus.

For future jobs and Selenium based testing - Java, Python or Ruby are all suitable with small differences in API, meaning even if you do a Python one, you will be able to score a job in Java Selenium.

Hello everyone

Thank you for your responses recently.

I ended up going for python and I used it for around 7 months, but now I am in a role using java.

Looks like I got both options in the end :slightly_smiling_face:

If I could choose… I would stick with python. I just prefer it as it is more straightforward to read/pick up.