selenium, a powerful and open source testing platform that is being used
extensively by most of the largest corporations in this world . so this is
what we are going to talk about in today's session so what's there in the
agenda for today's video? so first of all we are going to look at what is selenium
then its purposes ,different components of it , and of course then we'll be seeing
one in our hands-on and finally career opportunities you can have in
this particular field. now let's suppose what if your Facebook account gets
hacked or let's say if you found out that your online transaction went to the
wrong person . so in such a scenario the right software testing automation
actually would ensure that these issues don't affect your life and that is why
we have got selenium in place which is a tool that is used for software testing
automation. so what is it exactly? so selenium is a free open-source
automated testing platform for web applications across different browsers
and platforms and it basically focuses only on automating web-based
applications. now this is just not a tool or rather this is just not a single tool
but a platform of software each catering to different testing needs of an organization.
so it basically has got four components
the first one is selenium integrated development environment or let's say IDE
then selenium remote control or RC, webdriver,
and finally selenium grid and now selenium RC and webdriver are merged
into a single framework to form selenium 2. and as I told you guys that since
selenium is a collection of different tools and hence it is developed by
different persons as well. So initially selenium was created by Jason Huggins in
2004. So he actually was working on a web application that required frequent
testing but then he eventually realized that these rapid and manual testing was
becoming more and more inefficient in their applications and that this
dissatisfaction led to the creation of a JavaScript program that would
automatically control the browser's actions and he named this program as the
JavaScript test Runner which ultimately later on became an open source and again
got renamed as selenium core and this is how selenium came to existence
now one obvious question you might be getting when we already have various
software testing tools just like QTP then why do we need selenium ? so you know
let me list out some of the key differences between QTP and selenium to
give a clear picture to you guys. so QTP is a commercial tool and hence it
requires a license which is expensive. whereas , selenium is a free open-source
tool and does not require any kind of licensing now again QTP is restricted to
specific web browsers such as Firefox and Internet Explorer whereas selenium
has capabilities to execute the script across different browsers now QTP works
only with Windows but then selenium can be used on various operating systems. so
QTP also requires third-party tools to support mobile devices but then selenium
directly supports all types of mobile devices .Now QTP supports only VB scripts
whereas selenium supports mature object-oriented languages just like Java
So by looking at all these points we can simply conclude that selenium works
more efficiently than other tools in the market so as we have already discussed
that selenium has got four components, so now let's look at each of them
individually . so the selenium IDE is an easy-to-use firebox plugin which is used
to develop selenium test cases so it actually provides a graphical user
interface for recording user actions using firebox but then it can only be
used with Firefox browser as other browsers are not supported with it.
however the recorded scripts can be converted into various programming
languages and then it can be executed on other browsers as well. Now second on the
list we have got a selenium RC , So using selenium core test has actually had to
install the whole application and also the web server on their local computers
because of some kind of restrictions and to solve this, selenium remote control
was developed. So in this particularly the software was created in such a way that
browser is tricked to believe that both selenium core and the web application
being tested come from the same domain. and hence selenium RC comes in two parts
selenium server which interprets and executes the selenium commands and then
client library ,that provides an interface between programming languages
and selenium RC server . And after this we have got selenium webdriver. So webdriver
was created in around 2006, when browsers and the web applications were becoming
more powerful and more restrictive with JavaScript . So it was the first
cross-platform testing platform that could control the browser from the OS
level . And also webdriver interacts directly with the browser without any
intermediary now webdriver can be used in different contexts Multi browsing
testing, handling multiple frames pop-ups and alerts complex page navigation
advanced user navigation such as drag and drops and finally ajax-based UI
elements and the last tool we have got is selenium Grid . So this would
actually distribute the test across multiple physical or virtual machines so
that testers can execute scripts in parallel That is , it allows the
tester to execute multiple instances of webdriver or selenium remote control
tests in parallel so this includes the hub and the node so hub would actually
act as a server or the central point where the tests would be triggered and
nodes are the selenium instances that are attached to the hub which executes
the tests. now that we know what selenium is and its components are let us move on
to hands-on exercise to understand how webdriver uses cross browser functions
okay so here we are going to understand the cross browser testing using of
webdriver so let's discuss how to instantiate
either Chrome or Internet Explorer using web browser . now lemme guys tell you one
thing that your firefox is the native browser supported by selenium and hence
we do not need to use any kind of EXE files specifically for Firefox but then
if we talk about Chrome or other browsers then they are not supported
directly by selenium and so for using these browsers we need to download a
separate EXE files for this okay so that is to say that other than fire box we
need separate drivers right? or driver objects for each and every browser okay
so for that you can simply download the latest driver for internet explorer from
this place,. so let me just click on that and here you can go to Internet Explorer
and see here so from here you can simply download it but again it also depends
upon your system configuration. So this is for Internet Explorer but then let's
say if you want to download it for Chrome then again you need to download
the latest version , let me just scroll down, from here
okay so both the files are zip files here and inside that you will be getting
or you will be finding the EXE files okay but then let me tell you that you
need to save the paths for these EXE files because then these paths are going
to be used in to your applications . okay so let's go back to our downloaded
folders you know so check whether we have got our EXE files
or not. So let me go back to in my folder so Intellipaat and then workspace
so see here both the EXE files are available so if you are going to open
all these you will be getting the EXE files so let me open that and see we
have got it fraud we have got it for Chrome right and again
so this is for Chrome and this is for Internet Explorer so you have got both
the exe files over here now let me create a new class to understand the
browser initialization and for that let me just create a new class over here go
to new class and let me just give it a name
okay and click on public static void main because we are going to need that
method particularly so my first method would be here to verify ie browser so
let me type in that okay now how do you initialize your IE
browser so for that there are a few steps that you need to remember before
calling the I browser okay so the first thing is that we need to set up our
system property
okay so to set up the system property you can say system dot set property
which will accept two different parameters as key and values right so
let me just do that for you guys
okay so here the key values are nothing but the webdriver dot I e dot browser
okay and then the value will be the exact path where we are storing the exe
files remember I told you guys to remember that particular path so let me
copy that path
okay so we are going to copy the exact path from here for our Internet Explorer
driver
so copy it and paste it over here and then you also have to mention the file
name including the exp extension so I'm just going to copy that one is well and
paste it over here okay now it is actually giving some compilation error
so this is due to the escape character of folder separator right so you have to
provide the backslash as an escape character over here so that's what I am
going to do all across
so let's do it okay so once your property is set we have to use desired
capabilities class rank
so now we are going to use our desired capability class so the class called
desired capability in our selenium API which would help you to set up the
properties for your browser object okay so now first let's say the class in our
API okay so we are just going to find the desired capabilities class to
understand it better okay so here we have got this now let me just go to the
desired capabilities class
let me just go through it shower dock and here we'll be getting our desired
capability class so C and then D okay so this is the one you can see desired
capabilities now see here if I talk about this particular class so it has
actually got multiple methods right and each method is related to a specific
object or let's say specific browser so you can see guys that each method or
browser method is a static method right that's the static one so when I say
static that means instead of calling or writing two different methods you can
simply call the method right again that is to say calling your method and
initialize the capability object directly from the static method okay so
let me do that for you guys so desired capabilities and directly Internet
Explorer let me just go to the next line so your the purpose of this capabilities
is to initialize your web driver as same as the previous so instead of using new
Firefox driver I am going to say let's say Internet Explorer drivers
capabilities okay so let me choose one this one
so when you use the capabilities as a constructor parameters for a drive
object it is actually again going to use the same exe files see this exe file
that we talked about right
or rather it is going to use Exe file to initialize the drivers so here for each
and every browser apart from the firebox you must use the Exe file provided by
the selenium HQ team and now our driver is ready so once your driver or ie
driver is ready then I am going to use get method to open my simple google site
so let me do that now so now let me get in the get method so
that we can open my simple Google site and let me just type in the domain from
over here
let's copy this and paste it over here so now your drive object is ready and
now let's execute and understand whether is it initializing the Internet Explorer
browser properly or not so let's check it out there
so here Internet Explorer browser is going to be launched using our web
driver okay so now let's wait for the result
okay so see we have now successfully launched our Internet Explorer using our
web driver right okay now you can exactly use the same logic to initialize
your Chrome browser right now we work for internet browser Internet Explorer
now Chrome browser but then here use the same system property just with your
chrome property ok so again let me write the code for it and then the value with
the exact folder location along with your exe file name so let me go ahead so
public static void verify Chrome okay and then let me copy this from here and
paste it over here or rather let me type in okay
so just get it again you need to give the same path
so first qualities webdriver dot Chrome this time right dot driver and then the
same path you need to copy and the exe file location as well so let me copy the
path
okay and then the name of the exe files so this is the name of the exe file so
let me again copy
and paste it over and do not forget to give this cape character to get out of
your compliation error
and then again we are going to call the desired capabilities
and this time we are calling chrome method right
and since it is a static method so again we do not need to create any different
methods so instead of creating a new object and then calling the method we
are directly using the method itself just like we did with Internet Explorer
right
now we are going to use our webdriver object so let me again type in for that
so this is again which is chrome driver capabilities right
you and then once your browser is ready you
can simply directly call your get method so let me do that for you guys let me
call this get method
okay and save it
so let me just do a little bit of changes over here some spelling error
okay this is done now what so now here we are going to call our Crowe method
right instead of ie browser so we are using the same class but calling
different method which will help us initialize Chrome browser for testing
so now let us test the result what is the result whether we are going to
initialize it or not so let's wait for the result now it is going to take a
while and see we have got this so see here using web drivers we actually kind
of did cross browser testing and that is how it actually works
I hope guys you got a fair knowledge about it now let's go ahead and
ultimately let's talk about the carrier selenium has got to offer you so without
the right testing process no software can be released and hence the salaries
and amount for automation testing professionals will only increase in the
future so companies and diverse fields are actually deploying to selenium
automation testing but then there is a serious shortage of almost 4 lakh
automation testing professionals across the world and then you can also see
average salary of a selenium professional in USA which is quite you
know promising and once you complete the course you can choose your designation
just like selenium test analyst automation tester automation engineer
Quality Engineer and many more other designations awaiting you and now let us
quickly go through all that we have learnt today so far so we saw what is
selenium then difference between selenium and qtp we then also looked at
different components of selenium followed by a practical work and finally
career opportunities it has for you and then entire iPad offers the most
comprehensive training and selenium testing and upon completion of the
training you can simply gain proficiency in selenium let's say IDE RC test
webdriver grid etc for software testing I'm good
this we come to the end of this video if you have got any query feel free to
contact us thank you so much for watching this video and giving us your
precious time I hope the video was informative for you please like the
video and if you have any doubts comment below
we shall respond to it at the earliest don't forget to subscribe to our channel
for more such informative videos you look out for other related videos in our
playlist for more detailed information visit our website now have a greatly and