0% found this document useful (0 votes)
92 views

Selenium

selenium

Uploaded by

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

Selenium

selenium

Uploaded by

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

COURSE

Selenium Webdriver:

1. Xpath and cssselector


2. Basic: sendkeys,click,submit,gettext,gettitle
3. Navigation commands
4. DropDown -Select class
5. Conditions - isDisplayed(), isSelected(), isEnabled()
6. Action class - Drag and drop, Mouse hover,click and hold
7. Alert & Popup handling
8. Handling Multiple Windows
9. Waits – sleep, Implicit, Explicit, Fluent Waits
10. Take Screenshot
11. Excel Read/write
12. Scrolling in web page - JavaScriptExecutor interface, Robot,Action class
13. Upload - Autoit,Robot
14. Download files - Robot class, wget
15. Handling Iframes
16. Extent Reports
17. Creating Object Repositories – 1. using Properties file 2. using XML file
18. Database connection

+++++++++++++++++++++++++++++++++++++++++

TestNG

http://testng.org/doc/documentation-main.html

Annotations, Run Tests multiple times @Test, skip @Test

Priorities , Groups,

Dependencies

Assertions - hard,& soft assert

Dataproviider,

HTML reports

Execute multiple test suites, page factory

++++++++++++++++++++++++++++++++++++++++++++

Maven

Jenkins

Git

++++++++++++++++++++++++++++++++++++++++++++

POM
Page factory

Data Driven Framework

Keyword driven framework

Hybrid framework

Notes
Pros of automated testing:

Improves accuracy

Saves Time and Cost

Easily increase productivity because it provides fast & accurate testing result

Ensure Consistency

Cons of Automated Testing:

Without human element, it's difficult to get insight into visual aspects of your UI like colors,
font, sizes, contrast or button sizes.

Limitations of Selenium:

Selenium only supports web based application and does not support windows based
application.

Selenium users lacks official support for the problems they face since it is an open source.

Limitations of WebDriver:

1.WebDriver Cannot Readily Support New Browsers

WebDriver operates on the OS level. Also, remember that different browsers communicate
with the OS in different ways. If a new browser comes out, it may have a different process of
communicating with the OS as compared to other browsers.

2.WebDriver has no built-in command that automatically generates a Test Results File.

You would have to rely on your IDE's output window, or design the report yourself using the
capabilities of your programming language and store it as text, HTML, etc.

Framework:
Simply: think about a framework as a set of tools put together to help you to accomplish
your job better and faster.

What is WebDriver?

WebDriver is a web automation framework that allows you to execute your tests against
different browsers
WebDriver also enables you to use a programming language in creating your test scripts.
Following programming languages are supported by WebDriver

Java, .Net, PHP, Python, Perl, Ruby

Which Test Cases to Automate?


Test cases that are repeatedly executed
Test Cases that are very tedious or difficult to perform manually
Test Cases which are time-consuming.

Test cases are not suitable for automation?

Test Cases that are newly designed and not executed manually at least once.

Test Cases for which the requirements are frequently changing

Test cases which are executed on an ad-hoc basis.

 In Selenium WebDriver, there are 8 different types of locators:

 ID
 ClassName
 Name
 TagName
 LinkText
 PartialLinkText
 XPath
 CSS Selector
 TestNG Annotations:
@BeforeSuite

@BeforeTest

@BeforeClass

@BeforeMethod

@Test

@BeforeMethod

@BeforeClass

@BeforeTest
@DataProvider

@Factory

@Listeners

@Parameters

 Advantages of TestNG:

 Added advance and easy annotations


 Execution patterns can set
 Concurrent execution of test scripts
 Test case dependencies can be set

 challenges and limitations of Selenium WebDriver:

 supports only web based applications


 We cannot test mobile apps
 Limited reporting
 Handling dynamic Elements
 Handling page load
 Handling pop up windows
 It’s not possible to automate captcha and bar code reader.

 Selenium Grid can be used to execute same or different test scripts on multiple
platforms and browsers concurrently so as to achieve distributed test execution.
 The fastest implementation of WebDriver is the HTMLUnitDriver. It is because the
HTMLUnitDriver does not execute tests in the browser.
 Assert: In simple words, if the assert condition is true then the program control will
execute the next test step but if the condition is false, the execution will stop and
further test step will not be executed.
 Verify: In simple words, there won’t be any halt in the test execution even though
the verify condition is true or false.
 FirefoxDriver is a Java class, and it implements the WebDriver interface.
 Object Repository is used to store element locator values in a centralized location
instead of hard coding them within the scripts. We do create a property file
(.properties) to store all the element locators and these property files act as an
object repository in Selenium WebDriver.
 Selenium Webdriver does not require scroll to perform actions as it manipulates
DOM. But in certain web pages, elements only become visible once the user have
scrolled to them. In such cases scrolling may be necessary.

 handle frame in WebDriver


An inline frame acronym as iframe is used to insert another document within the
current HTML document or simply a web page into a web page by enabling nesting.

Select iframe by id
driver.switchTo().frame(“ID of the frame“);
Locating iframe using tagName
driver.switchTo().frame(driver.findElements(By.tagName(“iframe”).get(0));
Locating iframe using index
frame(index)
driver.switchTo().frame(0);
frame(Name of Frame)
driver.switchTo().frame(“name of the frame”);
frame(WebElement element)
Select Parent Window
driver.switchTo().defaultContent();

 findElement() and findElements()?


findElement(): findElement() is used to find the first element in the current web
page matching to the specified locator value. Take a note that only first matching
element would be fetched.
Syntax:
WebElement element =
driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));
findElements(): findElements() is used to find all the elements in the current web
page matching to the specified locator value. Take a note that all the matching
elements would be fetched and stored in the list of WebElements.
Syntax:
List <WebElement> elementList =
driver.findElements(By.xpath(“//div[@id=’example’]//ul//li”));

 DROPDOWN

Types of Select Methods:


i. selectByVisibleText Method
ii. selectByIndex Method
iii. selectByValue Method
Types of DeSelect Methods:
i. deselectByVisibleText Method
ii. deselectByIndex Method
iii. deselectByValue Method
iv. deselectAll Method

Maven:
In general, the Group Id should correspond to your organization name, and the Artifact
Id should correspond to the project’s name. The version is up to your discretion as is the
packing and other fields. If this is a stand-alone project that does not have parent dependencies,
you may leave the Parent Project section as is. Fill out the appropriate information, and
click Finish.

You might also like