Você está na página 1de 9

Q1. What is Selenium?

Ans. Selenium is a set of tools that supports rapid development of test automati
on scripts for web
based applications. Selenium testing tools provides a rich set of testing functi
ons specifically
designed to fulfil needs of testing of a web based application.

Q2. What are the main components of Selenium testing tools?


Ans. Selenium IDE, Selenium RC and Selenium Grid

Q3. What is Selenium IDE?


Ans. Selenium IDE is for building Selenium test cases. It operates as a Mozilla
Firefox add on and
provides an easy to use interface for developing and running individual test cas
es or entire test
suites. Selenium-IDE has a recording feature, which will keep account of user ac
tions as they are
performed and store them as a reusable script to play back.

Q4. What is the use of context menu in Selenium IDE?


Ans. It allows the user to pick from a list of assertions and verifications for
the selected location.

Q5. Can tests recorded using Selenium IDE be run in other browsers?
Ans. Yes. Although Selenium IDE is a Firefox add on, however, tests created in i
t can also be run in
other browsers by using Selenium RC (Selenium Remote Control) and specifying the
name of the test
suite in command line.

Q6. What are the advantage and features of Selenium IDE?


Ans. 1. Intelligent field selection will use IDs, names, or XPath as needed
2. It is a record & playback tool and the script format can be written in variou
s languages including
C#, Java, PERL, Python, PHP, HTML
3. Auto complete for all common Selenium commands
4. Debug and set breakpoints
5. Option to automatically assert the title of every page
6. Support for Selenium user-extensions.js file
Q7. What are the disadvantage of Selenium IDE tool?
Ans. 1. Selenium IDE tool can only be used in Mozilla Firefox browser.
2. It is not playing multiple windows when we record it.

Q8. What is Selenium RC (Remote Control)?


Ans. Selenium RC allows the test automation expert to use a programming language
for maximum
flexibility and extensibility in developing test logic. For example, if the appl
ication under test returns
a result set and the automated test program needs to run tests on each element i
n the result set, the
iteration / loop support of programming language s can be used to iterate through
the result set,
calling Selenium commands to run tests on each item.

Selenium RC provides an API and library for each of its supported languages. Thi
s ability to use
Selenium RC with a high level programming language to develop test cases also al
lows the automated
testing to be integrated with the project s automated build environment.

Q9. What is Selenium Grid?


Ans. Selenium Grid in the selenium testing suit allows the Selenium RC solution
to scale for test suites
that must be run in multiple environments. Selenium Grid can be used to run mult
iple instances of
Selenium RC on various operating system and browser configurations.

Q10. How Selenium Grid works?


Ans. Selenium Grid sent the tests to the hub. Then tests are redirected to an av
ailable Selenium RC,
which launch the browser and run the test. Thus, it allows for running tests in
parallel with the entire
test suite.

Q 11. What you say about the flexibility of Selenium test suite?
Ans. Selenium testing suite is highly flexible. There are multiple ways to add f
unctionality to Selenium
framework to customize test automation. As compared to other test automation too
ls, it is
Selenium s strongest characteristic. Selenium Remote Control support for multiple
programming and
scripting languages allows the test automation engineer to build any logic they
need into their
automated testing and to use a preferred programming or scripting language of on
e s choice.
Also, the Selenium testing suite is an open source project where code can be mod
ified and
enhancements can be submitted for contribution.

Q12. What test can Selenium do?


Ans. Selenium is basically used for the functional testing of web based applicat
ions. It can be used for
testing in the continuous integration environment. It is also useful for agile t
esting

Q13. What is the cost of Selenium test suite?


Ans. Selenium test suite a set of open source software tool, it is free of cost.

Q14. What browsers are supported by Selenium Remote Control?


Ans. The test automation expert can use Firefox, IE 7/8, Safari and Opera browse
rs to run tests in
Selenium Remote Control.

Q15. What programming languages can you use in Selenium RC?


Ans. C#, Java, Perl, PHP, Python, Ruby

Q16. What are the advantages and disadvantages of using Selenium as testing tool
?
Ans. Advantages: Free, Simple and powerful DOM (document object model) level tes
ting, can be used
for continuous integration; great fit with Agile projects.

Disadvantages: Tricky setup; dreary errors diagnosis; can not test client server
applications.
Q17. What is difference between QTP and Selenium?
Ans. Only web applications can be testing using Selenium testing suite. However,
QTP can be used for
testing client server applications. Selenium supports following web browsers: In
ternet Explorer,
Firefox, Safari, Opera or Konqueror on Windows, Mac OS X and Linux. However, QTP
is limited to
Internet Explorer on Windows.

QTP uses scripting language implemented on top of VB Script. However, Selenium t


est suite has the
flexibility to use many languages like Java, .Net, Perl, PHP, Python, and Ruby.

Q18. What is difference between Borland Silk test and Selenium?


Ans. Selenium is completely free test automation tool, while Silk Test is not. O
nly web applications
can be testing using Selenium testing suite. However, Silk Test can be used for
testing client server
applications. Selenium supports following web browsers: Internet Explorer, Firef
ox, Safari, Opera or
Konqueror on Windows, Mac OS X and Linux. However, Silk Test is limited to Inter
net Explorer and
Firefox.

Silk Test uses 4Test scripting language. However, Selenium test suite has the fl
exibility to use many
languages like Java, .Net, Perl, PHP, Python, and Ruby.

What is Selenium ?
Selenium is an open source, robust set of tools that supports rapid development
of test automation for web-based applications. This tool is primarily developed
in Java Script and browser technologies and hence supports all the major browser
s on all the platforms. Most of the time, we will not need to change our scripts
for them to work on other platforms. Selenium provides a record/playback tool f
or authoring tests without learning a test scripting language.
Selenium Components
There are three variants of Selenium, which can be used in isolation or in combi
nation to create complete automation suite for the web applications. Each one ha
s a specific role in aiding the development of web application test automation.
Selenium IDE
Selenium Core
Selenium RC
Selenium IDE
Selenium IDE is an integrated development environment for Selenium tests. It is
implemented as a Firefox extension, and has a recording feature, which will keep
account of user actions as they are performed and store them as a reusable scri
pt to play back. Selenium-IDE also offers full editing of test cases for more pr
ecision and control.
How to Use Selenium:
Select Selenium IDE from the Tools menu in Firefox. By default when the IDE comes
up it has recording turned on. Go to a web site that you want to record, click o
n the record button and begin the browsing task(s). we will notice that as we c
lick and type in the browser the IDE is recording everything we are doing. When
we are done, simply end recording and click on the green arrow to play back the
script you just created. Don t forget to save your script before closing the IDE
.Below are the screen shots of working of Selenium IDE and the script generated
by IDE.
Please find in below link the Video presentation to record and execute a test
http://wiki.openqa.org/download/attachments/400/Selenium+IDE.swf?

Biggest drawback of Selenium IDE is its limitation in terms of browser support.


Though Selenium scripts can be used for most of the browser and operating system
,

Advantages of Selenium:
It is a Open source
Simple, Easy to install, Easy to work
Selenium IDE is the only flavor of Selenium which allows you to record user acti
on on browser window
Can also record user actions in most of the popular languages like Java, C#, Per
l, Ruby
It will not record any operation that you do on your computer apart from the eve
nts on Firefox browser window
During recording if you right click on any element it will show all the selenium
commands available
we can also edit existing command, by selecting it and editing on the boxes avai
lable
we can also insert/delete commands by choosing appropriate option after right cl
icking
Choose appropriate run option i.e walk, run or test runner and review your resul
ts
Disadvantages of Selenium:
Limitation in terms of browser support (It runs only in Mozilla).Scripts written
using Selenium IDE can be used for other browsers only if it is used with Sele
nium RC or Selenium Core.
We can t run recorded script if it is converted to Java, C#, Ruby etc.
Not allowed to write manual scripts like conditions and Loops for Data Driven Te
sting
There is no option to verify images.
Selenium Core
Selenium Core is a test tool for web applications. Selenium Core tests run direc
tly in a browser, just as real users do. They run in Internet Explorer, Mozilla
and Firefox on Windows, Linux and Macintosh. It is a simpler form of Selenium, a
nd suitable for non-developers.
Browser compatibility testing: To test the application if it works correctly on
different browsers and operating systems. The same script can run on any Seleniu
m platform.
System functional testing: Create regression tests to verify application functio
nality and user acceptance.
Disadvantages:
It cannot switch between http and https protocols.
It cannot handle file upload
It is extremely complicated for first time users.
Selenium Remote Control
Selenium-RC is the solution for tests that need more than simple browser actions
and linear execution. We can use Selenium-RC whenever our test requires logic w
hich is not supported by Selenium-IDE. Selenium-RC uses the full power of progra
mming languages to create more complex tests like reading and writing files, que
rying a database, and emailing test results.

Features
We can use Java syntax to write test script
Easy to conduct Data Driven Testing
We can read files to get test data
We can store Test Results into files
Disadvantages
We can only run a limited number of concurrent tests on the same remote control
before seriously impacting its stability.
Browser

Firefox 3.x,Firefox 3, Firefox 2


IE 8,IE 7,IE 6
Safari 4,Safari 3 ,Safari 2
Opera 10,Opera 9,Opera 8
Google Chrome
Selenium-IDE

Record and playback tests


Test execution only via Selenium-RC*
Test execution only via Selenium-RC
Test execution only via Selenium-RC
Test execution only via Selenium-RC(Windows)
Selenium-RC

Start browser, run tests


Start browser, run Tests
Start browser, run tests
Start browser, run tests
Start browser, run tests
Operating Systems
Windows, Linux,Mac
Windows
Mac
Windows, Linux, Mac
Windows
* Tests developed on Firefox via Selenium-IDE can be executed on any other suppo
rted browser via a simple Selenium-RC command line.
What is the difference between an assert and a verify with Selenium commands?
What Selenese commands can be used to help debug a regexp?
What is one big difference between SilkTest and Selenium, excluding the price?
Which browsers can Selenium IDE be run in?
If a Selenium function requires a script argument, what would that argument look
like in general terms?
If a Selenium function requires a pattern argument, what five prefixes might tha
t argument have?
What is the regular expression sequence that loosely translates to "anything or
nothing?"
What is the globbing sequence that loosely translates to "anything or nothing?
What does a character class for all alphabetic characters and digits look like i
n regular expressions?
What does a character class for all alphabetic characters and digits look like i
n globbing?
What must one set within SIDE in order to run a test from the beginning to a cer
tain point within the test?
What does a right-pointing green triangle at the beginning of a command in SIDE
indicate?
How does one get rid of the right-pointing green triangle?
How can one add vertical white space between sections of a single test?
What Selenium functionality uses wildcards?
Which wildcards does SIDE support?
What are the four types of regular expression quantifiers which we've studied?
What regular expression special character(s) means "any character?"
What distinguishes between an absolute and relative URL in SIDE?
How would one access a Selenium variable named "count" from within a JavaScript
snippet?
What Selenese command can be used to display the value of a variable in the log
file, which can be very valuable for debugging?
If one wanted to display the value of a variable named answer in the log file, w
hat would the first argument to the previous command look like?
Where did the name "Selenium" come from?
Which Selenium command(s) simulates selecting a link?
Which two commands can be used to check that an alert with a particular message
popped up?
What does a comment look like in Column view?
What does a comment look like in Source view?
What are Selenium tests normally named (as displayed at the top of each test whe
n viewed from within a browser)?
What command simulates selecting the browser's Back button?
If the Test Case frame contains several test cases, how can one execute just the
selected one of those test cases?
What globbing functionality is NOT supported by SIDE?
What is wrong with this character class range? [A-z]
What are four ways of specifying an uppercase or lowercase M in a Selenese patte
rn?
What does this regular expression match?
regexp:[1-9][0-9],[0-9]{3},[0-9]{3}
What are two ways to match an asterisk within a Selenese regexp?
What is the generic name for an argument (to a Selenese command) which starts wi
th //?
What Selenese command is used to choose an item from a list?
How many matches exist for this pattern?
regexp:[13579][02468]
What is the oddity associated with testing an alert?
How can one get SIDE to always record an absolute URL for the open command's arg
ument?
What Selenese command and argument can be used to transfer the value of a JavaSc
ript variable into a SIDE variable?
How would one access the value of a SIDE variable named name from within a JavaS
cript snippet used as the argument to a Selenese command?
What is the name of the type of JavaScript entity represented by the last answer
?
What string(s) does this regular expression match?
regexp:August|April 5, 1908
What Selenium regular expression pattern can be used instead of the glob below t
o produce the same results?
verifyTextPresent | glob:9512?
What Selenium globbing pattern can be used instead of the regexp below to produc
e the same results?
verifyTextPresent | regexp:Hush.*Charlotte
1. How do you start Selenium RC?
2. How do you connect Data base from selenium
3. How do you handle Ajax controls using selenium?
Eg. By typing in search engine how do you capture the auto suggestion
4. How do you select the 2nd item in a List box or drop down.
5. How do you identify an object using selenium?
6. How do you capture an element loading after the page load?
7. Brief about your framework
8. What is the difference between assert and Verify Commands?
9. Explain about your reporting method
10.How do you verify an object presented in multiple pages.
11.What are the locators available in Selenium
12.What is the difference between single and double slash in Xpath.
13.Brief about Selenium Client.
14.Did you write any User Extensions.
15.What are all things can not be done through selenium IDE
16.Brief about Selenium Grid.
17.Is it possible to start the Remote engine more than once in an instance.
18. How to use selenium for performance testing
How to select listbox or dropdown item with incremental value
If we need to select a category from a list box with incremental value.
i.e there is an item "Videos(29)". In the next time of execution it becomes "Vid
eos(30)","Videos(31)" etc..
If we select the id, It will fail the case.
Following approach will be help full to handle this:
Getting the current value and stored it, Then stored value has been passed for s
election.
String ct1 = selenium.GetText("//option[@value='4641']");
selenium.AddSelection ("ctl00_mainContentPlaceHolder_lstCategory",ct1);
Selenium Automation Framework Design
To design a framework we need to concentrate on the following factors.
1. We need to create UI Map
2. Libraries for UI objects.
3. Design classes based on application under test.
4. Plan for test execution approach to minimize the time.
5. Design report generation.
6. Prepare a Step table and step suite.
7. Prepare a Data set where ever needed
8. Design Keyword Driven action fixtures
9. Design and develop the psudo code.

You can use the getXpathCount command to determine the number of matching elemen
ts. You can then loop through them using an increment to locate each element ind
ividually. The following Java (TestNG/JUnit) example would check that all checkb
oxes on a page are checked:
int totalCheckboxes = session().getXpathCount("//input[@type='checkbox']").intVa
lue();
for (int i = 1; i < totalCheckboxes+1; i++) {
assertTrue(session().isChecked("//input[@type='checkbox'][" + i + "]"));
}

You can capture the network traffic with Selenium and then try get what you need
for that
Selenium s = new DefaultSelenium(...);
s.start("captureNetworkTraffic=true");
s.open("http://www.google.com");
String traffic = s.captureNetworkTraffic("json");
And then do your asserts by finding what you want in the traffic.

Você também pode gostar