Advance Selenium, Continuous integration tool

Complete Guide for Selenium integration with jenkins Maven

Selenium integration with jenkins

Jenkins is CI (Continuous Integration) tool which will help you to run test in easy manner, In this post, we will talk about Selenium integration with Jenkins and different usage of the same.

Before starting if you have Eclipse , TestNG and if you are using Excel sheets or CSV File, then these jars should be ready.

 

Selenium integration with Jenkins using Plain Java project

 

 

   If you are using Maven project and if you want to run maven project using Jenkins then some process will change.

Selenium Integration with Jenkins using Maven project

We will divide this post into Following section

1- Download Jenkins

2- Configure Jenkins for Running Build

3- Execute Selenium build using Jenkins

4- Schedule Jobs in Jenkins to run periodically

Selenium integration with Jenkins

Part 1- Download Jenkins

Step 1-  Open your web browser and then Navigate to Below URL
http://jenkins-ci.org  this is the official website of Jenkins

Note- Below post will only work if you work with 1.6 version you can download from below url.

(Download 1.654)

https://updates.jenkins-ci.org/download/war/
Step 2- Now download Jenkins.war file and save into desktop or any other location depends on your choice

Selenium integration with jenkins

Run Selenium with Jenkins

Step 3- Once download complete. You will get Jenkins.war file that we need to execute

 

Selenium integration with Jenkins

Selenium integration with Jenkins

 

Now let’s navigate to another section

Part 2-How to configure Jenkins for Selenium

Go to the location where Jenkins.war is available. In my case, I kept in my project home directory

Selenium integration with jenkins

Selenium integration with Jenkins

Step 2- Open Command prompt knows as CMD   and navigate to project home directory and Start Jenkins server

Start- cmd> Project_home_Directory> java -jar Jenkins.war

Selenium integration with jenkins

Selenium integration with Jenkins

 

Selenium integration with jenkins

Selenium integration with Jenkins

 Step 3-

Once Jenkins server is up and running, you will get above success message.
By default Jenkins runs on 8080 port so you can navigate to below URL for Jenkins UI
Open any browser and type the URL  http://localhost:8080 

Now Jenkins in up and running so now we have to configure Jenkins so that we can execute our test case via Jenkins.

Step 4-

Once Jenkins is running so we are almost done but before moving to create build we need to configure Jenkins so that Jenkins can identify other tools as well like Java, Maven etc.

Click on > Manage Jenkins

Configure

Configure

Click on Configure System

 Selenium integration with jenkins


Selenium integration with Jenkins

Here we are telling Jenkins that our java is located at this location so we don’t have to worry about the explicit path.

Navigate to JDK section and Click on Add JDK button

 Selenium integration with jenkins


Selenium integration with Jenkins

Uncheck Install automatically check box so Jenkins will only take java which we have mentioned above.

 Selenium integration with jenkins


Selenium integration with Jenkins

Give the name as JAVA_HOME and Specify the JDK path

 Selenium integration with jenkins

In Jenkins, we have a very good feature that you can configure email notification for the user.

 

This is optional but if you want to configure Email notification then you have to do little setting while configuring Jenkins

Refer below screenshot you can change login details and click on Apply.

 Selenium integration with jenkins

Once done click on save and apply.

Congrats, your Jenkins is configured now.

Part 3- Execute Selenium build using Jenkins

We can execute test cases in Jenkins using 4 ways refer the below screenshot

 Selenium integration with jenkins

In this post, we will execute using Window batch command

 

Step 1- Create a batch file first then we will add the same batch file to Jenkins

a-To create the batch file we need to set classpath of TestNG so that we can execute testng.xml files

our project structure should look like

 

 Selenium integration with jenkins

b- Open command prompt and set the classpath-

While setting classpath we will set the path of bin folder and libs folder (inside libs we have all libraries)

Home directory > set classpath=C:\Users\Learn-automation\bin;C:\Users\Learn-automation\libs\*;

Note- Please make the changes as per your system

c- Open notepad and type the below command and save as .bat file –

In my case, I have saved as run.bat

java -cp bin;libs/* org.testng.TestNG testng.xml

 

 Selenium integration with jenkins


Selenium integration with Jenkins

Step 2-

Create a job in Jenkins which will execute our build
Open Jenkins on browser (type http://localhost:8080)

a- Click on the new item

 

 Selenium integration with jenkins

b- Give the Job-Name, select Build a free-style software project and Click on OK  button

 Selenium integration with jenkins

c- Navigate to Advanced Project Options > Check the use custom workspace > in directory we will specify the project home directory

 Selenium integration with jenkins


Selenium integration with Jenkins

d- Important part now specify the Add Build step >Click on Execute Windows batch command

 Selenium integration with jenkins

e-In the section please specify the batch file which we created and click on Apply and save

 

 Selenium integration with jenkins

 

Step 3- you can finally run the Build > Click on Build now  option

 

 Selenium integration with jenkins

 

Step 4- Check Build history and Console output and verify the output

 Selenium integration with jenkins

 Selenium integration with jenkins

 

 Selenium integration with jenkins

 

Part 4-Schedule your build in Jenkins for periodic execution

Jenkins comes with very good functionality in which we can schedule jobs which we created

You can schedule build for existing jobs which already created and while creating new project also we can specify the same.

Let’s schedule the job. Refer the below screenshot

Step 1-

Open job which we created now and Click on configure > select the check box build periodically

 Selenium integration with jenkins

 

Step 2-

Specify the time here we need to careful about the syntax

Jenkins works on Cron pattern for more info about cron refer cron link http://en.wikipedia.org/wiki/Cron

Jenkins will accept 5 parameter lets discuss one by one

* * * * *

Here the first parameter- specify minute and range will vary from 0-59

Here the second parameter- specify hours and range will vary from 0-11

Here the third parameter- specify day and range will vary from 0-7 here 0 and 7 will be Sunday

Here the fourth parameter- specify month and range will vary from 1-12

Here the fifth parameter- specify year so here you can specify *

Example 1- if you specify    00 22 * * *  it means your build will run daily @ 10 PM

Example 2- if you specify    50 * * * *  it means your build will run daily  50 min  after every hour

Example 3- if you specify    00 22 1 * *  it means your build will run every Monday @ 10 PM
 Selenium integration with jenkins

Finally, we have executed our test case successfully. If you have any issue while running Jenkins please comment below post if you are finding some issues.

Thanks for visiting my blog. Keep in touch. Have a nice day 🙂

Would love to hear from you.

 

author-avatar

About Mukesh Otwani

I am Mukesh Otwani working professional in a beautiful city Bangalore India. I completed by BE from RGPV university Bhopal. I have passion towards automation testing since couple of years I started with Selenium then I got chance to work with other tools like Maven, Ant, Git, GitHub, Jenkins, Sikuli, Selenium Builder etc.

249 thoughts on “Complete Guide for Selenium integration with jenkins Maven

  1. RAJ says:

    Hi Mukesh,

    How to supply jenkins parameters to selenium testscripts ? Please let me know.

  2. Piyush says:

    In case of mac,i am unable to do below step

    Home directory > set classpath=C:\Users\Learn-automation\bin;C:\Users\Learn-automation\libs\*;

    on mac getting below error

    piyush@Piyushs-MBP SeleniumProject % set classpath=/Users/piyush/IdeaProjects/SeleniumProject/bin;/Users/piyush/IdeaProjects/SeleniumProject/libs/*;
    zsh: no matches found: /Users/piyush/IdeaProjects/SeleniumProject/libs/*

    Do i need to manually create the libs and bin folders in my project structure?

    Note:i am using maven project.

    1. Hi Piyush,

      If you are creating maven project then there is no need for libs and bin folder. Until unless, you have any library which is not available in maven repository. You can refer this link for ready understandibility https://www.youtube.com/watch?v=vFXL4nMWvXI&list=PL6flErFppaj0WwNOMFeXPVlNCDuJyPYFi

  3. Tester_br says:

    Hi Mukesh,

    Thanks for this guide, it’s really helpful.

    Could you please give more details about libs and bin folders? What do we need to add to them?

    Thank you!

    1. Hi Villa,

      Thanks for approaching me. bin folder contains .class files which are java executables and libs contains dependencies which are required during runtime. That is why we setting classpath of these folders. This is old approach. I would recommend you to go with maven which is easy to maintain

  4. Venkatesh says:

    Hi Mukesh,

    How to execute shell command used on Jenkins Slave : Chrome Browser Parameterization. If you have any idea or video link please share me.

    Already code is hardcoded in shell command for my project

    1. Hi Venkatesh,

      Create String/Choice Parameter in Jenkins job. Modify your shell script by which it can accept browser as parameter in runtime like ./ browser. Once it is done then you pass jenkins parameter like ./ $

  5. Ravi says:

    Hi Mukesh,

    My selenium test are passing locally But , some tests are failing in jenkin’s specially the one where I have used Assert class methods like assertTrue / assertFalse (i’ve used it for success message verification) .

    Although, These tests are also passing locally.

    I have tried few things to sort out these failure like used explicitwaits, used pagesource method to find the actual message but nothing worked.

    What could be the issue. Pls let me know.

    Thanks.
    Ravi

    1. Hi Ravi,

      Have you checked the screenshot of corresponding where your test is getting failed. This would help you to analyse issue well.

  6. ram says:

    how can i do code integration, different people implemented code for selenium famework

    1. Hi Ram,

      For integration of code, your team must have common code repository like SVN or Git which help all to integrate individual code efficiently without redundancy.

  7. madhavi says:

    Hi mukesh,

    I have configured maven project in jenkins but my scripts are running in headless browser .what changes i need to do to display the browser.please help me

    1. Hi Madhavi,

      By default in Jenkins, web browser execution runs on headless mode on master. In order to see actual execution, you have to create slave and run your execution on newly created slave.

  8. Avinash Yerramsetti says:

    Hi Mukesh, Can you direct me to a tutorial where it teaches Integration of Nightwatch with Jenkins. Thanks
    in Advance

    1. Hi Avinash,

      Apologies, I haven’t posted anything about nightwatch js framework.

  9. Rajesh says:

    Hi Sir,
    I learned lots of things with your vedios and it is very helpfull for my work i would like to pay thanks for this.

    Now I am runing my Automation script in centos server using jenkins but I am facing one issue i.e “org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary”
    Can you plz help me sir. And this problem is only coming wh=en i am running my script in centos server of my AWS instance.

    1. Hi Rajesh,

      It looks like chrome browser is not installed on your Jenkins hosted server. If not installed, download chrome-stable.rpm from chrome website using wget or any other tool then install it using sudo yum install ./gogole-chorome…rpm

  10. madhavi says:

    hi mukesh

    in one scenario i am facing one issue in automation button is not enabling after entering the mandatory fields but when i entered manually button is enabling i don’t know i could be the reason please help out.

    1. Hi Madhavi,

      Once you fill last mandatory field, call TAB key using Actions class or click on somewhere else so that validation for all filled fields gets done.

      1. madhavi says:

        Thank you mukesh

  11. Santosh says:

    Hi Mukesh,

    Need to run my scripts in Ubuntu Platform through Jenkins

    Please help me the same!

    1. Santosh,you can use Docker here to run Selenium on Linux.

  12. Vijaya says:

    Hi Sir,

    I have installed Jenkin on my window machine version 2.164. Login is required to use the jenkin, I have skipped the registration process, and now i dont remember the default password. How to login to the Jenkin?

    1. Hi Vijaya,

      Go to .jenkins folder(generally in your user folder )-> Open Config.xml file -> Look for tag useSecurity -> Change its value from true to false -> Save that .xml file -> Restart your jenkins

  13. Ram says:

    Hi,
    Kindly provide your advice…we are using selenium tool with hybrid framework…How to integrate the selenium and Jenkins for dynamically select the different script sheet and test data sheet.
    Ex: Using multiple scripts sheet and Test data sheets for each module.
    Note: Our application size is very big 1000 screens. But continuous we are using more that 200+ screens.

    1. Hi Ram,

      Create discrete test case and you can use batch/shell commands to run your different scripts wrt corresponding data sheet and obviously it will take time.

  14. Sudeep says:

    Hi, My bin structure is
    C:\projectWorkSpace\TMS\bin\executionEngine and inside this there are three class files
    1)LoginTMS.class
    2)registerTMS.class
    3)TaskEntry.class
    I have to run registerTMS.class
    Could you let me know command which i need to include in my bat file

    1. Hi Sudeep,

      You can pass only registerTMS.java in your xml and run.

      1. Azhar says:

        Hi Mukesh,
        Need to run jenkins job but browser should be visible,
        How we can do this?

        1. Hi Azhar,

          If you are using windows machine as Slave then don’t run slave as windows service.

  15. roushini says:

    hi
    thanks i was a ui dev like 2 weeks ago thanks to ur youtube channel and tese articles , im able to work on real project scenarios as a tester better in a matter of no time, please keep up the good work
    thanks again and if possible can it be more python related (jus hoping or if u cud point me to somewer i can tose better will be grt)

    1. Hi Roushini,

      I am working on python stuffs.

  16. Mak says:

    Hi Mukesh,
    I need to test number of similar sites with different URLs, but the sites are almost similar, and I can use same set of test cases for all the sites. I also need to test on different browsers and different environments like stage, prod etc.
    Now my question is, if I want to run test suite for only 2 sites, on only one environment(e.g stage), on only two browsers (out of many, say 3), is it possible to decide this at run time?
    I am asking this because, I want it to be decided dynamically, and one should not need to make changes every time in xml to decide on which site, env., browser to execute on. (e.g.: Some times, we need to test only one or two site on only one browser)
    Could you please suggest if there is any way to achieve this.
    Thanks.

    1. Hi Mak,

      As per your requirements, you definitely need to go for testng xml file. You can provide testcase name, gruops, parameter…so on to xml file while building. For this you need to create a Java class which can parse xml file and accept theses parameters.

  17. Sudha says:

    Hi Mukesh, I’ve a doubt and i know that’s silly but i want to clarify it. Whether we can integrate selenium scripts with jenkins without using testng test scripts. Apologies if this sounds stupid.

    1. Hi Sudha,

      yes, you can…As per java, you need to mention main() method in the java file(the one which you want to execute). After building dependencies using POM.xml, just navigate to folder where you have kept your java file then execute as you do in cmd.

  18. Alex says:

    I was wondering if someone can help me with this issue that I am facing when I click on failed test browser screenshot in jenkins to see the failed image I got 404 page not found.
    I had jenkins setup in linux machine and I am using 4 vm’s grid which is work before in another machine the only thing I did I reinstall jenkins in new machine no changes has been done on the testlistener.
    Hope that anyone can direct me to the right track.
    Thanks

    1. Hi Alex,
      As you mentioned that you have new jenkins instance. Could you please check whether the url which is being referenced to view failed screenshot is correct or not.

  19. Gurjot Ahuja says:

    Awesome steps, it worked for me! One thing I would like you to edit above :
    In run.bat file, the command should be :
    “java -cp D:\Eclipse_workspace\Selenium_CMS\libs\*;D:\Eclipse_workspace\Selenium_CMS\bin org.testng.TestNG testng.xml

    1. Thanks Gurjot for updates. I will make the changes soon.

  20. Shiva Krishna says:

    Hi Mukesh, Recently i have installed Jenkins in my company it was installed successfully but the problem is that when we are trying to trigger a report mail using our company mail ID. Could you please send the reply reason behind this issue.

    1. Hi Shiva,

      Did you try Test Mail option inside Manage Jenkins. Moreover it depends on your network connection. Its better if you contact your organizational network admin.

  21. Shoaib Patel says:

    Hi Mukesh,
    If Jenkin server is hosted on a headless unix machine, this will not work. Can you please explain how to execute Cucmber Selenium java scripts on such server?

    Thanks..

  22. Amit Kumar Singh says:

    Started by user anonymous
    Building in workspace C:\mywork\Jenkins
    [Jenkins] $ cmd /c call C:\Users\AMITSI~1\AppData\Local\Temp\hudson8254443489790097217.bat

    C:\mywork\Jenkins>run.bat

    C:\mywork\Jenkins>java -cp bin; libs/* org.testng.TestNG testng.xml
    Error: Could not find or load main class libs.*
    Build step ‘Execute Windows batch command’ marked build as failure
    Finished: FAILURE

    Can you tell me, how to resolve this issue.

  23. Zafar says:

    Hi Mukesh,

    First let me say thank you. I have learnt a lot from your tutorials.
    Now regarding the “Selenium integration with jenkins”. i have followed you tutorial and steps exactly. When i use just a printout statement it works for both(eclipse and Jenkins).
    When i use following code.

    package demoJenkins;

    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.testng.annotations.Test;
    public class JenkinsDemo {
    @Test
    public void testJenkins(){

    System.out.println(“Selnium has been configured with Jenkins”);
    System.setProperty(“webdriver.gecko.driver”, “D:/Selenium/softwares/geckodriver.exe”);
    WebDriver dr = new FirefoxDriver();
    dr.get(“http://www.facebook.com”);
    System.out.println(dr.getTitle());
    dr.quit();
    }
    }

    This code works for Eclipse without any error. But in Jenkin it says
    “D:\java\Jenkins>java -cp bin;lib/* org.testng.TestNG testng.xml
    [[TestNGClassFinder]] Unable to read methods on class demoJenkins.JenkinsDemo – unable to resolve class reference org/openqa/selenium/WebDriver”

    Could you please suggest me the problem with it?

    1. Hi Zafar,

      Please try with maven https://www.youtube.com/watch?v=A4Z1F7gJvkY

      Note- Now a days in companies maven only used.

  24. Ahmed Bilal says:

    You are the best Mukesh! good sharing … did same in same pace with your demo (y)

    1. Great Ahmed. Cheers 🙂

  25. Saurabh Sahu says:

    hello,
    when i open url ,getting authentication pop up so which credential i should give and i tried my window credential that is not working

  26. Arunpandi says:

    You are great bro !! I have seen some of your videos also in youtube before.

    I am going to try this one…Thank you again!!

    1. Yes sure try and let me know if any issue.

      1. Ram says:

        Hi Sir,

        I have one doubt in jenkins ..

        How we will call selenium tests from jenkins

        1. Hi Ram,

          Above guide covers the same only.

  27. Patricia says:

    Hello Mukesh,
    Quick question. I don’t have the folder lib that you mention in your screenshot.
    What’s the meaning of this folder? Should I have one in my project?
    I cannot implement your solution 🙁
    Thanks in advance!

    1. Hi Patricia,

      Lib folder we have to created manually and we need to keep all jars which we downloaded from Selenium site.

      I also use maven approach to run test from Jenkins (Recommended)

      Here is the link for video https://www.youtube.com/watch?v=A4Z1F7gJvkY

  28. Manoj says:

    Hi Mukesh, I AM Following From Long time and It’s a Gr8 Resource For All The Testers But In The Jenkin Video Ur Using 1.6 Version But in 2.19 Jenkins Version There is no Such Options For JDK path setup. So Can U Guide Should I need to Enter the System Variable Details Or We Can Skip That

    1. HI Manoj,

      You can get this option in Manage Jenkins >Global tool configuration

      1. Arvind says:

        Hi Mukesh I want to attach target folder index.html in my jenkins mail. How do I achieve that? I am using junit with cucumber. In the attachment section I am passing target/cucumber-htmlreport/feature-overview.html/**

  29. shivkumar says:

    Hi, Mukesh.
    I have installed and configured Jenkins…but didn’t create an account instead entered as an ADMIN…Later, logged out of the account…
    Now, as I want to use Jenkins,it’s asking for login & password and theirs no option to create a new account ….plz guide me to create a new one.

    1. Hi Shiv,

      You can delete .jenkins folder from C drive user folder and try to do it again with Jenkins 1.6 version.

      1. shivkumar says:

        Thanks buddy for ur quick response…
        I m referring ur blog & all the youtube selenium videos…they simply awesome…thanx (y) 🙂

  30. manish says:

    Hello Mukesh, please help me here
    1 ) in Jenkins, How can we send report of successful builds to recipients? (email)

    2) How can we send automatic test report emails (in Eclipse) to recipients once our TestNG tests completes

    1. Hi Manish,

      For Jenkins Email-Ext plugin can be used.
      From Selenium you can use below link
      https://vistasadprojects.com/mukeshotwani-blogs-v2/send-report-through-email-in-selenium-webdriver/

      1. manish says:

        Thanks a lot Mukesh for quick and great reply.
        Your Jenkins’s short & crispy video on YouTube is superb

        1. Glad it helped 🙂 Thanks Manish

  31. yogesh says:

    im using mac OSX , i want to run selenium test case in command terminal and i don’t know commands in mac pls help me example i want to excute my all test suit at one (terminal)

    1. COnfigure maven only and rest will remain same.

  32. sindhu says:

    HI mukesh , im using mac OSX ,i have to execute the script in execute shell which command should be used and whats the procdure

    1. Hey Sindhu,

      You can directly give path of pom.xml file in OSX then you dont have to write shell script for this.

      refer below video for more details

  33. Rohit Sharma says:

    How can we configure latest Jenkins 2.7.2 ??
    I didn’t see any JDK installation link

    1. Hi Rohit,

      You can find in Global tool configuration.

  34. kanchana says:

    Hi Mukesh sir, I downloaded jenkins (1.6version) also but i cannot see any jdk installation tag on jenkins ?
    please help me in this issue?

  35. kanchana says:

    Hi mekesh sir,
    while executing testng.xml through command propmpt …i am getting this error
    Could not find or load main class org.testng.TestNG….
    please help?????

    1. Hi Kanchana,

      Kindly use maven project and run pom.xml file from cmd.

  36. Nipun says:

    I tried to run my project using Jenkins.There is a functionality where I need to upload a document.
    Its working fine on eclipse.But Jenkins does not allow me to upload the file.

    Can you please provide me with the solution.It would be really helpful

    1. Hi Nipun,

      Are you using sendKeys or AutoIT. I also have so many scenario like this but it works for me always.

      1. Arpita says:

        Hey Mukesh,

        I am also facing the same issue. i am using ActiveIt. Could you please help me with a way?

        1. What is ActiveIt Arpita?

          1. Arpita says:

            i’m sorry i meant AutoIT.
            I have prepared an .exe and using that to upload files form local.
            This is working fine on my local m/c but not working with jenkins, it is not being able to identify the popup then.
            Please help…

          2. Hi Arpita,

            Try with Robot class. It works with Jenkins as well.

  37. Vandana says:

    In short, using jenkins I am unable to launch any site in the firefox browser using command driver.get(“url”);

  38. Pooja Vengurlekar says:

    In above tutorial, while performing above steps, at step 4, I don’t find JDK under Manage jenkins ->Configure System. Please help

    1. Hey Pooja,

      Kindly download Jenkins 1.6 version then only above options will come.

  39. praveen says:

    hi mukesh ..

    ur youtube video is very usefull

  40. Naveen Balanagu says:

    Hi Mukesh,

    I have configured and everything works fine. But I would like to see the browser when I run the tests using jenkins. Can you tell me if that is possible?

    1. Yes if you install Jenkins as war file then you can see the execution live.

      1. Naveen Balanagu says:

        Thanks Mukesh. I reinstalled and configured it again and this time it shows the browser running tests.

        1. Hi Naveen,

          Good to hear. Cheers 🙂

  41. Omar Careem says:

    How to run selenium tests using chrome driver in jenkins? Please let me know.

    1. Hi Omar,

      Process will remain same only small change in script. You can use ChromeDriver()

      Below url will help https://vistasadprojects.com/mukeshotwani-blogs-v2/launch-chrome-browser-using-selenium-webdriver/

      1. Roman says:

        Hi Mukesh , I am trying to run my selenium test with chrome browser in Jenkins . Our company Jenkins supported by AWS . I can run test with firefox but I am not able to run with chrome . I don’t want headless browser , I want run my test with chrome browser in Jenkins browser . Locally my test run with chrome browser perfect but Jenkins is not supporting .If you provide step by step it will be great. I couldn’t find any video or description online . No one talking about it . If you can give us solution it will be very helpful for everyone

        1. Hi Roman,
          As per my knowledge, if your execution is running in headless mode then the slave is installed as service(in windows) on which your test is running. Connect slave without installed as service.

  42. usama awan says:

    Hi Mukesh;

    I am using selenium version 2.53 and firefox 45.02

    On mac when i run my selenium TestNG test case from eclipse/terminal they work perfectly fine but when i build them form Jenkins they fail while locating elements.

    1. Hi Usama,

      Strange for me. Can you please check the console log/error so that we can check the issue.

  43. chandrasekhar says:

    superb info..thank you very much

    1. Your most welcome Mate 🙂

  44. Manmohan says:

    I have successfully installed jenkin in linux sever . i want to execute my test case or testng.xml which is on local system. and sever is command based , there is no browser support . i want my test case to run in server(linux) automatically . what should i do.

    1. Hi Manmohan,

      Not sure on linux 🙁

      1. Sofia says:

        i got error in cmd when i gave java -jar
        unspecified jar

        1. Hi Sofia, Kindly mention the jar also after java -jar jenkins.war

  45. Prashant Soni says:

    thanks mukesh sir, following information are so helpful

  46. Anmol says:

    Hi Mukesh,

    I am not able to run web based selenium scripts using Jenkins. For ex, I have a script which login to gmail and check my emails but not able to make it work from Jenkins.
    Is there any plugin required for the same. ?

    1. Hi Anmol, Kindly provide console output with issues.

      1. Anmol says:

        Hi Mukesh,

        There is no error on the Jenkins side. The script passes successfully in Jenkins. But I am not getting the desired result. Let me explain more about my scenario –

        My Selenium script uses excel sheet to fetch the login id and pwd and then it login to gmail and read the subject of emails and enter it in another excel. This script runs fine as standalone Java application in eclipse. But when configured with Jenkins it is not reading any email and hence not writing anything in the excel sheet. The funny things is – In Jenkins console the script passes successfully.

        The example you have provided works fine in Jenkins at my end also. I can login to facebook and read the title. But my scenario of gmail is not working.

        I am highly thankful that you took time to address my issue. Please see if you can provide more help. Thanks.

        1. Hi Anmol,

          I just tried same thing and it worked like charm.

  47. Test admin says:

    Hi, If I follow the above steps in Linux, will it work?

  48. Pradeep Samson says:

    Hi Mukesh,

    I am getting one error while adding test class – @Test

    “Test cannot be resolved to type”

    Please help!

    1. Can u provide the code as well?

  49. Anwar says:

    Hi Mukesh,

    how to schedule builds in jenkins with out periodically . it means automatically it will run continuously one by one. Please let us know

    1. Hi Anwar,

      I have not tried but its good question let me check out. I use click build now option to run build in Jenkins.

  50. pavankumar says:

    Hi Mukesh,

    I have done the jenkins setup and i am able to run the job with maven integration. I added the recipients list in the Editable email notification section. After the completion of job, i didn’t get any mail from the jenkins. I got “No emails were triggered.” in console output. Please help me!

    1. Hi Paavan,

      Is email config is correct?

      1. pavankumar says:

        Hi Mukesh,

        I checked the configuration and tried to trigger test mail from jenkins which is sent message successfully. I configured the email settings in both Configuration system in Manage Jenkins section, and in Postbuild step in Job configuration also.

        Can i have an option to attach screenshot to this reply to explain in a better way what i have configured.

  51. Rupesh says:

    Hi Mukesh,

    Very good stuff to understand the next level of selenium process.

    Can you please provide the details to connect Jenkins for python

    Kind regards

    1. Hi Rupesh,

      I have not tried with Python but will give a try for this.

  52. Amod Mahajan says:

    Hi Mukesh,

    I have a maven project which runs perfectly through eclipse but when I try to run same project through jenkins, it is getting failed in @BeforeTest only.

    Getting below error message:
    Running TestSuite
    Starting ChromeDriver 2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129) on port 40679
    Only local connections are allowed.
    Tests run: 3, Failures: 1, Errors: 0, Skipped: 2, Time elapsed: 63.388 sec <<< FAILURE!
    beforeTest(MavenDemo.MavenEx) Time elapsed: 63.232 sec <<< FAILURE!
    org.openqa.selenium.WebDriverException: unknown error: unable to discover open pages
    (Driver info: chromedriver=2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129),platform=Windows NT 10.0.10586 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 61.06 seconds
    Build info: version: 'unknown', revision: '31c43c8', time: '2016-08-02 21:57:56 -0700'
    System info: host: 'DESKTOP-G2E94QN', ip: '172.16.2.152', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_101'
    Driver info: org.openqa.selenium.chrome.ChromeDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

    1. Hi Amod,

      Can u try with Chrome driver 2.22

  53. Ranjitha says:

    Hi Mukesh,

    I am following the same steps as mentioned by you above.
    I am stuck in Jenkin proxy configuration.
    Without proxy configuration, email notification is not available.
    But unable to configure proxy setting.

    java -jar Jenkins.war works fine.
    I can see it says it is up and running successfully.

    Later in http://localhost:8080, Proxy configuration, gives error

    Kindly, let me know how should i proceed.

    1. HI Ranjitha,

      Have you tried below steps to set proxy?

  54. Bimlesh says:

    Hi Mukesh,

    I am trying to run my maven test from github using jenkins.

    I am trying to create a new item by selecting maven project and chosing GIT from source code management. When I give the reporsitory URL as “git@github.com:Bimlesh1681/AmazonIndia.git” – I get the error ==> Failed to connect to repository : Error performing command: git.exe ls-remote -h git@github.com:Bimlesh1681/AmazonIndia.git HEAD

    Also with the new version of jenkins, I do not see any options to configure JDK from jenkins > configure system.

    Please advise on both these issues.

    1. Hi Bimlesh,

      I shared video for github and for jenkins you can use Global tool location.

      CLick on manage jenkins – Global tool location. then JDK

      1. Bimlesh says:

        Hi Mukesh,

        Thank you so much for sharing the videos and it was very useful.
        kindly advise on these issues which is stopping me to execute my first job from jenkins 🙁

        Issue 1: I am now able to configure JAVA successfully from the Global Tool Configuration section and from GIT section,
        the Path to Git executable is by default set to git.exe which is giving me the error

        “There’s no such executable git.exe in PATH: C:/Program Files (x86)/RSA SecurID Token Common,
        C:/ProgramData/Oracle/Java/javapath, C:/windows/system32, C:/windows, C:/windows/System32/Wbem,
        C:/windows/System32/WindowsPowerShell/v1.0/, C:/Program Files/ActivIdentity/ActivClient/, C:/Program Files (x86)/ActivIdentity/ActivClient/,
        C:/windows/System32/WindowsPowerShell/v1.0/, C:/Program Files/Java/jdk1.8.0_71/bin/.”

        Issue 2: Also when I am trying to configure a new job from jenkins by choosing Git from the Source Code Management,
        I am specifying the repository URL git@github.com:Bimlesh1681/AmazonIndia.git which is giving me the error
        “Failed to connect to repository : Error performing command: git.exe ls-remote -h git@github.com:Bimlesh1681/AmazonIndia.git HEAD”

        1. is it fixed? Bimlesh

          1. Bimlesh says:

            Hi Mukesh,

            The issue got fixed when I configured the GPG key too along with the SSH key.
            (https://help.github.com/articles/telling-git-about-your-gpg-key/)

            Thanks for checking! 🙂

  55. Ranjana says:

    Hi Mukesh,
    Can you please post the video for complete Maven Project Deployment using Jenkins.

    1. Hey Ranjana,

      I have already uploaded on Youtube and here is the link for the same https://www.youtube.com/watch?v=A4Z1F7gJvkY

  56. Ranjana says:

    Hi Mukesh,
    How to run the selenium tests with “execute shell” option. Please help!

    1. Hi ranjana,

      for linux also you can use maven commands.

  57. Mohanasundaram says:

    pls help me,

    how to resolve this issue”[TestNG][Error]
    cannot instantiate class Com.Helper.Testing

    Note:Com.Helper is package name

    1. You can give some other package name and will run code again.

  58. sahil says:

    Hi Mukesh,

    When adding jar in the jenkins getting error message “C:\Program Files\Java\jdk1.8.0_05 doesn’t look like a JDK directory”.

    Thanks
    Sahil

    1. Hi Sahil,

      It seems JDK in installed at some other location. Kindly check the location again.

  59. kiran says:

    Hi Mukesh
    Thanks for the wonderful tutorial.You made it look very simple.

    I’ve configured my project to run the Build with Jenkins if I execute the testng.xml on my own it successfully execute my test case but if I execute via cmd it simply skips the test and also in Jenkins I get the following error message

    ===============================================
    Suite
    Total tests run: 1, Failures: 0, Skips: 1
    Configuration Failures: 1, Skips: 1
    ===============================================

    Build step ‘Execute Windows batch command’ marked build as failure
    Finished: FAILURE

    However it execute the build successfully if test case output is just using `(system.out.println();)

    if test case relates to opening of browsers it gets failed via Jenkins

    I used the java -cp bin;lib/* org.testng.TestNG testng.xml command as well doesnt work neither in cmd nor in jenkins.

    My jdk bath in configuration I double checked its right.
    C:\Program Files\Java\jdk1.8.0_92

    Thanks in advance!

    1. Hey Kiran,

      If you are using Maven they try to run pom.xml file from Jenkins.

  60. Yuva says:

    Hi Mukesh,

    I have a dought, I design a frame work with Extend Report’s every thing is fine. But if we integrate with Jenkins it’s not working. With out ExtendReports it’s working.

    Can you please let me know any Plugin is available for ExtendReports? , if it is please specify the name.

    1. Hi Yuva,

      No plugin for jenkins for extent reports.

  61. Jai Prakash Keswani says:

    Hi Mukesh,

    When I type “http://localhost:8080” in FF. I receive an error

    “Unable to Connect”
    “Firefox can’t establish a connection to the server at localhost:8080.”

    1. It means jenkins is not started

  62. Jai Prakash Keswani says:

    Hi Mukesh,

    Thanks very much for the easy step by step tutorial. but while setting classpath I am gettig following Error.

    C:\Users\SDWA-174\workspace\Guru99>set classpath-C:\Users\SDWA-174\workspace\Guru99\bin;
    Environment variable classpath–C:\Users\SDWA-174\workspace\Guru99\bin; not defined

    C:\Users\SDWA-174\workspace\Guru99>set classpath-C:\Users\SDWA-174\workspace\Guru99\lib\*;
    Environment variable classpath–C:\Users\SDWA-174\workspace\Guru99\lib\*; not defined

    Could you please clarify, why do we get this kind of error.

    1. Some space issue kindly follow video again.

  63. upali says:

    Hi Mukesh,

    Can you show how to add a build step using Maven?

  64. Neha says:

    Can u clarify what does lib and bin consists of ?? Please note i donot have such folders as I am using a maven project(with pom.xml)..I want to run Testng.xml from jenkins ..How do I do that ??Your quick reply will be appreciated.

    1. Hey Neha,

      Lib contains all jars.
      Bin contain binary files, you will get this folder if you are working with plain java project. If you are working with maven then you can provide testng.xml in pom directly.

  65. Tejas says:

    When i have clicked on build now in jenkins, system is opening the browser and run the script on browser UI.

    1. Hey Tejas,

      It working I guess so what is the issue here?

  66. Adeel Zahir says:

    Hi Mukesh

    I am getting this error

    Error: Could not find or load main class org.testng.TestNG

    Did I miss any step of including testng?

    1. Hi Adeel,

      Class path is not set properly please set class path again.

      1. Adeel Zahir says:

        Thank you. It worked.

      2. Adeel Zahir says:

        I am able to run testng.xml from eclipse. But when I run it from terminal, it gives an error

        org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:

        I have tried almost all the versions of selenium but its not working.

        Firefox version: 31

        1. Hi Adeel,

          Please use FF 45 and Selenium 2.53 version to fix this error.

  67. Ayushi Sharma says:

    I could not find videos for Create build and Execute build for nightly execution and Emailable functionality ,
    could you please ping link here ?

  68. Ankita Jangra says:

    Hey Mukesh,

    I want to do Cucumber-jvm reportin ng using Jenkins plugin (Cucumber-jvm report) and facing the error something like .json file is not found in the expected folder. However, this .json file is created under Eclipse. But, not in the workspace.
    Please help me out!!!

    Thanks in Advance 🙂

  69. pankaj says:

    i have face a problem during integrating jenkins when after typing in cmd java – jars jenkins.war
    it show error:Could not create the Java Virtual Machine.
    A fatal exception is occurred .The Prg is Exit. What can i do pls help me.

    1. Hi Pankaj,

      Please check java properly installed and Java path is set properly

  70. Shri says:

    Hi Mukesh – Thanks for such a easy to follow tutorial on Jenkins – Selenium Integration. Originally my HF reads which browser to execute from excel. But in Jenkins it started throwing error. So I created three different java classes under the package J_Demo(copied code from HF) gave name as J_chrome, J_ff and J_IE. Basically it will read data from excel as browsers are defined with in these java classes. Converted to Testng test. Created batch file separately, but when I executed them from cmd both Firefox and IE threw error. No issue in chrome, successful test run in Jenkins too. Not sure what is the error in FF and IE. Can you please help? Thanks!

  71. Carl Jerich Lague says:

    Hi Mukesh!

    Your tutorial is wonderful! However may I ask if Jenkins with selenium integration can be possible with an application ran by C Sharp? I’ve been searching for helpful tutorial but so far this is the most relevant tutorial I have found. Thanks!

    1. Mukesh Otwani says:

      Hey Carl Thanks 🙂 Yes we can easily integrate any C# application with Jenkins. You can trigger batch command or shell script etc from Jenkins.

      1. Carl Jerich Lague says:

        I am trying to trigger c sharp application from selenium then to Jenkins. Is that doable? thanks!

        1. Can you tell me what exactly you want to trigger ? is it a script?

    1. Hey Kabirul thanks keep visiting.

  72. reddie2203 says:

    Hi mukesh,

    Can you refer me or share me any document on executing selenium webdriver maven scripts on Remote machine (without TestNG) from Jenkins CI tool .

    1. HI Reddie,

      Why you are not using TestNG? Is there any condition?

  73. Satya says:

    Hi Mukesh..

    Please share a post regarding how to configure selenium builder file in jenkins and how to execute build remotely.

    1. Hi Satya,

      I guess Selenium builder is deprecated.

  74. Ajit Singh says:

    Hi,
    “Here second parameter- specify hours and range will vary from 0-11”
    Range should be from 00-23 not till 11.

    1. Hi Ajit,

      Thanks I will update the post.

  75. Srikanth says:

    Hi Mukesh,
    Am facing issue while uploading file in jenkins.Its working normally when i execute on eclipse.But same when i execute
    on jenkins,its not happening.
    Pls help

    1. Hi Srikanth,

      Are you using Robot class or AutoIt. I use AutoIT and it works normally without any issue.

  76. Sanjay Mohan says:

    Hi Mukesh,

    I have downloaded the Jenkins war file but while I try installing the file in Cmd prompt I was getting the following error message – ‘java’ is not recognized as an internal or external command,operable program or batch file.

    I tried following three options but nothing worked fine.Please take a look and reply.

    C:UsersOM>java -jar C:UsersOMworkspaceJava_trainingjenkins.war
    ‘java’ is not recognized as an internal or external command,operable program or batch file.
    C:UsersOM>java -jar jenkins.war
    ‘java’ is not recognized as an internal or external command,operable program or batch file.
    C:UsersOM>Java_training -jar jenkins.war
    ‘java’ is not recognized as an internal or external command,operable program or batch file.

    1. Hi Sanjay,

      It is not jenkins issue its pure java isssue. Java path is not set properly please check and let me know

  77. suresh says:

    Hi Mukesh,
    i configured Jenkins (i used tomcat for jenkins) with selenium script on my windows 10 system, but sometimes it doesn’t run my test suite properly {it runs in background}. But if i run jenkins on different port by using java -jar jenkins.war then it opens browser and runs whole suite perfectly.
    So what can be the problem with the jenkin with tomcat, it may not open the full screen of browser and not able to identify some elements,is it so? Please guide!!
    Thanks in advance!!

    1. Hi Suresh,

      In your case script running in headless mode so you are not able to see the execution which creates some sync issues.

      1. Abhi says:

        Hi Mukesh,

        How would you run your tests in browser and not in the background through Jenkins?

        1. Hi Abhi,

          using Slave machine.

  78. SHEKHAR says:

    Hi Mukesh,

    Thanks for the article. Very helpful.

    I have a requirement, where, after the code is built and deployed (in DEV environment) we need to execute the test cases automatically (testNG.xml). Can you please assist as to how we can do that via Jenkins ? We are through until deployment and would like to know how to run the test cases after that.

    Thanks !

    1. Hi Shekhar,

      is this fixed? Sorry for late reply.

  79. shruthi says:

    Hi,thank you for your reply. fresh new account means ?which account I have to enter their.please tell me what account details I have to pass.IAm new to this feature implementation

    1. Hi shruthi,

      Fresh account means new gmail account with less security. Just pass uname and password for authentication.

  80. shruthi says:

    sending emails part is not working.

    I im doing Test configuration by sending test e-mail,iam getting error like Failed to send out e-mail

    javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at
    535 5.7.8 https://support.google.com/mail/answer/14257 xi8sm166529246pab.9 – gsmtp

    Please help me

    1. Hi Shruthi,

      Try with fresh new account it will work for sure. I just tried and its working fine.

  81. Mubbashir says:

    I’ve configured my project to run the Build with Jenkins if I execute the testng.xml on my own it successfully execute my test case but if I execute via Jenkins I get the following error message

    Build step ‘Execute Windows batch command’ marked build as failure Finished: FAILURE

    However it execute the build successfully if test case output is just using `(system.out.println();)

    if test case relates to opening of browsers it gets failed via Jenkins

    1. Hi Mubbashir,

      It is java path issue only so try to set the path correctly then it will work I will suggest go with maven project then you wont get this issue.

      Try below code

      java -cp bin;libs/* org.testng.TestNG testng.xml

  82. alvin says:

    Thanks for the solution Mukesh. It worked
    Just want to get more info for the below scenario.
    In my project am using Page Object Model with maven. I have a suite file to run BVT scripts with some 10 test script class files mapped in the suite file. Here i would like to know, how i can split to run 5 class files in Master and remaining set in slave system.

    1. Hi Alvin,

      Glad to know that it worked for you :).

      You can configure slave machine and you can create a parameter while will accept machine name as an argument while building project.

      Based on your parameter it will trigger the script in specific machine.

      Please find below link which will help you to setup Master Slave configuration.

      http://learnseleniumtesting.com/jenkins-and-continuous-test-execution/

  83. alvin says:

    Hi Mukesh,

    I would like to know how we can distribute jobs in master and slave systems. So far i have configured my project to run in master and added a slave system to the build, but the scripts are running only in one system

    1. Hi Alvin,

      Click on Job > Select checkbox “Select Label where you want to run” > Specify the node name then save.

      Try this and let me know if still facing any issue.

  84. Ed Nonog says:

    Hi Mukesh,

    I have already configured my Selenium Script from eclipse base from your tutorial including build.xml, pom.xml etc. and I’ve already integrate the selenium script to maven , the tricky part on my instance is on how to import/hook the script into jenkins job or configure?, base from your tutorial you are using windows but my instance is Ubuntu as Jenkins server and svn as my SCM.

    Thanks

    1. Hi Ed Nonog,

      I have not worked on Linux so no idea on this. I have configured on windows only.

  85. sree says:

    Hi Mukesh,

    I have one doubt regarding Jenkins Job configuration
    I have configured a Jenkins job to trigger an automated selenium script which is committed in bitbucket & used selenium grid method to run the process in a particular ip.
    For the first time, the build got success. After that for the all consecutive build showing success only. But the script is not running.

    Can you please suggest any option for how to diagnose or how to make the job success for all builds?

    Thanks in advance,
    Sree

    1. Hi SreeVidhya,

      Can you please check whether it is running correct testng.xml and classes?

      If possible provide me the console log to check the exact issue.

  86. saikiran says:

    i am getting the error when i drag and drop jenkins.war file beside java -jar in cmd plz help me in this

    1. What error you are getting..?

  87. Bhushan says:

    Hi Mukesh.. First of all thanks for the useful tutorial, I am trying out the Jekins with selenium but I want to use the build.xml file in order to execute the test cases instead of .bat file , for this I have to invoke the ant, I have done the initial set up, could you please guide me how to do using build.xml, do I need to create the slave in my case, my selenium setup and jenkins are installed in the local window machine..

    Thanks,
    Bhushan Patil

    1. Hi Bhushan,

      I would suggest you switch from ANT to Maven and follow below steps

      and if you are new to Maven then use below link https://www.youtube.com/watch?v=nasdb9QhFqg

      But if you are still want to work with ANT http://seleniumeasy.com/ant-tutorials/how-to-run-testng-tests-using-build-xml-file

  88. Bhushan says:

    Hi Mukesh.. First of all thanks for the useful tutorial, I am running selenium test set up which is running in my local window machine and recently I have installed the Jenkins on my local machine but I have to execute the seleninum test cases using Invoking Ant i.e. basically using running build.xml file, can u please guide me how to do this ?? Do I need to create Slave for this to run the selenium test cases ?

  89. suresh says:

    Hi Mukesh ,

    1)How to Selected Testcases Executing in Jenkins?
    2)How to Failed Testcases Executing In Jenkins?
    Please help .

    1. Hi Suresh,

      Please find my comment below

      1)How to Selected Testcases Executing in Jenkins?
      Answer- You can create testng.xml for specific test case and mention this xml in batch file.

      2)How to Failed Testcases Executing In Jenkins?
      Ans- Recently I posted an article on this. Please visit this and implement in your project
      https://vistasadprojects.com/mukeshotwani-blogs-v2/re-run-selenium-failed-test-cases/

      Hope this will help you.

      Thanks
      Mukesh

  90. CGupta says:

    Hi Mukesh,

    Can you please explain the same for c#, .Net environment ? We have post on the same over the internet but they are less informative.

    1. Hi Gupta Ji,

      I have not worked on C# so really not sure.

      Thanks
      Mukesh

  91. rachana says:

    Hi,
    I am getting the following error when I run selenium batch script from Jenkins. Can anyone help me.
    Building on master in workspace /var/lib/jenkins/workspace/Selenium
    [Selenium] $ /bin/sh -xe /tmp/hudson636620915094945010.sh
    + /usr/bin/winexe -U mysimst/username%password //172.20.68.50 ‘cmd.exe /k cd /d D:\DevOps_Automation & poc_automation.bat & exit’
    Unknown parameter encountered: “max log size”
    Ignoring unknown parameter “max log size”
    Unknown parameter encountered: “passdb backend”
    Ignoring unknown parameter “passdb backend”
    Unknown parameter encountered: “load printers”
    Ignoring unknown parameter “load printers”
    Unknown parameter encountered: “cups options”
    Ignoring unknown parameter “cups options”
    Unknown parameter encountered: “writable”
    Ignoring unknown parameter “writable”
    Unknown parameter encountered: “guest ok”
    Ignoring unknown parameter “guest ok”
    Unknown parameter encountered: “writable”
    Ignoring unknown parameter “writable”

    D:\DevOps_Automation>set projectpath=”D:\DevOps_Automation\AFramework”

    D:\DevOps_Automation>cd “D:\DevOps_Automation\AFramework”

    D:\DevOps_Automation\AFramework>set classpath=”D:\seleniumjar\testng-sources.jar;D:\seleniumjar\selenium-server-standalone-2.44.0.jar;D:\seleniumjar\selenium-java-2.44.0\selenium-2.44.0\selenium-java-2.44.0.jar;D:\seleniumjar\selenium-java-2.44.0\selenium-2.44.0\selenium-java-2.44.0-srcs.jar;C:\TestNG\guice-3.0.jar;C:\TestNG\reportng-1.1.4.jar;C:\TestNG\testng-6.8.21.jar;C:\TestNG\testng-6.8.21-javadoc.jar;C:\TestNG\testng-6.8.21-sources.jar;C:\TestNG\velocity-dep-1.4.jar;D:\seleniumjar\poi-bin-3.12-20150511\poi-3.12\poi-3.12-20150511.jar;D:\seleniumjar\poi-bin-3.12-20150511\poi-3.12\poi-examples-3.12-20150511.jar;D:\seleniumjar\poi-bin-3.12-20150511\poi-3.12\poi-excelant-3.12-20150511.jar;D:\seleniumjar\poi-bin-3.12-20150511\poi-3.12\poi-ooxml-3.12-20150511.jar;D:\seleniumjar\poi-bin-3.12-20150511\poi-3.12\poi-ooxml-schemas-3.12-20150511.jar;D:\seleniumjar\poi-bin-3.12-20150511\poi-3.12\poi-scratchpad-3.12-20150511.jar;D:\seleniumjar\poi-bin-3.12-20150511\poi-3.12\lib\commons-codec-1.9.jar;D:\seleniumjar\poi-bin-3.12-20150511\poi-3.12\lib\commons-logging-1.1.3.jar;D:\seleniumjar\poi-bin-3.12-20150511\poi-3.12\lib\junit-4.12.jar;D:\seleniumjar\poi-bin-3.12-20150511\poi-3.12\lib\log4j-1.2.17.jar;D:\seleniumjar\poi-bin-3.12-20150511\poi-3.12\ooxml-lib\xmlbeans-2.6.0.jar;D:\DevOps_Automation\AFramework\bin”

    D:\DevOps_Automation\AFramework>java org.testng.TestNG “D:\DevOps_Automation\AFramework”\testng.xml
    [TestNG] Running:
    D:\DevOps_Automation\AFramework\testng.xml

    Started InternetExplorerDriver server (32-bit)
    2.27.0.0
    Listening on port 18880
    log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

    ===============================================
    example suite 1
    Total tests run: 8, Failures: 0, Skips: 8
    Configuration Failures: 1, Skips: 9
    ===============================================

    Build step ‘Execute shell’ marked build as failure
    Finished: FAILURE

    1. Hi rachana,

      COnfiguration is fine I checked your log and found that you are running very old IE driver 2.27 but latest is 2.48.0..

      I will highly recommend that please update all jars and IE driver and run it again.

      https://vistasadprojects.com/mukeshotwani-blogs-v2/download-selenium-webdriver-new-version/

      1. Rachana says:

        Hi,
        I updated ie driver but still getting same error.

        1. Hi Rachana,

          We can have quick session and we can fix this. Add me on Skype will login and fix it soon.

          Skype- sameer5085

  92. Sagar says:

    Called Function : [logoutToApplication] with parameters [userName],[password]=>todakar.sagar@gmail.com,Zenith123
    Called Function : [findElement] with parameters [elementLocator]=>By.xpath: .//*[@id=’wrapper’]/nav[1]/div[2]/a
    Called Function : [fluentWait] with parameters [locator]=>By.xpath: .//*[@id=’wrapper’]/nav[1]/div[2]/a
    Called Function : [isElementVisible] with parameters [locator]=>By.xpath: .//*[@id=’wrapper’]/nav[1]/div[2]/a
    Element has been Found
    ===============================================
    Suite
    Total tests run: 32, Failures: 4, Skips: 1
    Configuration Failures: 1, Skips: 1
    ===============================================

    Build step ‘Execute Windows batch command’ marked build as failure
    Finished: FAILURE

    please give me solution for above error……………

    1. its all because of Sync issue.. Try tom use some wait here.. Explicit wait or Fluient wait

  93. Mig says:

    has anyone seen this error and how to fix it:?
    Thanks in Advance

    Error: Could not find or load main class org.testng.TestNG
    Build step ‘Execute Windows batch command’ marked build as failure
    Finished: FAILURE

    1. Hi Mig,

      There is some TestNG classpath issue. Please make sure that in testng.xml you have given classname with package.

  94. Prashant says:

    I am trying to run tests from Jenkins on my local but it just does not show browser running. I am able to trigger same testng test via OSX terminal (my local). Not sure what is different while trying to run the same testng.xml file from jenkins.

    Error message –

    [TestNG] Running:
    /Users/Shared/Jenkins/Home/workspace/TestJenkins/testng1.xml

    Execute initialize function
    Execute reportSetup
    the main directory you are searching does exist : true
    Execute test case SearchMisftToyz
    log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
    log4j:WARN Please initialize the log4j system properly.
    Signing in to application
    Verifying if Homepage is open
    Selecting Status
    org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
    Command duration or timeout: 10.05 seconds
    Build info: version: ‘2.47.1’, revision: ‘411b314’, time: ‘2015-07-30 03:03:16’
    System info: host: ‘Prashants-MacBook-Pro-2.local’, ip: ‘169.254.116.237’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.10.5’, java.version: ‘1.8.0_60’
    Driver info: org.openqa.selenium.firefox.FirefoxDriver
    Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=40.0.3, platform=MAC, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
    Session ID: 96c33170-a15e-4140-88d0-308ba32e9960
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
    at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:273)
    at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
    at com.selenium.page.RentalLogHomePage.filterByStatusAndTeam(RentalLogHomePage.java:173)
    at com.selenium.tests.RentalLogTests.SearchMisftToyz(RentalLogTests.java:35)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
    at org.testng.TestNG.run(TestNG.java:1057)
    at org.testng.TestNG.privateMain(TestNG.java:1364)
    at org.testng.TestNG.main(TestNG.java:1333)
    Caused by: org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
    Build info: version: ‘2.47.1’, revision: ‘411b314’, time: ‘2015-07-30 03:03:16’
    System info: host: ‘Prashants-MacBook-Pro-2.local’, ip: ‘169.254.116.237’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.10.5’, java.version: ‘1.8.0_60’
    Driver info: driver.version: unknown
    at .fxdriver.preconditions.visible(file:///var/folders/7t/bnx7__gx159fm92d4_kbnpx800007q/T/anonymous2659449284267887507webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:9982)
    at .DelayedCommand.prototype.checkPreconditions_(file:///var/folders/7t/bnx7__gx159fm92d4_kbnpx800007q/T/anonymous2659449284267887507webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12626)
    at .DelayedCommand.prototype.executeInternal_/h(file:///var/folders/7t/bnx7__gx159fm92d4_kbnpx800007q/T/anonymous2659449284267887507webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12643)
    at .fxdriver.Timer.prototype.setTimeout/<.notify(file:///var/folders/7t/bnx7__gx159fm92d4_kbnpx800007q/T/anonymous2659449284267887507webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:623)
    java.lang.Exception: org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
    Command duration or timeout: 10.05 seconds
    Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
    System info: host: 'Prashants-MacBook-Pro-2.local', ip: '169.254.116.237', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.5', java.version: '1.8.0_60'
    Driver info: org.openqa.selenium.firefox.FirefoxDriver
    Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=40.0.3, platform=MAC, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
    Session ID: 96c33170-a15e-4140-88d0-308ba32e9960
    at com.selenium.page.RentalLogHomePage.filterByStatusAndTeam(RentalLogHomePage.java:492)
    at com.selenium.tests.RentalLogTests.SearchMisftToyz(RentalLogTests.java:35)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
    at org.testng.TestNG.run(TestNG.java:1057)
    at org.testng.TestNG.privateMain(TestNG.java:1364)
    at org.testng.TestNG.main(TestNG.java:1333)
    Caused by: org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
    Command duration or timeout: 10.05 seconds
    Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
    System info: host: 'Prashants-MacBook-Pro-2.local', ip: '169.254.116.237', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.5', java.version: '1.8.0_60'
    Driver info: org.openqa.selenium.firefox.FirefoxDriver
    Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=40.0.3, platform=MAC, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
    Session ID: 96c33170-a15e-4140-88d0-308ba32e9960
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
    at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:273)
    at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
    at com.selenium.page.RentalLogHomePage.filterByStatusAndTeam(RentalLogHomePage.java:173)
    … 24 more
    Caused by: org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
    Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
    System info: host: 'Prashants-MacBook-Pro-2.local', ip: '169.254.116.237', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.5', java.version: '1.8.0_60'
    Driver info: driver.version: unknown
    at .fxdriver.preconditions.visible(file:///var/folders/7t/bnx7__gx159fm92d4_kbnpx800007q/T/anonymous2659449284267887507webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:9982)
    at .DelayedCommand.prototype.checkPreconditions_(file:///var/folders/7t/bnx7__gx159fm92d4_kbnpx800007q/T/anonymous2659449284267887507webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12626)
    at .DelayedCommand.prototype.executeInternal_/h(file:///var/folders/7t/bnx7__gx159fm92d4_kbnpx800007q/T/anonymous2659449284267887507webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12643)
    at .fxdriver.Timer.prototype.setTimeout/<.notify(file:///var/folders/7t/bnx7__gx159fm92d4_kbnpx800007q/T/anonymous2659449284267887507webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:623)
    org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
    Command duration or timeout: 10.05 seconds
    Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
    System info: host: 'Prashants-MacBook-Pro-2.local', ip: '169.254.116.237', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.5', java.version: '1.8.0_60'
    Driver info: org.openqa.selenium.firefox.FirefoxDriver
    Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=40.0.3, platform=MAC, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
    Session ID: 96c33170-a15e-4140-88d0-308ba32e9960
    Terminating Browser

    ===============================================
    Suite1
    Total tests run: 1, Failures: 1, Skips: 0
    ===============================================

    1. HI Prashant,

      I can see that you are able to execute test. As per error log I found that below article will help you.

      https://vistasadprojects.com/mukeshotwani-blogs-v2/solve-elementnotvisibleexception-in-selenium-webdriver/

      Please try and let me know if any other help required.

      Thanks 🙂

  95. Karthik says:

    Hi Mukesh,
    Thanks for the wonderful demo…
    I have run the scripts using bat file and it works perfectly…

    How to run the jenkins job using Shell script…?

    1. Mukesh Otwani says:

      Hi Karthik,

      I have not tried with shell script so no idea. Sorry.

      I will check and let u know if any useful link or video.

      1. Karthik says:

        Hi Mukesh,
        Thanks for the reply…
        One more question..?
        I have written automation script using windows operating system and than I uploaded same set of files to linux server. In windows jenkins works perfectly and not in linux.? If we need to set separate classpath in linux?

  96. nitin82 says:

    Hi Mukesh, all the steps are beautifully described.

    Thank you very much for helping out others.

    Am getting stuck in command prompt, receiving error on executing C:UsersNitin_2\JenkinsDemo>java org.testng.TestNG testng.xml that says
    [TestNG] [ERROR]
    Cannot find class in classpath: demoJenkins.DemoJenkinsJobs.

    Am not sure what could go wrong while performing all the steps as mentioned in the video.

    Kindly revert back with a possible solution.

    Thank you!

    1. check this path again C:UsersNitin_2\JenkinsDemo

      seems very small issue while giving class name

      Please make sure before running classpath is set

      1. nitin82 says:

        It was trivial! Sorry to bug you. 🙂

        I was able to execute it successfully!

        Will be going through other videos of yours.

        Thank you very much.

        1. Karl El says:

          Hey Nitin, how did you resolve this ?

          1. Mukesh Otwani says:

            Hey Karl,

            is ur issue fixed?

  97. Ravi Kanth says:

    i have run the scripts on my laptop i have create batfile but not working just open and close the window not running in cmd plz give me solution

    1. What is the build status is it pass or fail?

      have u referred my youtube video for the same please have a look and try the same

      https://youtu.be/1e8I3A49ERc

  98. Ravi Kanth says:

    hi mukesh
    i have one doubt. how to install jenkins

  99. mike comtrox says:

    Hi Mukesh,

    there is one more query to bug you .If we have to run the script on any remote machine than where we will give the machine details(Computer name, username/password) as input. actually what will be the exact way to do this.

    Thanks.

  100. Manne Rakesh says:

    Nice information Mukesh Thanks

    1. Mukesh Otwani says:

      Hi Rakesh,

      Thanks Keep Visiting and Sharing 🙂

  101. mike comtrox says:

    if I am placing my project to any remote repository . how will I give jar file mapping as in Local system we can associate/map jar files from eclipse using java Build path option

    1. Mukesh Otwani says:

      Hi Mike,

      Really nice question, let me explain you in detail. In your case you have to use Maven project and then you have to configure Maven in Jenkins as well. After config setting create a goal in pom.xml and run Jenkins job based on this pom.xml. This will download all jars from server itself before running your build.

      Hope its clear. Soon I will share an article on this itself.

      In mean while you can check below article on Maven

      https://vistasadprojects.com/mukeshotwani-blogs-v2/integration-of-selenium-with-maven-and-create-build-for-continuous-integration/

      1. mike comtrox says:

        Hi Mukesh,

        Thanks for your response , is there any other way to do this apart from using Maven project . Like giving this mapping during runtime with the help of classpath .

        1. Mukesh Otwani says:

          Hi Mike,

          for run time configuration I am not sure because I have not done so far.I will check and will update you

  102. Rajasekhar Jangala says:

    very helpful thanks a lot

    1. Mukesh Otwani says:

      Thanks Raja.. Keep Visiting 🙂

  103. amitaks says:

    Good stuff !!

Leave a Reply

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.