• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Programming Languages
    • Java Tutorials
    • Python Tutorials
    • JavaScript Tutorials
  • Automation Tools and Different Tools
    • Web Automation
      • Selenium with Java
        • Selenium Basic
        • Selenium Advance
        • Selenium Realtime
        • Framework
        • Selenium Interview
        • Selenium Videos
        • Selenium with Docker
      • Selenium with Python
      • WebdriverIO
        • Selenium Webdriver C# Tutorial
      • Cypress
      • Playwright
    • TestNG
    • Cucumber
    • Mobile Automation
      • Appium
    • API Testing
      • Postman
      • Rest Assured
      • SOAPUI
    • testRigor
    • Katalon
    • TestProject
    • Serenity BDD
    • Gradle- Build Tool
    • RPA-UiPath
    • Protractor
    • Windows Automation
  • Automation For Manual Testers
  • Services
  • Online Training
  • Contact us
  • About me
  • Follow us
    • Linkedin
    • Facebook Group
    • Facebook Page
    • Instagram

Automation

Selenium WebDriver tutorial Step by Step

You are here: Home / TestNG Tutorials for Selenium Webdriver

TestNG Tutorials for Selenium Webdriver

testng tutorial for selenium

In this page, I will walk you through TestNG Tutorials which will help you to write efficient scripting in Selenium Webdriver.Most of the guys you have heard TestNG ,Junit,Nunit and you might be having so much curiosity about it.

 

TestNG Tutorials
Just a small introduction about all then we will discuss TestNG in details.

1-TestNG, Junit, Nunit are a separate testing framework which is freely available in the market.

2-TestNG, JUnit mainly we can integrate into Java whereas NUnit works with C# only.

3-Junit comes by default with Eclipse but TestNG you have to install an Add-ons.

4-Junit has fewer annotations as compared to TestNG.

5-Junit automatically does not create HTML report so we have to use ant build tool, but TestNG has rich HTML report generations even for single test case it creates 3 HTML reports

 

we have so much difference please refer their official website you will get a clear picture that how it works.

Note- TestNG is successor of Junit so I will be focusing on TestNG

Official website for Junit is-    http://junit.org/

Official website for TestNg is- http://testng.org/

Official website for NUnit is-   http://www.nunit.org/

What is TestNG and Why we have to use in Selenium

Ans- TestNG is a testing framework which is designed to cover all categories of tests:  unit, functional, end-to-end, integration, etc…

We can combine TestNG with Selenium and we can write Test Cases in Eclipse using Java.

 

TestNG Tutorials for beginner

Some of the TestNG feature as listed below

1- Annotation- It support multiple annotations at a various level so we will discuss in the separate post.

2- Support for data-driven testing (with @DataProvider)

3- Support for parameters.

4- Generate automatic reports

5- We can run failed test case only using testng.xml no need to run the full test suite in case of failure

6- Supported by a variety of tools and plug-ins (Eclipse, IDEA, Maven, etc…).

7- Default JDK functions for runtime and logging (no dependencies).

8- Dependent methods for application server testing.

 

                                 I have very details video on TestNG which will help you to get started 

TestNG Tutorials for Selenium 

Configure Eclipse with Selenium and TestNG

New- Installation of TestNG Using Eclipse MarketPlace

Create First TestNG Program and Execute.

Check reports generated by TestNG

Cross browser testing using TestNG

Create Data driven framework using DataProivider

 How to execute only failed testcases in Selenium Webdriver

How to generate Selenium log using TestNG

What is TestNG Listerner and How to implement TestNG Listener in Selenium Webdriver

How to disable testcase in Selenium using TestNG

How to group Testcases in Selenium using TestNG 

How to create dependency between Test cases in Selenium Webdriver

How to execute testng.xml file through Java Program

Execute Selenium Webdriver Test cases parallel using TestNG

Create custom report with Graph, Pie Chart and Screenshot attached in Report

Reader Interactions

Comments

  1. ankit says

    April 8, 2020 at 3:18 PM

    Hi sir can you give me pom.xml dependencies i am unable to find the deoendencies and build please prove me link to

    Reply
    • Mukesh Otwani says

      April 8, 2020 at 7:24 PM

      Hi Ankit,

      Please check this link http://learn-automation.com/selenium-maven-build-and-usage/
      OR you can visit my framework video playlist here for more understanding https://www.youtube.com/watch?v=vFXL4nMWvXI&list=PL6flErFppaj0WwNOMFeXPVlNCDuJyPYFi

      Reply
  2. vasanthan R says

    December 20, 2019 at 11:14 AM

    Very interesting to learn Automation with help of you Mukesh.

    Do you have any post regarding TOSCA?

    Reply
    • Mukesh Otwani says

      December 20, 2019 at 1:38 PM

      Hi Vasanthan,

      Sorry, I don’t have any posts for TOSCA…

      Reply
  3. RajaV says

    September 13, 2018 at 6:22 PM

    hi Mukesh,
    I have created a java class with just simple code to read a excel file data, and it has been converted as TestNG class. there is no any error while run the code but when i trying to debug the code it says “Source not found” NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available. kindly suggest what i have to do.

    Reply
    • Mukesh Otwani says

      September 14, 2018 at 9:15 PM

      Hi Raja,

      Kindly use *Convert TestNG* instead of *Create testNG class*, if you were trying to run your script through testng.xml

      Reply
  4. Hema.T says

    September 13, 2018 at 3:19 PM

    Im a fresher for the Testing. And i started creating base class for login using TestNG and the expected page got open.
    The next step i have a bootstrap dropdown buttons containing links to the pages.
    my question is how i call the baseclass to a new class in testNG

    Reply
    • Mukesh Otwani says

      September 14, 2018 at 10:09 AM

      Hi Hema,

      Either create an object base class or use inheritance concept.

      Reply
  5. Vandana says

    September 5, 2018 at 6:07 PM

    Hi Mukesh,
    I have tried Create Data driven framework using DataProivider scenario 1.
    But getting exception java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 2
    Can you help me out please.

    Reply
    • Mukesh Otwani says

      September 7, 2018 at 8:45 AM

      Hi Vandana,

      Please debug your code because this exception comes when we try to access index of an array which doesn’t even exist. Check how many data are you passing from dataProvider annotated method.

      Reply
  6. sudheer says

    August 17, 2018 at 8:36 PM

    Hi, I am not getting xml file location in the console. What should I do?

    Reply
    • Mukesh Otwani says

      August 18, 2018 at 1:14 PM

      Hi Sudheer,

      Have you triggered your script through testng.xml file?

      Reply
  7. Sudha says

    August 3, 2018 at 4:30 PM

    Thanks for your reply but have confusion ,where should i insert that code within a class or TestNG.xml file,can u send me example XML file.

    Reply
    • Mukesh Otwani says

      August 3, 2018 at 9:03 PM

      Hi Sudha,

      This is actually invoking testng.xml from a java class which is called as testng runner class. Please check this link http://testng.org/doc/documentation-main.html#running-testng-programmatically

      Reply
  8. Sudha says

    August 2, 2018 at 11:05 AM

    I got a case.. Running TestNG.XML file suppose i have 10 classes(scripts),in that 10 class first class is filed.Is there any way to skip the 9 classes ,Please provide the solution.

    Reply
    • Mukesh Otwani says

      August 2, 2018 at 1:16 PM

      Hi Sudha,

      You have to edit testng.xml file in run time. Then may be this post will help you https://stackoverflow.com/questions/35693359/how-to-skip-a-class-which-is-mentioned-in-testng-xml-through-programs

      Reply
  9. Sonali says

    June 21, 2018 at 12:08 PM

    Superb Article.Very easy way to learn.
    Thanks for sharing such a great knowledge

    Reply
    • Mukesh Otwani says

      June 22, 2018 at 9:06 AM

      Hi Sonali,

      Thanks for your appreciation…:) I’ll always try my level best to serve my subscribers with best content

      Reply
  10. ashish says

    June 11, 2018 at 10:01 PM

    Hi Mukesh,

    Can you please explain in details how to use annotations efficiently

    Reply
    • Mukesh Otwani says

      June 12, 2018 at 3:47 PM

      Hi Ashish,

      You can refer this link http://learn-automation.com/testng-tutorials-for-beginners/ for your initial learning then refer this link also https://www.tutorialspoint.com/testng/testng_basic_annotations.htm

      Reply
  11. PRAMOD says

    April 17, 2018 at 2:42 PM

    why don’t we use main method in testng whats the reason

    Reply
    • Mukesh Otwani says

      April 17, 2018 at 6:30 PM

      Hi Pramod,

      TestNG library already handles this logic itself. That is why, TestNG makes framework creation and script execution easy.

      Reply
  12. PRAMOD says

    April 17, 2018 at 2:36 PM

    Hi Mukesh the way of u r explination is fantastic…
    i have small doubt if there are 20 test case i want to execute all together by generating xml file but in case if i want create own xml file what is the approach to create own xml file with out generating by default

    Reply
    • Mukesh Otwani says

      April 18, 2018 at 9:46 AM

      Hi Pramod,

      If you executing those test cases using TestNG framework then syntax and content on xml file should be as per what is being defined by testng.

      Reply
  13. jyoti says

    April 4, 2018 at 5:53 AM

    nice explaination. Thankyou.

    Reply
    • Mukesh Otwani says

      April 4, 2018 at 10:42 AM

      Hi Jyoti,

      Thanks for your appreciation…:)

      Reply
  14. Sree says

    March 21, 2018 at 3:11 PM

    Hi Mukesh could you please provide code for executing the failed testcases automatically whenever it fails by using testng framework

    Reply
    • Mukesh Otwani says

      March 22, 2018 at 12:15 AM

      Hi Sree,

      There are 2 ways to do this,
      1. TestNG creates test-output folder, which contains xml file viz testng-failed. Run it using testng runner class
      2. Implement TestNG IRetryAnalyzer interface into a class, where you can set no. of times of execution also.

      Reply
  15. Babu says

    March 10, 2018 at 4:19 AM

    How to continue running test case execution in TestNG even a test case in TestNG.xml fails

    Reply
    • Mukesh Otwani says

      March 12, 2018 at 10:18 AM

      Hi Babu,

      If you mention multiple test cases in TestNg.xml, by default it executes all test cases even though something fails in between.

      Reply
  16. Ajay says

    March 8, 2018 at 3:31 PM

    How to compare two xml files via selenium web driver? I searched all your videos but i couldn’t find it.Thanks in advance

    Reply
    • Mukesh Otwani says

      March 12, 2018 at 9:42 PM

      Hi Ajay,

      There are two ways to parse xml, SAX Parser and JDOM Parser. Please visit these link –> JDOM parser SAX Parser. Read each node and compare it.

      Reply
  17. Saikumar says

    January 26, 2018 at 9:24 PM

    Hi mukesh ,
    I am using TestNG currently , I am declaring a Chrome driver instance in @BeforeTest class but i am not able to use the same instance in @Test please advice

    Reply
    • Mukesh Otwani says

      January 28, 2018 at 11:44 PM

      Hi Saikumar,

      I hope you are using same driver instance everywhere.

      Reply
  18. Ajmal says

    December 5, 2017 at 4:04 PM

    Hi Mukesh,
    1.Package A
    1.1BaseTest
    2.Package B
    2.1 Pages (contains action and related functions of each page)
    3.package C (Holds my Testscripts)
    1.TestCase 1 login
    2.TestCase 2 Homepage
    My First Testcase contains (3 test methods with priority sequence like 1. 2,3 (working fine)
    My second Testcase (3 test methods with priority sequence like 1. 2,3 but getting failed at test method one itself (priority =1)
    Error :- unable to locate an element
    the same thing working fine if i change the priority of the second test case testmethod priority 1 to priority 4.

    Reply
    • Mukesh Otwani says

      December 16, 2017 at 2:48 PM

      Hi Ajmal,
      This is not an issue of testng. Unable to locate element comes from selenium. So debug your code because issue is wrt locator which you have used.

      Reply
      • Atul says

        February 18, 2018 at 11:39 PM

        Hi Mukesh,
        How can we generate XLST report , If we are running our tests using maven integration, what additional configuration required in POM.xml to generate XLST report.

        Reply
        • Mukesh Otwani says

          February 20, 2018 at 7:11 PM

          Hi Atul,

          Extent report is far better option than XSLT report http://learn-automation.com/advance-selenium-reporting-with-screenshots-2/

          Reply
  19. Ajmal says

    December 5, 2017 at 3:47 PM

    Hi Mukesh,
    i have question ,we can execute failed testcase using(testng-failed.xml) but if my testcase have dependecy on some pass testcase in this case how to can execute.

    Reply
    • Mukesh Otwani says

      December 22, 2017 at 3:17 PM

      Hi Ajmal,

      testng-failed.xml will also contains dependent test cases also(either passed or failed). As without these dependencies, failed ones won’t get execute.

      Reply
      • Deepa Kulkarni says

        February 11, 2018 at 1:44 AM

        Hi Mukesh, does testing-failed.xml file will generate automatically for failed TC? or we manually need to create it to run only failed TCs?

        Reply
        • Mukesh Otwani says

          February 12, 2018 at 10:13 AM

          Hi Deepa,

          It creates automatically.

          Reply
          • Deepa says

            February 14, 2018 at 10:04 AM

            ok Thank you

  20. Jayasree says

    November 29, 2017 at 4:36 PM

    Hi Mukesh,
    I have a TestNG project. Don’t have any main class, currently it is running like “Run As TestNG”.
    I want to export it as runnable jar or jar so that any one can just hit a command from command line and test cases start running.
    Thanks in advance

    Reply
    • Mukesh Otwani says

      January 3, 2018 at 10:14 AM

      Hi Jayasree,

      Using Eclipse Export Wizard, select ‘Create Runnable Jar’ and select the class which is entry point (TestNG runner class having main method which should read testNG xml file) of your project.
      Now, to create testng runner class, please refer this link http://testng.org/doc/documentation-main.html#running-testng-programmatically

      Reply
  21. lalit says

    November 25, 2017 at 4:20 PM

    Hi Mukesh,
    I am quite new to automation and trying to Install TestNG from MyEclipse But I cannot find Market Place from where I can download. Any suggestion?
    MyEclipse Enterprise Workbench version 2017 CI 8 I am using.

    Reply
    • Mukesh Otwani says

      November 27, 2017 at 5:34 PM

      Hi Lalit,

      Please use this links for eclipse download (based on your system architecture)
      32 Bit -> https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/oxygen/1a/eclipse-jee-oxygen-1a-win32.zip
      64 Bit -> https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/oxygen/1a/eclipse-jee-oxygen-1a-win32-x86_64.zip

      After extracting eclipse, follow this link http://learn-automation.com/how-to-install-testng-in-eclipse/

      Reply
  22. Ajit Kumar says

    November 18, 2017 at 10:32 AM

    Hi Mukesh,
    I always watch your video on you tube and I like your study material bcz your explanation style is nice and it is very easy to understand. I ave one question I want to write data from excel sheet and I also want to make this code as library for use many times. So how can i make this, please share me code,
    Thank you

    Reply
    • Mukesh Otwani says

      November 20, 2017 at 9:48 AM

      Hi Ajit,

      Please go through this link http://learn-automation.com/read-and-write-excel-files-in-selenium/

      Reply
  23. Rabbu says

    October 29, 2017 at 9:16 PM

    Hello Sir,
    I am one of your big fan. You are amazing teacher. I love your video specially Automation testing. It is very accurate and easy to understand. God bless.
    Thank you,

    Reply
    • Mukesh Otwani says

      October 30, 2017 at 10:07 AM

      Hi Rabbu,

      Your comment made my day. Very very thanks for your blessings…:)

      Reply
  24. Aditya Gour says

    October 27, 2017 at 4:19 PM

    Hi Sir,
    i want to capture screenshot but i am facing error.
    please see below code.
    i am facing error in this line “FileUtils.copyFile(scrFile, “C:\\Aditya”);”

    Reply
    • Mukesh Otwani says

      October 27, 2017 at 7:14 PM

      Hi Aditya,

      Please check this link http://learn-automation.com/how-to-capture-screenshot-in-selenium-webdriver/

      Reply
  25. Ravi Gavkare says

    October 4, 2017 at 9:31 AM

    Hello Mukesh,
    I am getting below error while running multiple testcases.

    org.openqa.selenium.NoSuchSessionException: Session ID is null. Using WebDriver after calling quit()?

    It works when only one test executed at a time but when I try to run more than one test case then the second onward testcase failed due to above mentioned reason.
    Please suggest.

    Reply
    • Mukesh Otwani says

      October 4, 2017 at 11:23 AM

      Hi Ravi,

      Exception message itself is saying that you are using WebDriver instance after calling quit(). You might be calling quit() method at end of first test script. Call this quit() after execution of last script.

      Reply
  26. Mohini says

    September 26, 2017 at 7:12 PM

    Hi Mukesh,
    How to handle Dropdown with TestNG and Page Factory concept.

    Reply
    • Mukesh Otwani says

      September 26, 2017 at 7:27 PM

      Hi Mohini,

      Handling drop down is nowhere related to TestNG and Page Factory. Create a method/function in library and use wherever you want.

      Reply
  27. Sachith Palihawadana says

    September 20, 2017 at 6:38 PM

    Your tutorials are really helpful . Thanks in advance 🙂

    Reply
    • Mukesh Otwani says

      September 20, 2017 at 8:06 PM

      Hi Sachith,

      Thanks…:)

      Reply
  28. Anant Anurag Yadav says

    September 17, 2017 at 10:16 PM

    Hi Mukesh,
    I am a big fan of your selenium videos. They are amazing and to the point. I had just recently started learning selenium on my company’s laptop and I have some issues in all the browsers. Please help me out
    Firefox(55.0.3): Selenium WebDriver would open the browser but won’t do anything further. It won’t even enter the URL.
    Chrome(60.0.3112.113): Browser opens and then gets closed abruptly
    IE(11.0.9″): It works extremely slow. For instance if I try to launch FB and enter the name in the First Name field using SendKeys() it takes years to enter it.

    Below are some more details:
    Eclipse: Oxygen Release (4.7.0)
    OS: Windows 7 64 bit
    Selenium: selenium-java-3.5.3
    I can’t upgrade or downgrade any piece of software including the browsers due to admin settings.

    Help me out!!

    Reply
    • Mukesh Otwani says

      September 19, 2017 at 3:14 PM

      Hi Anant,

      In your case, i would suggest you to go with latest geckodriver but I am not quite sure about Selenium 3.5.3.

      Reply
  29. RANJAN V says

    September 14, 2017 at 10:26 AM

    Your Tutorials are amazing.

    Reply
    • Mukesh Otwani says

      September 14, 2017 at 4:12 PM

      Hi Ranjan,

      Thanks for your comments…Keep learning…:)

      Reply
  30. Ajith says

    August 2, 2017 at 7:16 PM

    when i trying to run testNg program it show some “A JNI error has occurred, please check it your installation and try it again” how can i solve this problem

    Reply
    • Mukesh Otwani says

      August 4, 2017 at 9:47 AM

      Hi Ajith,

      Please mention which version of testNG and eclipse you’re using?

      Reply
  31. Gautam Pandey says

    June 24, 2017 at 2:50 PM

    Hi Mukesh,
    Could, I run a testNG suite of 100 test cases by using selenium grid. If it is possible to run, please tell me how to set the all the configuration in all test cases at a time.

    Reply
    • Mukesh Otwani says

      June 26, 2017 at 7:10 PM

      Hi Gautam,

      Please refer this link http://learn-automation.com/selenium-grid-for-remote-execution/

      Reply
  32. Raj says

    June 2, 2017 at 5:24 AM

    1. Please correct me if my understanding is correct: How we know, that TestNG is installed in the eclipse: I did Rt. Click on the Project- > It shows”TestNG”. That means it is installed. Am i right?
    2. Iam trying to run the “testng.xml” as a TestNG Suit. But iam getting following error :-
    ” Cannot complete the install because one or more required items could not be found.
    Software being installed: TestNG M2E Integration (Optional) 6.11.0.201703011520 (org.testng.eclipse.maven.feature.feature.group 6.11.0.201703011520)
    Missing requirement: TestNG M2E Integration 6.11.0.201703011520 (org.testng.eclipse.maven 6.11.0.201703011520) requires ‘bundle org.eclipse.m2e.core 1.5.0’ but it could not be found
    Cannot satisfy dependency:
    From: TestNG M2E Integration (Optional) 6.11.0.201703011520 (org.testng.eclipse.maven.feature.feature.group 6.11.0.201703011520)
    To: org.testng.eclipse.maven [6.11.0.201703011520]”

    Could you please tell me what is the issue here? Is it a TestNg installation issue? Please guide.

    Reply
    • Mukesh Otwani says

      June 2, 2017 at 9:56 AM

      Hi Raj,

      Check in marketplace whether testng is installed completely or not. If it is installed, then uninstall it. Restart eclipse and install it once again. Sometimes due to network connectivity, testng installation failure happens.

      Reply
  33. Sumanta bhattacharjee says

    May 2, 2017 at 6:25 PM

    How to handle Drop down and Date picker in Selenium?

    Reply
    • Mukesh Otwani says

      May 3, 2017 at 12:01 PM

      Hi Sumatha,

      Please check these link…
      1. http://learn-automation.com/handle-calender-in-selenium-webdriver/
      2. http://learn-automation.com/handle-dropdown-in-selenium-webdriver/
      3. http://learn-automation.com/handle-bootstrap-dropdown-in-selenium-webdriver/

      Reply
  34. sesidhar says

    March 19, 2017 at 1:29 PM

    Hi Mukesh
    Can we find the bugs in web application through selenium scripts??

    Reply
    • Mukesh Otwani says

      March 21, 2017 at 11:47 PM

      Hi Sesidhar,

      Automation is done for regression testing. If your script fails then it means that required data or functionality flow is not working. But you can’t test whole application thoroughly using Selenium.

      Reply
  35. sesidhar says

    March 19, 2017 at 1:26 PM

    Hi Mukesh
    After completion of writting entire code ,Is we have to send the code to client?? If we have to send means, how please to tell me (OR) The test ng reports are enough to show to the clients .

    Reply
    • Mukesh Otwani says

      March 21, 2017 at 11:54 PM

      Hi Sesidhar,

      It depends on your client requirements. Ask them, what they want?

      Reply
  36. sesidhar says

    March 19, 2017 at 1:12 PM

    Hi Mukesh
    can we use test suite in data provider annotation ??
    please tell me the example in real time .

    Reply
    • Mukesh Otwani says

      March 25, 2017 at 11:33 PM

      Hi Sesidhar,

      I think, dataprovider works with @Test annotations only

      Reply
  37. Saikrishna says

    March 18, 2017 at 6:47 PM

    Hi mukesh,

    Please guide how to parameterize the scripts using Excel.

    Reply
    • Mukesh Otwani says

      March 21, 2017 at 11:51 PM

      Hi Saikrishna,

      Feed the required data which you are reading from excel directly into your script. For more details, check this link

      Reply
  38. Ramya says

    March 18, 2017 at 5:28 PM

    Hi Mukhesh,

    There could be a situation when we have to have Junits and TestNG files in the same Maven project together. I believe we have to have Maven Profiles in such cases. Could you please share an example if u have implemented anything like that by any chance.

    Reply
    • Mukesh Otwani says

      March 25, 2017 at 11:26 PM

      Hi Ramya,

      As per you mentioned, JUnit and TestNG jars can coexist in same profile. Only this is whenever you use any annotation which are common to both JUnit and TestNG, while coding, import only those which you want.
      As of now, I don’t have any post based on profile in Maven, but very soon I’ll post it.

      Reply
  39. Manish Sharma says

    March 3, 2017 at 11:34 AM

    Hi Mukesh,

    Please guide be to write the script for below test case.
    Login from user1
    Update user profile details like Age, date of birth, Pan number, Adhara number.
    Logout

    I want to repeat this scenario for 200 users by using testNG data driven framework.

    my concern is this that how many methods i have to creates for this scenario?
    i have created 5 methods two dataprovider methods for login and update.
    open()
    login()
    updateDetails()
    logOut()
    quitBrowser()

    But execution first completed the login loop and after that gets failed

    Reply
    • Mukesh Otwani says

      March 7, 2017 at 8:15 PM

      Hi Manish,

      I think these methods are enough, only thing is that your test data(i.e. user credentials are changing). Keep credentials of 200 users in some external files such as excel file. Loop you script execution 200 times in which each it read it from excel one by one.

      Reply
  40. Prabhakar says

    February 22, 2017 at 11:56 AM

    Hi Mukesh,

    This is Prabhakar. Am very big fan your articles in Selenium and follow regularly.Have one query ..Can we write and execute Selenium Code with TestNG jars Since don’t have internet access inside my project to download from eclipse.

    Thanks,
    Prabhakar

    Reply
    • Mukesh Otwani says

      February 22, 2017 at 2:48 PM

      Hi Prabhakar,

      There are two things for testng wrt query you have asked over here. One is testng plugin for eclipse which is kind of tricky to configure offline and second one is testng jar file which should be available in build path of your project in order to execute scripts.
      Now, tell me which one is your concern?

      Reply
      • Prabhakar says

        February 22, 2017 at 3:37 PM

        Am trying to execute scripts with TestNg by adding TestNG jars to my project..Is it allowed ?

        From Eclipse downloaded TestNg tried(From Home) and is working fine..

        But in my project(Bank) where don’t have access to download any file from internet..So is there any other option to access TestNG like adding jars to project ..

        Reply
        • Mukesh Otwani says

          February 22, 2017 at 4:54 PM

          Hi Prabhakar,
          It is better to discuss this requirement with your project manager. Usually organizations implement their proxy settings won’t allow you to download any jar file and if you do this by your own then they can sniff it.

          Reply
  41. satya narayana says

    February 20, 2017 at 6:27 PM

    hi mukesh
    is there any emulator online which does the job of selenium webdriver

    Reply
    • Mukesh Otwani says

      February 21, 2017 at 5:27 PM

      Hi Satya,

      Sorry, I didn’t get your question.

      Reply
  42. Manish says

    February 1, 2017 at 12:36 PM

    Hi Mukesh,
    Could you please post an example for the following
    1. @BeforeClass and @AfterClass for a multiple class test.
    2. @Before Mothod and @AfterMethod for a multiple class test.

    Reply
    • Mukesh Otwani says

      February 1, 2017 at 5:22 PM

      Yes I will try to post soon.

      Reply
  43. Gaurav Khurana says

    January 18, 2017 at 2:34 PM

    Thanks I was able to complete the TestNG tutorial for the above tutorials for beginners. Is there something for advanced level as well or interview questions related to just testNG

    Reply
    • Mukesh Otwani says

      January 24, 2017 at 4:53 PM

      Yes Gaurav there is lot more to explore about testng http://testng.org/doc/documentation-main.html

      Reply
  44. Vinit Kumar says

    January 13, 2017 at 9:38 PM

    Hi Mukesh
    I want to know that how to write x-path in Chrome browser.Because fire bug is not plugin for chrome .is there any way to write x-path without fire bug.

    Reply
    • Mukesh Otwani says

      January 13, 2017 at 10:00 PM

      Hi Vinit,

      Yes Vinit, there is a chrome extension called as ‘XPath Helper’ using which relative xpath can be verified. There is another way but easy for those who can create relative xpath on the fly. Please follow these steps:
      1) Once you load your required webpage, press F12(Developer tool)
      2) Now press Cntrl+F12
      3) Now you can see one text box at bottom of html script.

      Now in this texbox you can check your relative xpath and verify matching nodes.

      Reply
  45. renuka says

    January 12, 2017 at 7:33 AM

    hi mukesh
    i have one doubt.i am able to open crome or firefox using maven project ? if yes where did we put the chromedriver.exe or geckodriver.exe

    Reply
    • Mukesh Otwani says

      January 13, 2017 at 10:12 AM

      Hi Renuka,

      Maven doesn’t affect your script execution. It gives you Maven structure for your project and help you to meet dependencies as defined in POM.xml. You can use all .exe files as usual.

      Reply
  46. manish says

    December 1, 2016 at 10:25 AM

    Hi Mukesh,
    Can we set priority of Test in testng.xml file itself ?
    Thanks!!

    Reply
    • Mukesh Otwani says

      December 6, 2016 at 2:24 PM

      Hi Manish you can assign groups and sequence in testng.xml file.

      Reply
  47. suraj says

    October 19, 2016 at 10:41 AM

    Hi Mukesh,
    Can you share the sample framework of hybrid and keyword driven using TestNG.
    That will be really helpful

    Reply
    • Mukesh Otwani says

      October 20, 2016 at 2:19 PM

      http://learn-automation.usefedora.com/p/selenium-frameworks-and-selenium-question-answers

      Reply
  48. Neha says

    October 13, 2016 at 12:02 PM

    Hi Mukesh,
    This is not what I am looking for.
    I want to automate one web application where we have to set http request headers with that request.

    Then user will be identified with those http headers and then he will be redirected to the homepage of that application

    Can we do this using selenium?
    Plesae explain this

    Reply
    • Mukesh Otwani says

      October 13, 2016 at 4:41 PM

      Hi Neha,

      I am not sure on this. I have mainly worked in test automation so not good in api testing.

      Reply
  49. Neha says

    October 8, 2016 at 11:11 PM

    How can we execute http request using selenium webdriver which requires http headers?
    And that url will open browser having UI

    Reply
    • Mukesh Otwani says

      October 9, 2016 at 11:11 PM

      Hi Neha,

      This is what exactly you are looking http://learn-automation.com/find-broken-links-using-selenium/

      If not then please explain requirement in brief.

      Reply

Leave a Reply Cancel 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.

Primary Sidebar

Free Selenium Videos

https://www.youtube.com/watch?v=w_iPCT1ETO4

Search topic

Top Posts & Pages

  • Selenium Webdriver tutorial for beginners
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Selenium Webdriver C# Tutorial
  • WHAT ARE YOUR EXPECTATIONS FROM US?

Stay connected via Facebook

Stay connected via Facebook

Archives

Footer

Categories

Recent Post

  • API Testing Using Postman And RestAssured
  • Disable Personalise Your Web Experience Microsoft Edge Prompt In Selenium
  • How To Fix Error: No tests found In Playwright
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Best and easy way to Group test cases in selenium

Top Posts & Pages

  • Selenium Webdriver tutorial for beginners
  • How To Fix Eclipse Autocomplete Or Code Suggestion In Eclipse
  • Selenium Webdriver C# Tutorial
  • WHAT ARE YOUR EXPECTATIONS FROM US?