Why Excel:-
Test data:-
User name (JanJo selenium)
Password(Selenium)
* Write a program to login into mail .in.com by banking object repository from an excel file
Object repository:-
repository mean a storage folder .object repository mean a storage folder which contains the element location like id, css, x path, name e.t.c.
Create a folder with the name of workspace.
Take an Excel file and give the object repository in below format.
User name (f_ id) pass word (f_ pwd) sign (input _ sign in)
Save the Excel file in .Xis format [97 -2003] in or Folder
At TekSlate, we offer resources that help you in learning various IT courses.
We avail both written material and demo video tutorials. To gain in-depth knowledge and be on par with practical experience,then explore Selenium Training.
Assignment:
* Write a program to test the log in functionality of mail income by the rest data and object repository from 2
Different Excel Files:
Public class log in _ OR
{
Public web driver;
Public FileinputStream fi;
Public Workbook w;
Public Sheet S;
@ ist
Public void verify login ( ) thrown Exception
{
fi = new File inputStream (“E:...ORlogin.XIS”);
w = Workbook. Getworkbook(fi);
s= w.getsheet(“login”);
driver . Find Element (By.id(s.getclass(0,1). Get content())) . send keys(Jan 30 selenium)
driver.Find Element …(1,1) ….(“selenium”)
driver. Find element (By.cssSelection(s.getcell(2,1).get content()) .click();
}
@ Test public void verify logout()from exe
{
* Write a program to test the login functionality with multiple sets of login
Assignment:
* Write a program to test the login functionality of the gmail.com with multiple sets of login credentials
* Test the login the functionality of mail.in.com with multiple sets of login credentials and provide the results in the below formula
Username | password | Result |
Jan 30 selenium | selenium | Pass |
Nagesh1 | selenium | Fail |
April selenium | selenium | Pass |
Nagesh 2 | selenium | fail |
To accomplish the above scenario we need to follow below 3 steps
Create a folder with the name ”Result” under the project folder of “workspace 10” and capture all the results into this folder
Step1:
Public void step1() throws Exception
{
FileoutputStream fo = new FileOutputStream (“E:work Space _10Am selenium resultlogin.XIS”);
Writable Work book wb = Workbook.createworkbook(fo);
Writetable Sheet ws = wb.create sheet (“Results” ,0);
Label un = new Label (0,0 “username”);
Label pw= new Label (1,0 “password”);
Label rs= new Label (2,0 “Result”);
}
Nested for loop syntax:
For (int i= 0; I<3; i++)
{
For (int j= 0; j<2; j++)
{
Sysem .out.println(j,i);
}
}
Result:
j i
0 0
1 0
0 1
1 1
0 2
1 2
Step 2: program
Public class add input data to result File
{
@Test
Public void step 2() throws an exception
{
//1. Print the i/p data on the console
FileinputStream fi = new FileinputStream(“E:workspace_10AMsaleniumTestdata….”)
Workbook w = workbook. Get workbook(fi);
Sheet S = w.get Sheet(0);
Fileoutput Stream fo = new file output Stream(“E:work space _10AMselenium result”)
Create table workbook wb = workbook.create workbook(fo);
Writeable sheet us = wb. Create sheet(“Result”,0);
For(int i=0; i< l.getrow(); i++)
{
For(int j=0; i< l.getcolumn(); j++)
{
s.o.p (s.getcell(j,i).getcontent());
Label un = new Label (j,i, s. getcell(j.i).get content());
Ws.add cell(un);
}
}
Cabel rs = new label (2,0,”result”);
Ws. Add cell(rs);
Ws. Write();
Wb.close();
}
Check out the top Selenium Interview Questions now!
Synchronization:-
It is two types
1) implicit time:-it is the standard time
2) explicit time:-it means wait until the elements are available
Public void wait(String str)
{
For(int i=0; i<20; i++)
{
If(selenium .in element process(str))
{
Break
}
Else
s.o.p(i);
{
Thread.sleep(1000);
}
}
}
How we can use in the program:
Public static void method()
{
Login();
Wait(“Link= signout”);
Logout();
iIf we are while loop then sign out in not there then it keeps out executing infinite times
X HOS Admin Admit
Y HOS Admin Advice Admit
Interested to become master in Selenium? Enroll now for FREE demo on Selenium Training in New York City.
Data driver frame work:-
Develop the driver script [data driver frame work] from the scenario login & registration of mail.in.com
to develop the driver script take the test data and object repository in an Excel file with below format
Public void reusable script() throws an exception
{
Fileinput Stream fi = new fileinput Stream(“E:workspace_10AM selenium”)
Workspace w = workbook.getworkbook(fi);
Sheet s w.get sheet(“sheet1”);
For(int i= 1; i< s.get row(); i++)
{
If(s.getcell(2,i).get contents().Excelignore case(“textbox”))
{
If(selenium .inelement present(s.getcell(0,i).get content()))
{
Selenium .type(s.getcell(0,i).get content(), s.getcontent())
Assignment:-
develop the test data and object repository in an excel file for spicejet.com and run the script by using driver script
àonce the exception is completed provide the results in an Excel file[resilt file]
Step1:- create an Excel file by using the file output stream
Step 2:-Add input data to the result file by using ‘j loop’[ nested for loop’]
Step3:-Add a result column and provide the result as pass or fail based or the execution.
Explain your Framework?
Hybrid framework
it is a combination if test NG a data-driven framework
we can use both the advantages of data-driven and Test NG[Key word Driver]
we are using an XML file to executes both the test script[class]
For an In-depth knowledge on Selenium, click on below
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.