org.openqa.selenium.WebDriver
Contains WebDriver Interface need to instantiate a new browserorg.openqa.selenium.chrome.ChromeDriver
Contains the Chrome driver class used to instantiate chrome driver onto the browser which is instantiate using WebDriver class
WebDriver w= new ChromeDriver()
org.openqa.selenium.By
By class is used to locate the various elements on a web pagejava.util.concurrent.TimeUnit
Used for implicit waitWebDriver w= new ChromeDriver()
w.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS)
org.openqa.selenium.support.ui.WebDriverWait
org.openqa.selenium.support.ui.ExpectedConditions
Used for explicit waitWebDriverWait w= new WebDriverWait(driver, 5)
Use wait object with ExpectedConditions on
portions where you need the explicit wait to occur-
w.until(ExpectedConditions.visibilityOfElementLocated(By.name("id")))
org.openqa.selenium.support.ui.Select
Used to control & acccess the drop down valuesSelect s= new Select(driver.findElement(By.name("elementName")))
s.selectByVisibleText("Value")
OR
s.selectByValue("value")
org.openqa.selenium.interactions.Actions
org.openqa.selenium.interactions.Action
Actions is user-facing API used to perform complex user gesture. This can be used instead of directly using keyboard or mouse
Instantiate a new Actions object.
Actions a= new Actions(driver)
Instatiate an Action using above Actions object
Action a1= a.moveToElement(driver.findElement(By.name("elementName"))).build()
Perform the Action
a1.perform();
Actions are very useful for some of the complex user gesture which can't be perform using simple locaters e.g. following code will do a right click on an element
Instantiate a new Actions object.
Actions a= new Actions(driver)
Instatiate an Action using above Actions object
Action a1= a.moveToElement(driver.findElement(By.name("elementName"))).contextClick().build()
Perform the Action
a1.perform();
More details can be found here under "Building a Series of Multiple Actions"
org.testng.annotations.DataProvider;
org.testng.annotations.Test;
org.testng.annotations.BeforeTest;
org.testng.annotations.AfterTest;
All the above packages are used when we use Annotations in TestNG framework. Annotations in TestNG framework are a way to control the code execution below them. Annotations are preceded with an @
Summary of various TestNG Annotations (For more details on TestNG and Annotations usage example, click here)
@BeforeSuite: The annotated method will be run before all tests in this suite have run.
@AfterSuite: The annotated method will be run after all tests in this suite have run.
@BeforeTest: The annotated method will be run before any test method belonging to the classes inside the tag is run.
@AfterTest: The annotated method will be run after all the test methods belonging to the classes inside the tag have run.
@BeforeGroups: The list of groups that this configuration method will run before. This method is guaranteed to run shortly before the first test method that belongs to any of these groups is invoked.
@AfterGroups: The list of groups that this configuration method will run after. This method is guaranteed to run shortly after the last test method that belongs to any of these groups is invoked.
@BeforeClass: The annotated method will be run before the first test method in the current class is invoked.
@AfterClass: The annotated method will be run after all the test methods in the current class have been run.
@BeforeMethod: The annotated method will be run before each test method.
@AfterMethod: The annotated method will be run after each test method.
@Test: The annotated method is a part of a test case
Note- Here is the hierarchy for the Annotations in TestNG framework and they will be called in that order-
BeforeSuite
BeforeTest
BeforeClass
BeforeMethod
Test
AfterMethod
AfterClass
AfterTest
AfterSuite
A very good example using all these Annotations can be referred here
Note- Here is the hierarchy for the Annotations in TestNG framework and they will be called in that order-
BeforeSuite
BeforeTest
BeforeClass
BeforeMethod
Test
AfterMethod
AfterClass
AfterTest
AfterSuite
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…
ReplyDeleteselenium training in chennai|
Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
ReplyDeleteJava Training In Bangalore
Thank you so much for sharing such a valuable information
ReplyDeletesap simple finance online training institute in hyderabad
Its pleasure to across your post.Good representation of the connectivity of selenium with java with neat descriptions.
ReplyDeletemotorola mobile service centre in chennai
moto g service center in chennai
motorola service center in velachery
Thanks for your unique post and Keep doing...
ReplyDeleteOracle Training in Chennai
best oracle training institute in chennai
Job Openings in Chennai
Power BI Training in Chennai
Tableau Training in Chennai
Oracle DBA Training in Chennai
Advanced Excel Training in Chennai
Linux Training in Chennai
Pega Training in Chennai
Spark Training in Chennai
I got more excellent information from this blog. keep updating this blog...
ReplyDeletePython Training in Bangalore
Python Course in Bangalore
AWS Training in Bangalore
Data Science Courses in Bangalore
Best Python Training in Bangalore
Python Classes in Bangalore
rpa training in bangalore
DevOps Training in Bangalore
PHP Training in bangalore
spoken english classes in bangalore
Incredible data. Fortunate me I went over your site by some coincidence (stumbleupon). I've book-checked it for some other time!news updates
ReplyDelete