SELENIUM
is an open-source automation testing framework.
it
used to automate web applications different browsers and platforms. Selenium
comes with programming languages like Java, C#, Python etc.
It
can be integrated with tools like TestNG & JUnit ext. to managing tests and
generating reports.
It's
mainly used for testing purposes but also very useful for web scraping.
but
selenium is a bit slower than scrappy because Scrappy only visits the URL but
Selenium renders all js files CSS files and image files
Integrated Development Environment (IDE)
automate
through a record-and-playback.
It
records user actions in the browser, using the existing Selenium commands, with
parameters defined by the context of the web element.
Selenium Grid
Selenium-Grid
allows you to drive tests on different machines against different browsers in
parallel. Essentially, Selenium-Grid support distributed test execution.
one
server act as a hub. Tests communicate to the hub to get access to browser
instances. The hub has servers list that provides access to browser
instances and lets tests use these instances.
Selenium WebDriver
It
injected JavaScript functions into the browser within the browser. Selenium
WebDriver fits in the same role as Selenium-RC made and has incorporated the
bindings and included the WebDriver API. It relates to both the language
bindings and the implementations of the individual browser controlling
principles. This is commonly referred to as WebDriver enables and control of user
agents.
Web
Driver facilitates a platform and protocol-based way to remotely instruct the behavior
of web browsers.
examples: chrome
driver, Firefox driver, safari driver ext.;
first
of all,
Browser Elements Present on a Web Page
there
are mainly two kinds of locators
CSS Selectors
is
a style sheet language used for expressing the look and formatting of a web
page.
CSS
patterns used to select the styled elements.
XPath
the
XML language is a query language for selecting nodes from an XML document.
locating
elements with XPath works well in selecting web elements.
XPath
uses path expressions to navigate through elements and attributes in a web
page.
There
are eight attributes that can be used to locate elements
they
are based on ID, Class, Name, Tag Name, Link Text, Partial Link Text, CSS ext;
let’s see how Eclipse projects
For
making Eclipse Java projects, you need a library that gives the ability to
produce an HTML report of execution and display the test case result.
What is TestNG?
the testing framework concentrated
on contributing both unit and functional testing capabilities in Java. It
supports parallel testing, data providers, dependencies, groups and other
features. like
Support
for data-driven testing
execute
your tests in the thread or various policies available
Annotation
support
Why Use TestNG
Generate
the report in a proper format
test
cases can be grouped more easily
executed
multiple times without loops
annotations
@BeforeSuite: the method will run before the tests suite.
@AfterSuite: the method will be run after all tests in this suite.
@BeforeTest: the method will be run before any test method belonging to the classes inside the
tag.
@AfterTest: the method will be run after all the test methods belonging to the classes inside
the tag.
@AfterGroups:
This method run after the last groups is executed.
@BeforeClass:
The annotated method will be executed before the first test method in the the current class is invoked.
@AfterClass:
The annotated method will be run after the current class.
@BeforeMethod:
The annotated method will be started before each test method.
@AfterMethod:
The annotated method will be driven after each test method.
@Test:
The annotated method is a part of a test case
I
think this post is too long Next I’ll create a java project to
automate Facebook.
Come
back here and tell us about the before-and-after. I bet you’ll have something
to say!
1 comment:
Post a Comment