Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
13 views

Automation Engineer Hands on Assignment - Selenium

Uploaded by

vamsiperisetti5
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Automation Engineer Hands on Assignment - Selenium

Uploaded by

vamsiperisetti5
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 40

Hands on assignment (Automation

Engineer)

Selenium

Author: Multiskilling Team

Date: 16 March 2016

Version: 1.1

Document ID: Automation Engineer Hands on


assignment – Selenium.docx

Status: Final

Document Internal
Classification:

Page 1 of 40
Contents
Overall Process overview...........................................................................................................................3
Step 1 - Get access to VPN..........................................................................................................................4
Step 2a - Connecting to VPN.......................................................................................................................4
Step 2b - Accessing RDP training page.......................................................................................................5
Step 3 – Proceed for script development...................................................................................................7
Step 4 - Launch Eclipse from RDP page......................................................................................................7
Step 5 - Create a Workspace.....................................................................................................................11
Step 6 - Create a new Project...................................................................................................................12
Step 7 - Create a new Class.......................................................................................................................15
Step 8 - Download Selenium WebDriver jar.............................................................................................17
Step 9 - Add Jars to Java build path..........................................................................................................19
Step 10 - Develop a sample script............................................................................................................22
Step 11 - Execute a sample script.............................................................................................................30
Step 12 - Develop scripts as per case study sheet....................................................................................35
Step 13 - Execute your test.......................................................................................................................35
Step 14 - Save your results........................................................................................................................35
Evaluation process....................................................................................................................................38
Technical Issue Management...................................................................................................................39
Troubleshooting........................................................................................................................................41

Page 2 of 40
Overall Process overview
The overall process to complete the hands on assignment is given below.

Step # Step Name


Step 1 Get access to VPN
Step 2a &b Connect to VPN & Access RDP training web page
Step 3 Proceed for script development
Step 4 Launch Eclipse from RDP page
Step 5 Create a Workspace
Step 6 Create a new Project
Step 7 Create a new Class
Step 8 Download Selenium WebDriver jar
Step 9 Add Jars to Java build path
Step 10 Develop a sample script
Step 11 Execute a sample script
Step 12 Develop scripts as per case study sheet
Step 13 Execute your test
Step 14 Save your results

Page 3 of 40
Step 1 - Get access to VPN
It is important to have access to the training environment. The environment allows a user to access
various tools required to complete the assignment.

Please follow process mentioned in attached document to get VPN access

Please put your SM/DUL as approver for VPN access request.

How to Request Access to Accenture VPN

*Note: You must be connected to VPN in order to access automation tools and ALM.

Step 2a - Connecting to VPN


Please click on appropriate link from below:

1. VPN connection from Project Desktop or Laptop


2. VPN Connection from training room
3. VPN connectivity from Personal Machines

Page 4 of 40
Step 2b - Accessing RDP training page
1. Make sure that you have added VPN and training URL in trusted sites
2. Launch Internet Explorer and connect to: https://hpapptraining.accenture.com – this will take you
to the login page

3. Enter your Accenture Enterprise ID in the “Domain\user name” field and your password in the
“Password” field and click on Sign In
a. Be sure that if you are using a public or shared computer that you select the option for “This
is a public or shared computer”.

Page 5 of 40
4. Once you log in, you will see the RemoteApp and Desktops page which will have training
applications, links and folders published.

5. Click on the application/link that you wish to launch.

Page 6 of 40
Step 3 – Proceed for script development
If you are developing the script using Eclipse, go to step 4

If you are developing the script using Selenium IDE, go to step 4

Step 4 - Launch Eclipse from RDP page


1. Click on the Eclipse icon

2. You will receive a popup that verifies that you wish connect to the application/link. Ignore the
statement about the publisher not being identified
a. Click “Connect”

Page 7 of 40
3. You will be prompted for your Accenture Enterprise ID and Password – enter it and click “OK”

Page 8 of 40
4. The Eclipse is starting…..

Page 9 of 40
Click Yes

Click on Run

5. Eclipse has launched

Page 10 of 40
Step 5 - Create a Workspace
Please follow below steps:

1. Create a ‘working directory’ for all of your projects.

*Note: Please make it sure to take backup of your work in MyDocument folder. Please check advise from
server tech support team regarding same:

Only data copied to your personal profile will “roam” with the user. Data stored in any other location
will only be accessible from the terminal server which you were on and it cannot ever guarantee what
system to which you will connect next time.

Page 11 of 40
2. You may see the window like this, this is the Welcome window for Eclipse.

Step 6 - Create a new Project


In Eclipse, projects are the next-smallest functional unit after workspaces. You might have
only one workspace, you will usually have several projects inside one workspace.

1. Create new Java Project from File > New > Java Project.

2. Give your Project name ‘SeleniumProject‘ as shown in below given figures. Click on Finish
button.

Page 12 of 40
3. You may or may not see this message but if in case you get any, check Remember my
decision and click on Yes.

Page 13 of 40
Now your new created project ‘SeleniumProject‘ will display in eclipse project explorer.

Step 7 - Create a new Package


1. Select ‘SeleniumProject‘ and select File > New > Package.

2. Give your Package name ‘selenium‘ and click on Finish button.

Page 14 of 40
Now you can see a new package with name ‘selenium‘ under project name ‘SeleniumProject‘.

Step 7 - Create a new Class


Now that you have a project set up, you’re going to want start writing some new classes.

1. Right click on Package ‘selenium‘ and select New > Class.

2. Give your Class name ‘FirstTestCase‘, check the option ‘public static void main‘ and click on Finish
button. This will bring up totally a sweet class creation window.

Page 15 of 40
Note: In case of not creating class for Main test case, please do not click ‘public static void main’. We
need to select it only in case of writing test cases which we are going to execute and from where we
call other classes. For functional classes, POM classes or any other classes we don’t need this to be
checked.
3. Now your Eclipse window will looks like below.

Page 16 of 40
For Firefox version 47,

download wires.exe from https://github.com/mozilla/geckodriver/releases/download/v0.6.2/wires-


0.6.2-win.zip and copy in SeleniumProject.

Step 8 - Download Selenium WebDriver


jar
selenium-server-standalone-2.52.0.jar is already downloaded and configured for SeleniumProject
created above. If Selenium WebDriver jars needs to be configured for any other project, please use the
below steps.

For Firefox version <47, download selenium-server-standalone-2.52.0.jar as per step 1 below.

For Firefox version 47,

 download selenium-server-standalone-2.53.0.jar from http://docs.seleniumhq.org/download/.


 download sac-1.3.jar from http://central.maven.org/maven2/org/w3c/css/sac/1.3/sac-
1.3.jar

Page 17 of 40
1. Download selenium-server-standalone-2.52.0.jar from http://selenium-
release.storage.googleapis.com/index.html?path=2.52/ or http://docs.seleniumhq.org/download/
click on Previous Releases in left menu and select 2.52.

2. Save file to your disk.

3. Create jars folder in C:\SeleniumWorkspace\SeleniumProject folder


4. Copy selenium-server-standalone-2.52.0.jar file for Firefox version <47.

Page 18 of 40
For Firefox version 47, copy selenium-server-standalone-2.53.0.jar and sac-1.3.jar in jars folder

Step 9 - Add Jars to Java build path


Now we need to add Selenium WebDriver’s Jar files in to Java build path. These configurations are
already done for SeleniumProject created above. Please follow the below steps for any new
projects.
1. Right click on Project ‘SeleniumProject‘ > Select Properties > Java build path. Then navigate to
Libraries tab and click Add JARs.

2. For Firefox version <47, add selenium-server-standalone-2.52.0 jar.

Page 19 of 40
3. Click OK.

Similarly add jars in other folders by clicking Add External JARs.

4. For Firefox version 47, add selenium-server-standalone-2.53.0 jar, sac-1.3.jar

Page 20 of 40
5. Now you are ready to write your test script in eclipse and run it in WebDriver.

Page 21 of 40
Step 10 - Develop a sample script
Sample script is to do a google search to get more details on Selenium.

1. Install Selenium IDE from https://addons.mozilla.org/en-US/firefox/addon/selenium-ide/

Click Add to Firefox.

If Selenium IDE icon is not displayed on the menu bar, open Firefox -> Tools menu, select Selenium
IDE and click on Customize

Now drag Selenium IDE from Additional Tools and Features window and drop it before Firebug icon
(last icon in below screenshot) in menu bar.

Page 22 of 40
Click on Exit Customize button at bottom of window

Page 23 of 40
Now Selenium IDE will be displayed in menu bar.

2. Using Selenium IDE


Open Firefox browser and type https://www.google.com in the address bar. Open Selenium IDE

recorder clicking on the .

Set the Base URL as https://www.google.com/ and click on Red circle to record. Select the empty area
under Command, Target, Value grid and start recording.

Page 24 of 40
Enter Selenium in search box and you will see commands getting recorded in IDE.

3. Using Java program


Capture the XPaths of different elements on which we have to perform automation.
Launch Firefox browser clicking on C:\Program Files (x86)\Mozilla Firefox\firefox.exe and add Fire
Bug and FirePath Add-ons. These configurations are already done for SeleniumProject.

Page 25 of 40
 Search for Fire Bug in Add-ons Manager window and install it

 Similarly install FirePath searching FirePath in Add-ons Manager


Capture XPaths using FirePath
Open https://www.google.com/ in Firefox browser.

Page 26 of 40
Hover on the search box and right click. You will get an option to Inspect in FirePath. Capture the
xpath of search box and use for automation.

Now Inspect GoogleSearch button in FirePath.


XPath is listed in the text box next to Highlight in bottom section of screen.

Page 27 of 40
4. Using Java program
Capture the xpaths of required elements of web page and create a Java program to automate the
required scenario.
Go to Eclipse workspace and open the FirstTestCase class that we created in step 7.
For Firefox version <47,
Add following code in FirstTestCase between public class FirstTestCase {
}
Save file

private static WebDriver driver;


private static String baseUrl;
/**
* @param args
*/
public static void main(String[] args) {
try {
//launch Firefox browser
driver = new FirefoxDriver();
System.out.println("Opened Firefox browser");
baseUrl = "https://www.google.com/";
driver.manage().timeouts().implicitlyWait(30,
TimeUnit.SECONDS);
//direct it to the Base URL

Page 28 of 40
driver.get(baseUrl + "/?");
//open google.com
driver.findElement(By.id("lst-ib")).clear();
//search Selenium
driver.findElement(By.id("lst-ib")).sendKeys("Selenium");
System.out.println("Entered Selenium");
driver.findElement(By.name("btnG")).click();
System.out.println("Searched Selenium");
}
catch (Exception exception) {
exception.printStackTrace();
}
finally {
//close browser
driver.close();
System.out.println("Closed Firefox browser");
}
}
Class should look like

For Firefox 47

driver = new FirefoxDriver();


should be replaced with

Page 29 of 40
String currentDir = System.getProperty("user.dir");

String marionetteDriverLocation = currentDir + "/wires.exe";

System.setProperty("webdriver.gecko.driver", marionetteDriverLocation);

driver = new MarionetteDriver();

Step 11 - Execute a sample script


1. Using Selenium IDE
o Play the current test case selecting Actions -> Play current test case.

Page 30 of 40
o Export the test case as JUnit Test Case selecting File -> Export Test Case As -> Java /
JUnit4 / WebDriver. Save the file in C:\SeleniumWorkspace\SeleniumProject\src\
selenium.

Page 31 of 40
Refresh eclipse project and you should see GoogleSearch program

As we copied file from IDE, the package name is different and is displayed as an error in the 1 st line
of GoogleSearch program. Change package name as Selenium as Save.

Page 32 of 40
Execute the test clicking on Run button. Firefox browser gets opened and performs the google
Selenium search automatically.

Page 33 of 40
2. Using Java
o Execute the test clicking on Run button. Firefox browser gets opened and performs the
google Selenium search automatically.

Page 34 of 40
Step 12 - Develop scripts as per case
study sheet
1. Go through the case study attached below:

2. Read both the case studies along with general information, throughly.
3. Once ready, start the script development using Selenium IDE or Eclipse.
4. Create a folder with name Firstname_EmpID under C:\MultiSkilling_Selenium.
5. Save case study related test scripts in CaseStudyX_TestScripts folder.
Note: Replace X in CaseStudyX with Case Study number.

Step 13 - Execute your test


Execute the scripts as per the instructions in step 10.
Save case study results in CaseStudyX_Results folder.
Note: Replace X in CaseStudyX with Case Study number.
If tests needs to be executed from

1. Selenium IDE – Follow 1st step of Step 11


2. Junit – Follow 2nd step of Step 11
3. Java - Follow 3rd step of Step 11

Step 14 - Save your results


After completion of the execution, save your results.

1. Using Selenium IDE

Go to Log tab at the bottom of Selenium IDE, select all highlighted text under Log tab and copy
the execution result to to CaseStudyX_Result_TimeStamp.txt

Page 35 of 40
2. Using Java
Save the execution result to to CaseStudyX_Result_TimeStamp.txt

Aftere completion of execution, upload results file and other artifacts to Issue Resolution tool
https://ts.accenture.com/sites/JavaCapability/Javaupskill/_layouts/15/start.aspx#/SitePages/
Home.aspx.

Follow below steps to upload the results to Issue resolution tool:

1. Navigate to Issue resolution tool and click on “Raise New Issue”

Page 36 of 40
2. Populate below values:

Issue Category: Hands-on assignment


Issue Sub-category: Testing Assignment completion
Issue Description: Selenium_CS1_AE - Assignment Complete OR Selenium_CS2_AE -
Assignment
Complete (as applicable)

Page 37 of 40
Evaluation process
After successfully completing both the case studies, this will be considered for evaluation.

Evaluation will be based on Quality of coding, Implementation of steps as mentioned in case study
document and execution results

o Code Quality
o Coding Standards
o Implementation of
verification points
o Overall execution result o Data driven
o Effectiveness of custom o Error handling
messages
o Screen shots Test Scripts
o Verification result steps

Execution
Results

Final
Outcome

Page 38 of 40
Technical Issue Management
Please follow below process in case you face any technical issue related to the assignment.

All the issues will be addressed through the online portal.

The process to log an issue is mentioned below:

1. Go to portal using below mentioned URL:

https://go.accenture.com/multiskilling
2. Click on “Raise new request” button

3. Fill Issue category as “” Hands on assignment” and all other mandatory fields and submit it

4. Follow up status of issue on the tool

Page 39 of 40
5. Check FAQs document available on the portal for further details

Troubleshooting
Please use below documents that provide details of the issues you may face while working on the
assignment. The document covers the issues/information related to:

1. VPN
2. Tool
3. Other generic details

Click on this link to access FAQ

Page 40 of 40

You might also like