How to setup Selenium Java project in Eclipse

Raghav Pal
A free video tutorial from Raghav Pal
Automation Test Architect | Educator | 12 yrs
4.4 instructor rating • 17 courses • 222,396 students

Lecture description

Setup Selenium Java Project in Eclipse

Today we will learn...

1. What are the Prerequisites

2. How to create maven project in Eclipse

3. Add dependencies in pom.xml

4. Make project ready for adding Selenium scripts

You can follow this on...

Windows and Mac


Java is installed on your system

Eclipse is installed on your system

Maven is installed on your system


Install Java on windows -

Install Java on Mac -

Eclipse - Getting Started -

Learn more from the full course

Selenium Java Framework from Scratch

Step by Step for Beginners

10:52:36 of on-demand video • Updated

  • Create automation frameworks using Selenium in Java
  • Understand the basic concepts and working of Selenium
  • Understand the basic concepts of Automation Frameworks
  • Will be able to create test automation framework step by step
English [Auto] Hello and welcome to the session on how to create jobs in books from scratch in this series people create us telling them of a book and we will call that basic step by step and we will create a full fledged framework in Job Aslanian indecision. We are going to see how to set up a leading project in Eclipse. So today we are going to learn what other the sets. How do we create our Mabon project in Eclipse. How do we add dependencies. And then even make the project shete for adding selenium clips. So in case you were new to Java and you are new to Eclipse and you are new to selenium do not what we are going to learn everything from scratch. And also you can follow these sessions on Windows or as well as on Mac so whatever we are going to create We'll work on both of these operating systems in case there are any differences. I will let you know during the sessions. And as always on this channel automation step by step we call very basic step by step. So let's get started. So for the IT ENDED UP for the first 10 days the prerequisites and we're here we have the basic prerequisites the number one is Chulbul should be installed on your system. So in case you are on Windows you can go to your command prompt and say Java space or hyphen Weishan and hit enter. And it should show you the job or. In case it is not doing. That means Java is not installed. Also you can say Java Sea space hyphen wisen and again hit enter and again it should show you the Weishan for a Java compiler. So both of these should be present. And in case you are on Mac you can go to terminal and the same commands. Backspace hyphen version and it should show you the Java version and Java Sea space hyphen Weishan to show you the compiler version. Now just in case Java is not installed or Java compiler is not installed on your system. You can go to my YouTube channel which is YouTube dot com automation step by step and you can go to the play list. And here you will find a playlist for Jabo. So here it is. You can go here. And here you will find these sessions. You can watch how to install Java on windows in case you are following the session on Windows. In case you are on meds you can see how to install load up there job on Mac and you will get started with Java and second Pudi crusade. We have to have eclipse installed on our system so again in the same playlist. You will find the session secessionists getting started with Eclipse. So eclipse is the ITCZ integrated development environment we are we are going to create our entire project so we need to have eclipse daddy on our system. So these are the future cassettes and then maybe one should be installed on your system so again you can go to my channel and we have again a play list here for Maybin so go here and here. Again you have these two videos for Windows. How to install Maybin on Windows and then hope install Mavin on Macs so you can watch this and get even dirty on your system. And then once you have got all this music cassettes let us go to the second step which is we have to create Mavin project in Eclipse So let us start out with Eclipse. So let me exit from here and I will start eclipse. So I'm using Eclipse nean so you can use the latest eclipse whatever it is did or what would eclipse you have. It should be OK and here you can select any workspace so this has any folder on your system you can give the location where all your project will be created and see. OK now I am doing this on a Mac but the steps filled beseem on Windows. In case there are any differences I will let you know so you can follow this on Windows as well. So we have to eclipse a JD No and you can see that here is a project package Explorer right. So in case you are not getting this you can go to this click access window and start typing. Package Explorer and you should be getting the package explore that option and you can click that and you would have this package exploded and now you have to create a Maybin project so you can right click on the Explorer and send new and go to others. You can also go to files new and although and start typing here. Mavin. So you will get an option for me even project now. In Eclipse in the latest version of software cliff starting with Mosse and known and oxygen maven is by default into an eclipse so you will not have to get it separately. You should get the project option here. Just in case you are using some older version of Eclipse and you do not have. You do not get this movement but then you will have to install Maybin in your Eclipse and you can search for how to install it or get to me. Been on Eclipse and you will get a steps to it. But because I am assuming that we have this latest version of eclipse because from the last three versions we are getting more than that or we should be having this and say next. And here you can see create a simple project so it will skip the archetype selection. We do not need that as of now. And you can just sit next. And here you can start giving the group by the artifact idea and so on. So what we really need is the group ID to say something like selenium. Shame work you can give any name actually here also I in say New framework and you can leave the rest of the rest of the tinks as it is and see finish. I think this is all that it. So let me use selenium Java framework selenium Jubba framework and finish here. In case you get any warnings and so I have got the psyllium and selenium job of Facebook also. I can add this selenium job of Facebook to walking set so that I do not see all these other frameworks to what I'm going to do is just click here and say select concert's and I will say in your and I will say Java and next and I will keep any new selenium Java framework and I have already added this and finish and select this will see it and see OK. So this was an optional step you do not have to do this. It's just like I did not want to see that from books here. What other projects here's what I have done that. So now I have this selenium Java book which is a even frame book ready and you should be having this bomb bomb tech stimulus bill. So we have done this. We have got a selenium maven project ready and then we have to add dependences to get bombed to axemen. So if you see your bombero text him here and double click this you will get your palm vertex symbol here. Now what to excel is this is a file where we can add all that dependencies are all the liabilities that will be needed for this project. And this provides us a very easy way of maintaining all of our dependents. So I'll let you know what exactly you have to do. You can go to your browser and say Mavin depositary and click on this Mavin Depository and here you can search for the dependencies. So for example I can say selenium Java and hit the search and you can see we have course selenium Java. I will click on the first one and you can see all this versions are. So the latest one is T-Dog 4.00. Also you can verify this by going to selenium doctor who IGY which is the official site for selenium that is just it's a little slow. Let me go to selenium and yes I'll go from here. Selenium doc great selenium as you would or would you my mistake. The website is selenium as you or G. And if you go to download selenium you can see the latest version is true Doc 4.00. So we have the latest version here as well. So click on the latest version 2.4 doc or whatever is present at your time and know you can add this dependencies for selenium Java in two ways. One way is you can just copy this dependency from here and go to your project and go to this form that ex-MIL it. And here you can add that dependency like this and we have to have a dependencies dagga as well. But we will do it in different and an easy way. So what we can do is go to this dependencies Deppe and here click on it and now give the group ID defect ID and version as it is here in Mavin depositary. So this is the group ID. I will call it from here and give it to the artefact ID I'll copy it from here. And then the voice. So again I would just copy it from here and give it to you and then you can see OK and here if you go out with up on axemen you can see this has already now come here. So I could have data click on we did from here from them even deposit. Or this is the other way. So you can do it like this. So let us add some other dependencies as well that we will be needing in our project. So we need G-Unit. So let us also add G-Unit the same way the latest version and hit. No I can recall we this from here. And dictu C.M. Okay. And now when you click control asks or command asks for saving the project you will see that these dependencies are getting downloaded from the internet and getting added to our project. And now you should have a section called Mavin dependencies and if you expand it you are getting all these jobs or dependencies that are required for a project. So you can see how easy it becomes even if you're not using even PreCheck even have to download all these celebrities and just one by one from the Internet and then add to a project. The other problem will be if you take this project to some other system or machine then you will have to do the same procedure again but that may even be good. We can even if we take this project any machine we really just have to compile it once and all that different and we'll get at it by default. So you do not have to worry about maintenance of the project. No. OK. So we are done with what third steps just how to add dependences in bombed or text him in the fourth step is we have to make Project ready to add selenium skips. So I believe we have acquired jar's. So what we can do is let us do this selenium test Java packet. So also if you have seen we have by default quote the spec it is in main Java in resources and does Java. So we're going to create all our desks in Java and we will have some more utilities in distorters. So we will do this step by step in the coming sessions. Do not worry about that. But for now you can right click on this test Java and Tsin you and C-Class and let us say give this name as a test and say finish. So we have got our class now we will create a main meathook. Now again in case you are you are completely new to Java. Do not worry. You can go to my channel on you can get to the Java playlist and here. I have explained where the best basic step by step how exactly you can get started with Java so you can see my first java program come on line execution's and how to create classes and objects. But even if you do not see this I will explain. So do not worry so hard you will just say Main and pest control spacebar on your keyboard you will get an option for this main method. Just click here and you are getting this mean that. Main That is the starting point for any type of a program. And now you can see BEP drive word driver equals two new Firefox and tribal OK and you are getting some errors here. So if you hear what or what this you are getting this option to import that table right. Import cab driver so you can import from or Id open a selenium. And similarly for Firefox Stryver as well. You will do the. And getting this options only because we have added our libraries in case you have not added the selenium Java library in your home you will not even get the option to add these dependencies. So in case you were wondering how exactly I have written this I really suggest you can see that Java Tauriel on how to create object and classes. So you will get to know how exactly we are doing this. And now I can say I don't get. So you can find all the options are coming by default and I can go to any you it. So let me go to selenium HQ. You are in. You can give it a name here. I do not need to do all this and to see control controllers or commands CBOT and then you can do it right click and you can see it on this job application. So you will find some exception in the control bitches seeing the part to drive it executable it must be set by cab driver driver. So in case you are getting the same exception do not even exactly see how to troubleshoot this in the next session. But we are now OK. And our project is now ready for that selenium scripts. So in case you have Firefox version 47 or below you might be able to run your Jaybird or run this project that Italy and you might get a Firefox browser opening mark 47 and Abbo Firefox version will need the driver and we will see exactly in the next session. Also if you go to the channel and if you go to the playlist did is up playlist for some basic selenium and if you go to the yes this is Aslanian playlist so this will be very handy if you look at some initial tutorials on like Introduction to selenium. History is something you can watch if you want. And you know some very very basic steps you will get to know if you look at the selenium big notochord yet. So this tutorial is about the very basics of selenium. It will be very helpful and handy for you to go forward in this series. OK. So we have make of what we have made of project ready for adding the selenium scripts. So let us do a very quick recap. We looked at the research we looked at how to create or even predict an eclipse. We looked at how dependencies in Baumgarten axemen and now we have made our project ready for the next session. So in the next session we are going to add browser drivers and be able to run a simple test on Firefox. Groom Internet Explorer and Safari. And then we will make our project ready for the next session. I hope you liked this. Would you please subscribe to the tenants so that you get notified on all the upcoming new we do us on the Tennille automations step by step. Also like it and share it with others I meet you in the next session. Tents for watching.