I want to open a popup before running my tests and after completing my test run. I want to give few inputs from the popup on basis of that my test will run.

Suppose I have multiple links on which my project is present to test. I want to select the link from popup and then my test cases should run on that selected link.

I have made an html file which have all fields necessary for me. I am trying to open that file in a popup before selenium start running my tests.

Can anyone suggest how to achieve this? I am using Selenium webdriver with Testng.

  • 1
    What programming language? What xUnit framework?
    – Twaldigas
    Commented Jul 1, 2014 at 13:03
  • I am using java and Testng framework. Commented Jul 1, 2014 at 13:15
  • Sorry, but I do not know a framework named "Testing" and when I google for it, I can not find it. Do you have a link for me?
    – Twaldigas
    Commented Jul 1, 2014 at 14:06
  • He says he is using TestNG not testing, you can find the website here: testng.org Commented Jul 1, 2014 at 15:57
  • hey @Niels any kind of suggestion is highly appreciated. Commented Jul 2, 2014 at 6:28

1 Answer 1


TestNG provide a lot of annotations for thinks like that: @BeforeTest, @BeforeSuite, BeforeGroups and more: http://testng.org/doc/documentation-main.html#annotations

It may be look like that:

public void setup() {
    // open your popup and click on the link

public void test() {
    // test case

public void tearDown() {
    // close popup

TestNG also provide Listeners: http://testng.org/doc/documentation-main.html#testng-listeners. With Listeners you can say what before or after a test happens. Also what happens when a test finish, failed, skipped or succeed. Maybe this provide a better way for you.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.