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.
-
1What programming language? What xUnit framework?Twaldigas– Twaldigas2014年07月01日 13:03:20 +00:00Commented Jul 1, 2014 at 13:03
-
I am using java and Testng framework.Ashwani Raj– Ashwani Raj2014年07月01日 13:15:00 +00:00Commented 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– Twaldigas2014年07月01日 14:06:32 +00:00Commented Jul 1, 2014 at 14:06
-
He says he is using TestNG not testing, you can find the website here: testng.orgNiels van Reijmersdal– Niels van Reijmersdal2014年07月01日 15:57:22 +00:00Commented Jul 1, 2014 at 15:57
-
hey @Niels any kind of suggestion is highly appreciated.Ashwani Raj– Ashwani Raj2014年07月02日 06:28:00 +00:00Commented 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:
@BeforeTest public void setup() { // open your popup and click on the link } @Test public void test() { // test case } @AfterTest 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.
-
I am facing problem in opening popup. That popup may contain a dropdown. so need to get that selected value from dropdown and then proceed.Ashwani Raj– Ashwani Raj2014年07月02日 07:21:52 +00:00Commented Jul 2, 2014 at 7:21
-
1Selenium 2 / WebDriver has a
Select
class for dropdowns: selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/…Twaldigas– Twaldigas2014年07月02日 07:30:41 +00:00Commented Jul 2, 2014 at 7:30
Explore related questions
See similar questions with these tags.