You are on page 1of 44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

SoftwareTestingHelp
SoftwareTestingCompleteGuide
7FactorsAffectingTestEstimationofSelenium
AutomationProjectSeleniumTutorial#32

Search

HowisCrossBrowserTestingPerformed?

50MostPopularlyAskedSeleniumInterview
QuestionsandAnswersSeleniumTutorial#33
PostedIn|AutomationTesting,Questions&answers,SeleniumTutorials,TestingInterviewquestions|
LastUpdated:"August25,2016"
Inthistutorial,wehavelistedthe50most
popularlyaskedSeleniuminterviewquestions
includingSeleniumWebDriverinterview
questions.
AquicknoteaboutthisSeleniumarticleseries
beforewemovetothislasttutorial:
ThisisthelasttutorialinourSeleniumonline
trainingseriesof30+comprehensivetutorials.I
hopeyouallenjoyedthesetutorialsandstarted
learningfromit.Ifyouarenewherepleasehead
overtothisveryfirsttutorialinthistrainingseries.

Top50SeleniumInterviewQuestions
andAnswers:

Q#1)WhatisAutomationTesting?
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

1/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

AutomationtestingorTestAutomationisaprocessofautomatingthemanualprocesstotestthe
application/systemundertest.Automationtestinginvolvesusetoaseparatetestingtoolwhichletsyou
createtestscriptswhichcanbeexecutedrepeatedlyanddoesntrequireanymanualintervention.
Q#2)WhatarethebenefitsofAutomationTesting?
BenefitsofAutomationtestingare:
1. Supportsexecutionofrepeatedtestcases
2. Aidsintestingalargetestmatrix
3. Enablesparallelexecution
4. Encouragesunattendedexecution
5. Improvesaccuracytherebyreducinghumangeneratederrors
6. Savestimeandmoney
Q#3)WhyshouldSeleniumbeselectedasatesttool?
Selenium
1. isfreeandopensource
2. havealargeuserbaseandhelpingcommunities
3. havecrossBrowsercompatibility(Firefox,chrome,InternetExplorer,Safarietc.)
4. havegreatplatformcompatibility(Windows,MacOS,Linuxetc.)
5. supportsmultipleprogramminglanguages(Java,C#,Ruby,Python,Pearletc.)
6. hasfreshandregularrepositorydevelopments
7. supportsdistributedtesting
Q#4)WhatisSelenium?WhatarethedifferentSeleniumcomponents?
Seleniumisoneofthemostpopularautomatedtestingsuites.Seleniumisdesignedinawaytosupport
andencourageautomationtestingoffunctionalaspectsofwebbasedapplicationsandawiderangeof
browsersandplatforms.Duetoitsexistenceintheopensourcecommunity,ithasbecomeoneofthe
mostacceptedtoolsamongstthetestingprofessionals.
Seleniumisnotjustasingletoolorautility,ratherapackageofseveraltestingtoolsandforthesame
reasonitisreferredtoasaSuite.Eachofthesetoolsisdesignedtocaterdifferenttestingandtest
environmentrequirements.
Thesuitepackageconstitutesofthefollowingsetsoftools:
SeleniumIntegratedDevelopmentEnvironment(IDE)SeleniumIDEisarecordand
playbacktool.ItisdistributedasaFirefoxPlugin.
SeleniumRemoteControl(RC)SeleniumRCisaserverthatallowsusertocreatetestscriptsin
adesiredprogramminglanguage.Italsoallowsexecutingtestscriptswithinthelargespectrumof
browsers.
SeleniumWebDriverWebDriverisadifferenttoolaltogetherthathasvariousadvantagesover
SeleniumRC.WebDriverdirectlycommunicateswiththewebbrowserandusesitsnative
compatibilitytoautomate.
SeleniumGridSeleniumGridisusedtodistributeyourtestexecutiononmultipleplatformsand
environmentsconcurrently.
Q#5)WhatarethetestingtypesthatcanbesupportedbySelenium?
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

2/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

Seleniumsupportsthefollowingtypesoftesting:
1. FunctionalTesting
2. RegressionTesting
Q#6)WhatarethelimitationsofSelenium?
FollowingarethelimitationsofSelenium:
Seleniumsupportstestingofonlywebbasedapplications
MobileapplicationscannotbetestedusingSelenium
CaptchaandBarcodereaderscannotbetestedusingSelenium
ReportscanonlybegeneratedusingthirdpartytoolslikeTestNGorJunit.
AsSeleniumisafreetool,thusthereisnoreadyvendorsupportthoughtheusercanfindnumerous
helpingcommunities.
Userisexpectedtopossesspriorprogramminglanguageknowledge.
Q#7)WhatisthedifferencebetweenSeleniumIDE,SeleniumRCandWebDriver?
Feature

SeleniumIDE

SeleniumRC

WebDriver

Browser
Compatibility

SeleniumIDE
comesasa
Firefoxplugin,
thusitsupports
onlyFirefox

SeleniumRC
supportsa
variedrangeof
versionsof
Mozilla
Firefox,Google
Chrome,
Internet
Explorerand
Opera

WebDriver
supportsa
variedrangeof
versionsof
Mozilla
Firefox,Google
Chrome,
Internet
Explorerand
Opera.
Alsosupports
HtmlUnitDriver
whichisaGUI
lessorheadless
browser.

Recordand
Playback

SeleniumIDE
supportsrecord
andplayback
feature

SeleniumRC
doesn'tsupports
recordand
playback
feature

WebDriver
doesn'tsupport
recordand
playback
feature

Server
Requirement

SeleniumIDE
doesn'trequire
anyservertobe
startedbefore
executingthe
testscripts

SeleniumRC
requiresserver
tobestarted
before
executingthe
testscripts

WebDriver
doesn'trequire
anyservertobe
startedbefore
executingthe
testscripts

Architecture

SeleniumIDE

SeleniumRCis

WebDriveruses

http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

3/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

isaJavascript
based
framework

aJavaScript
based
Framework

thebrowser's
native
compatibilityto
automation

ObjectOriented

SeleniumIDE
isnotanobject
orientedtool

SeleniumRCis
semiobject
orientedtool

WebDriverisa
purelyobject
orientedtool

DynamicFinders
(forlocatingweb
elementsona
webpage)

SeleniumIDE
doesn'tsupport
dynamic
finders

SeleniumRC
doesn'tsupport
dynamic
finders

WebDriver
supports
dynamicfinders

HandlingAlerts,
Navigations,
Dropdowns

SeleniumIDE
doesn't
explicitly
providesaidsto
handlealerts,
navigations,
dropdowns

SeleniumRC
doesn't
explicitly
providesaidsto
handlealerts,
navigations,
dropdowns

WebDriver
offersawide
rangeof
utilitiesand
classesthat
helpsin
handlingalerts,
navigations,
anddropdowns
efficientlyand
effectively.

WAP
(iPhone/Android)
Testing

SeleniumIDE
doesn'tsupport
testingof
iPhone/Andriod
applications

SeleniumRC
doesn'tsupport
testingof
iPhone/Andriod
applications

WebDriveris
designedina
wayto
efficiently
supporttesting
of
iPhone/Android
applications.
Thetoolcomes
withalarge
rangeofdrivers
forWAPbased
testing.
Forexample,
AndroidDriver,
iPhoneDriver

ListenerSupport

SeleniumIDE
doesn'tsupport
listeners

SeleniumRC
doesn'tsupport
listeners

WebDriver
supportsthe
implementation
ofListeners

Speed

SeleniumIDE
isfastasitis
pluggedinwith

SeleniumRCis
slowerthan
WebDriverasit

WebDriver
communicates
directlywith

http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

4/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

theweb
browserthat
launchesthe
test.Thus,the
IDEand
browser
communicates
directly

doesn't
communicates
directlywith
thebrowser
ratheritsends
selenese
commandsover
toSelenium
Corewhichin
turn
communicates
withthe
browser.

theweb
browsers.Thus
makingitmuch
faster.

Q#8)WhenshouldIuseSeleniumIDE?
SeleniumIDEisthesimplestandeasiestofallthetoolswithintheSeleniumPackage.Itsrecordand
playbackfeaturemakesitexceptionallyeasytolearnwithminimalacquaintancestoanyprogramming
language.SeleniumIDEisanidealtoolforanaveuser.
Q#9)WhatisSelenese?
SeleneseisthelanguagewhichisusedtowritetestscriptsinSeleniumIDE.
Q#10)WhatarethedifferenttypesoflocatorsinSelenium?
Locatorcanbetermedasanaddressthatidentifiesawebelementuniquelywithinthewebpage.Thus,to
identifywebelementsaccuratelyandpreciselywehavedifferenttypesoflocatorsinSelenium:
ID
ClassName
Name
TagName
LinkText
PartialLinkText
Xpath
CSSSelector
DOM
Q#11)Whatisdifferencebetweenassertandverifycommands?
Assert:Assertcommandcheckswhetherthegivenconditionistrueorfalse.Letssayweassertwhether
thegivenelementispresentonthewebpageornot.Iftheconditionistruethentheprogramcontrolwill
executethenextteststepbutiftheconditionisfalse,theexecutionwouldstopandnofurthertestwould
beexecuted.
Verify:Verifycommandalsocheckswhetherthegivenconditionistrueorfalse.Irrespectiveofthe
conditionbeingtrueorfalse,theprogramexecutiondoesnthaltsi.e.anyfailureduringverification
wouldnotstoptheexecutionandalltheteststepswouldbeexecuted.
Q#12)WhatisanXpath?
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

5/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

XpathisusedtolocateawebelementbasedonitsXMLpath.XMLstandsforExtensibleMarkup
Languageandisusedtostore,organizeandtransportarbitrarydata.Itstoresdatainakeyvaluepair
whichisverymuchsimilartoHTMLtags.Bothbeingmarkuplanguagesandsincetheyfallunderthe
sameumbrella,XpathcanbeusedtolocateHTMLelements.
ThefundamentalbehindlocatingelementsusingXpathisthetraversingbetweenvariouselementsacross
theentirepageandthusenablingausertofindanelementwiththereferenceofanotherelement.
Q#13)Whatisthedifferencebetween/and//inXpath?
SingleSlash/SingleslashisusedtocreateXpathwithabsolutepathi.e.thexpathwouldbecreated
tostartselectionfromthedocumentnode/startnode.
DoubleSlash//DoubleslashisusedtocreateXpathwithrelativepathi.e.thexpathwouldbe
createdtostartselectionfromanywherewithinthedocument.
Q#14)WhatisSameoriginpolicyandhowitcanbehandled?
TheproblemofsameoriginpolicydisallowstoaccesstheDOMofadocumentfromanoriginthatis
differentfromtheoriginwearetryingtoaccessthedocument.
Originisasequentialcombinationofscheme,hostandportoftheURL.Forexample,foraURLhttp://
http://www.softwaretestinghelp.com/resources/,theoriginisacombinationofhttp,
softwaretestinghelp.com,80correspondingly.
ThustheSeleniumCore(JavaScriptProgram)cannotaccesstheelementsfromanoriginthatisdifferent
fromwhereitwaslaunched.ForExample,ifIhavelaunchedtheJavaScriptProgramfrom
http://www.softwaretestinghelp.com,thenIwouldbeabletoaccessthepageswithinthesamedomain
suchashttp://www.softwaretestinghelp.com/resourcesorhttp://www.softwaretestinghelp.com/istqb
freeupdates/.Theotherdomainslikegoogle.com,seleniumhq.orgwouldnomorebeaccessible.
So,Inordertohandlesameoriginpolicy,SeleniumRemoteControlwasintroduced.
Q#15)WhenshouldIuseSeleniumGrid?
SeleniumGridcanbeusedtoexecutesameordifferenttestscriptsonmultipleplatformsandbrowsers
concurrentlysoastoachievedistributedtestexecution,testingunderdifferentenvironmentsandsaving
executiontimeremarkably.
Q#16)WhatdowemeanbySelenium1andSelenium2?
SeleniumRCandWebDriver,inacombinationarepopularlyknownasSelenium2.SeleniumRCalone
isalsoreferredasSelenium1.
Q#17)WhichisthelatestSeleniumtool?
WebDriver
Q#18)HowdoIlaunchthebrowserusingWebDriver?
ThefollowingsyntaxcanbeusedtolaunchBrowser:
WebDriverdriver=newFirefoxDriver()
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

6/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

WebDriverdriver=newChromeDriver()
WebDriverdriver=newInternetExplorerDriver()
Q#19)WhatarethedifferenttypesofDriversavailableinWebDriver?
ThedifferentdriversavailableinWebDriverare:
FirefoxDriver
InternetExplorerDriver
ChromeDriver
SafariDriver
OperaDriver
AndroidDriver
IPhoneDriver
HtmlUnitDriver
Q#20)WhatarethedifferenttypesofwaitsavailableinWebDriver?
TherearetwotypesofwaitsavailableinWebDriver:
1. ImplicitWait
2. ExplicitWait
ImplicitWait:Implicitwaitsareusedtoprovideadefaultwaitingtime(say30seconds)betweeneach
consecutiveteststep/commandacrosstheentiretestscript.Thus,subsequentteststepwouldonly
executewhenthe30secondshaveelapsedafterexecutingthepreviousteststep/command.
ExplicitWait:Explicitwaitsareusedtohalttheexecutiontillthetimeaparticularconditionismetor
themaximumtimehaselapsed.UnlikeImplicitwaits,explicitwaitsareappliedforaparticularinstance
only.
Q#21)HowtotypeinatextboxusingSelenium?
UsercanusesendKeys(Stringtobeentered)toenterthestringinthetextbox.
Syntax:
WebElementusername=drv.findElement(By.id(Email))
//enteringusername
username.sendKeys(sth)
Q#22)Howcanyoufindifanelementindisplayedonthescreen?
WebDriverfacilitatestheuserwiththefollowingmethodstocheckthevisibilityofthewebelements.
Thesewebelementscanbebuttons,dropboxes,checkboxes,radiobuttons,labelsetc.
1. isDisplayed()
2. isSelected()
3. isEnabled()
Syntax:
isDisplayed():
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

7/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

booleanbuttonPresence=driver.findElement(By.id(gbqfba)).isDisplayed()
isSelected():
booleanbuttonSelected=driver.findElement(By.id(gbqfba)).isDisplayed()
isEnabled():
booleansearchIconEnabled=driver.findElement(By.id(gbqfb)).isEnabled()
Q#23)Howcanwegetatextofawebelement?
Getcommandisusedtoretrievetheinnertextofthespecifiedwebelement.Thecommanddoesnt
requireanyparameterbutreturnsastringvalue.Itisalsooneoftheextensivelyusedcommandsfor
verificationofmessages,labels,errorsetcdisplayedonthewebpages.
Syntax:
StringText=driver.findElement(By.id(Text)).getText()
Q#24)Howtoselectvalueinadropdown?
ValueinthedropdowncanbeselectedusingWebDriversSelectclass.
Syntax:
selectByValue:
SelectselectByValue=newSelect(driver.findElement(By.id(SelectID_One)))
selectByValue.selectByValue(greenvalue)
selectByVisibleText:
SelectselectByVisibleText=newSelect(driver.findElement(By.id(SelectID_Two)))
selectByVisibleText.selectByVisibleText(Lime)
selectByIndex:
SelectselectByIndex=newSelect(driver.findElement(By.id(SelectID_Three)))
selectByIndex.selectByIndex(2)
Q#25)Whatarethedifferenttypesofnavigationcommands?
Followingarethenavigationcommands:
navigate().back()Theabovecommandrequiresnoparametersandtakesbacktheusertotheprevious
webpageinthewebbrowsershistory.
Samplecode:
driver.navigate().back()
navigate().forward()Thiscommandletstheusertonavigatetothenextwebpagewithreferenceto
thebrowsershistory.
Samplecode:
driver.navigate().forward()
navigate().refresh()Thiscommandletstheusertorefreshthecurrentwebpagetherebyreloadingall
thewebelements.
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

8/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

Samplecode:
driver.navigate().refresh()
navigate().to()Thiscommandletstheusertolaunchanewwebbrowserwindowandnavigatetothe
specifiedURL.
Samplecode:
driver.navigate().to(https://google.com)
Q#26)HowtoclickonahyperlinkusinglinkText?
driver.findElement(By.linkText(Google)).click()
Thecommandfindstheelementusinglinktextandthenclickonthatelementandthustheuserwouldbe
redirectedtothecorrespondingpage.
Theabovementionedlinkcanalsobeaccessedbyusingthefollowingcommand.

driver.findElement(By.partialLinkText(Goo)).click()
Theabovecommandfindtheelementbasedonthesubstringofthelinkprovidedintheparenthesisand
thuspartialLinkText()findsthewebelementwiththespecifiedsubstringandthenclicksonit.
Q#27)HowtohandleframeinWebDriver?
AninlineframeacronymasiframeisusedtoinsertanotherdocumentwithinthecurrentHTML
documentorsimplyawebpageintoawebpagebyenablingnesting.
Selectiframebyid
driver.switchTo().frame(IDoftheframe)
LocatingiframeusingtagName
driver.switchTo().frame(driver.findElements(By.tagName(iframe).get(0))
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

9/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

Locatingiframeusingindex
frame(index)
driver.switchTo().frame(0)
frame(NameofFrame)
driver.switchTo().frame(nameoftheframe)
frame(WebElementelement)
SelectParentWindow
driver.switchTo().defaultContent()
Q#28)WhendoweusefindElement()andfindElements()?
findElement():findElement()isusedtofindthefirstelementinthecurrentwebpagematchingtothe
specifiedlocatorvalue.Takeanotethatonlyfirstmatchingelementwouldbefetched.
Syntax:
WebElementelement=driver.findElements(By.xpath(//div[@id=example]//ul//li))
findElements():findElements()isusedtofindalltheelementsinthecurrentwebpagematchingtothe
specifiedlocatorvalue.Takeanotethatallthematchingelementswouldbefetchedandstoredinthelist
ofWebElements.
Syntax:
List<WebElement>elementList=driver.findElements(By.xpath(//div[@id=example]//ul//li))
Q#29)Howtofindmorethanonewebelementinthelist?
Attimes,wemaycomeacrosselementsofsametypelikemultiplehyperlinks,imagesetcarrangedinan
orderedorunorderedlist.Thus,itmakesabsolutesensetodealwithsuchelementsbyasinglepieceof
codeandthiscanbedoneusingWebElementList.
SampleCode
1 //Storingthelist
2 List<WebElement>elementList=
driver.findElements(By.xpath("//div[@id='example']//ul//li"));
3 //Fetchingthesizeofthelist
4 intlistSize=elementList.size();
5 for(inti=0;i<listSize;i++)
6 {
7 //Clickingoneachserviceproviderlink
8 serviceProviderLinks.get(i).click();
9 //Navigatingbacktothepreviouspagethatstoreslinktoservice
providers
10 driver.navigate().back();
11 }
Q#30)Whatisthedifferencebetweendriver.close()anddriver.quitcommand?
close():WebDriversclose()methodclosesthewebbrowserwindowthattheuseriscurrentlyworking
onorwecanalsosaythewindowthatisbeingcurrentlyaccessedbytheWebDriver.Thecommand
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

10/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

neitherrequiresanyparameternordoesisreturnanyvalue.
quit():Unlikeclose()method,quit()methodclosesdownallthewindowsthattheprogramhasopened.
Sameasclose()method,thecommandneitherrequiresanyparameternordoesisreturnanyvalue.
Q#31)CanSeleniumhandlewindowsbasedpopup?
Seleniumisanautomationtestingtoolwhichsupportsonlywebapplicationtesting.Therefore,windows
popupcannotbehandledusingSelenium.
Q#32)Howcanwehandlewebbasedpopup?
WebDriverofferstheuserswithaveryefficientwaytohandlethesepopupsusingAlertinterface.There
arethefourmethodsthatwewouldbeusingalongwiththeAlertinterface.
voiddismiss()Theaccept()methodclicksontheCancelbuttonassoonasthepopupwindow
appears.
voidaccept()Theaccept()methodclicksontheOkbuttonassoonasthepopupwindow
appears.
StringgetText()ThegetText()methodreturnsthetextdisplayedonthealertbox.
voidsendKeys(StringstringToSend)ThesendKeys()methodentersthespecifiedstringpattern
intothealertbox.
Syntax:
//acceptingjavascriptalert
Alertalert=driver.switchTo().alert()
alert.accept()
Q#33)Howcanwehandlewindowsbasedpopup?
Seleniumisanautomationtestingtoolwhichsupportsonlywebapplicationtesting,thatmeans,itdoesnt
supporttestingofwindowsbasedapplications.HoweverSeleniumalonecanthelpthesituationbut
alongwithsomethirdpartyintervention,thisproblemcanbeovercome.Thereareseveralthirdparty
toolsavailableforhandlingwindowbasedpopupsalongwiththeseleniumlikeAutoIT,Robotclassetc.
Q#34)Howtoasserttitleofthewebpage?
//verifythetitleofthewebpage
assertTrue(Thetitleofthewindowisincorrect.,driver.getTitle().equals(Titleofthepage))
Q#35)HowtomousehoveronawebelementusingWebDriver?
WebDriveroffersawiderangeofinteractionutilitiesthattheusercanexploittoautomatemouseand
keyboardevents.ActionInterfaceisonesuchutilitywhichsimulatesthesingleuserinteractions.
Thus,Inthefollowingscenario,wehaveusedActionInterfacetomousehoveronadropdownwhich
thenopensalistofoptions.
SampleCode:
1 //InstantiatingActionInterface
2 Actionsactions=newActions(driver);
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

11/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

3 //howeringonthedropdown
4 actions.moveToElement(driver.findElement(By.id("idofthe
dropdown"))).perform();
5 //Clickingononeoftheitemsinthelistoptions
6 WebElementsubLinkOption=driver.findElement(By.id("idofthesub
link"));
7 subLinkOption.click();
Q#36)Howtoretrievecsspropertiesofanelement?
Thevaluesofthecsspropertiescanberetrievedusingaget()method:
Syntax:
driver.findElement(By.id(id)).getCssValue(nameofcssattribute)
driver.findElement(By.id(id)).getCssValue(fontsize)
Q#37)HowtocapturescreenshotinWebDriver?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

importorg.junit.After;
importorg.junit.Before;
importorg.junit.Test;
importjava.io.File;
importjava.io.IOException;
importorg.apache.commons.io.FileUtils;
importorg.openqa.selenium.OutputType;
importorg.openqa.selenium.TakesScreenshot;
importorg.openqa.selenium.WebDriver;
importorg.openqa.selenium.firefox.FirefoxDriver;

publicclassCaptureScreenshot{
WebDriverdriver;
@Before
publicvoidsetUp()throwsException{
driver=newFirefoxDriver();
driver.get("https://google.com");
}
@After
publicvoidtearDown()throwsException{
driver.quit();
}

@Test
publicvoidtest()throwsIOException{
//Codetocapturethescreenshot
FilescrFile=
((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
//Codetocopythescreenshotinthedesiredlocation
FileUtils.copyFile(scrFile,new
File("C:\\CaptureScreenshot\\google.jpg"));
}
}

Q#38)WhatisJunit?
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

12/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

JunitisaunittestingframeworkintroducedbyApache.JunitisbasedonJava.
Q#39)WhatareJunitannotations?
FollowingaretheJunitAnnotations:
@Test:Annotationletsthesystemknowthatthemethodannotatedas@Testisatestmethod.
Therecanbemultipletestmethodsinasingletestscript.
@Before:Methodannotatedas@Beforeletsthesystemknowthatthismethodshallbeexecuted
everytimebeforeeachofthetestmethod.
@After:Methodannotatedas@Afterletsthesystemknowthatthismethodshallbeexecuted
everytimeaftereachofthetestmethod.
@BeforeClass:Methodannotatedas@BeforeClassletsthesystemknowthatthismethodshallbe
executedoncebeforeanyofthetestmethod.
@AfterClass:Methodannotatedas@AfterClassletsthesystemknowthatthismethodshallbe
executedonceafteranyofthetestmethod.
@Ignore:Methodannotatedas@Ignoreletsthesystemknowthatthismethodshallnotbe
executed.
Q#40)WhatisTestNGandhowisitbetterthanJunit?
TestNGisanadvanceframeworkdesignedinawaytoleveragethebenefitsbyboththedevelopersand
testers.Withthecommencementoftheframeworks,JUnitgainedanenormouspopularityacrosstheJava
applications,JavadevelopersandJavatesterswithremarkablyincreasingthecodequality.Despitebeing
easytouseandstraightforward,JUnithasitsownlimitationswhichgiverisetotheneedofbringing
TestNGintothepicture.TestNGisanopensourceframeworkwhichisdistributedundertheApache
softwareLicenseandisreadilyavailablefordownload.
TestNGwithWebDriverprovidesanefficientandeffectivetestresultformatthatcaninturnbeshared
withthestakeholderstohaveaglimpseontheproducts/applicationshealththerebyeliminatingthe
drawbackofWebDriversincapabilitytogeneratetestreports.TestNGhasaninbuiltexceptionhandling
mechanismwhichletstheprogramtorunwithoutterminatingunexpectedly.
TherearevariousadvantagesthatmakeTestNGsuperiortoJUnit.Someofthemare:
Addedadvanceandeasyannotations
Executionpatternscanset
Concurrentexecutionoftestscripts
Testcasedependenciescanbeset
Q#41)HowtosettestcasepriorityinTestNG?
SettingPriorityinTestNG
CodeSnippet
1
2
3
4
5
6

packageTestNG;
importorg.testng.annotations.*;
publicclassSettingPriority{
@Test(priority=0)
publicvoidmethod1(){
}

http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

13/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

7
8
9
10
11
12
13

@Test(priority=1)
publicvoidmethod2(){
}
@Test(priority=2)
publicvoidmethod3(){
}
}

TestExecutionSequence:
1. Method1
2. Method2
3. Method3
Q#42)Whatisaframework?
Frameworkisaconstructiveblendofvariousguidelines,codingstandards,concepts,processes,
practices,projecthierarchies,modularity,reportingmechanism,testdatainjectionsetc.topillar
automationtesting.
Q#43)WhataretheadvantagesofAutomationframework?
AdvantageofTestAutomationframework
Reusabilityofcode
Maximumcoverage
Recoveryscenario
Lowcostmaintenance
Minimalmanualintervention
EasyReporting
Q#44)Whatarethedifferenttypesofframeworks?
Belowarethedifferenttypesofframeworks:
1. ModuleBasedTestingFramework:TheframeworkdividestheentireApplicationUnderTest
intonumberoflogicalandisolatedmodules.Foreachmodule,wecreateaseparateand
independenttestscript.Thus,whenthesetestscriptstakentogetherbuildsalargertestscript
representingmorethanonemodule.
2. LibraryArchitectureTestingFramework:Thebasicfundamentalbehindtheframeworkisto
determinethecommonstepsandgroupthemintofunctionsunderalibraryandcallthosefunctions
inthetestscriptswheneverrequired.
3. DataDrivenTestingFramework:DataDrivenTestingFrameworkhelpstheusersegregatethetest
scriptlogicandthetestdatafromeachother.Itletstheuserstorethetestdataintoanexternal
database.ThedataisconventionallystoredinKeyValuepairs.Thus,thekeycanbeusedto
accessandpopulatethedatawithinthetestscripts.
4. KeywordDrivenTestingFramework:TheKeyworddriventestingframeworkisanextensionto
DatadrivenTestingFrameworkinasensethatitnotonlysegregatesthetestdatafromthescripts,
italsokeepsthecertainsetofcodebelongingtothetestscriptintoanexternaldatafile.
5. HybridTestingFramework:HybridTestingFrameworkisacombinationofmorethanone
abovementionedframeworks.Thebestthingaboutsuchasetupisthatitleveragesthebenefitsof
allkindsofassociatedframeworks.
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

14/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

6. BehaviorDrivenDevelopmentFramework:BehaviorDrivenDevelopmentframeworkallows
automationoffunctionalvalidationsineasilyreadableandunderstandableformattoBusiness
Analysts,Developers,Testers,etc.
Q#45)HowcanIreadtestdatafromexcels?
TestdatacanefficientlybereadfromexcelusingJXLorPOIAPI.Seedetailedtutorialhere.
Q#46)WhatisthedifferencebetweenPOIandjxljar?
#

JXLjar

POIjar

JXLsupports.xlsformati.e.binarybasedformat.JXL
doesntsupportExcel2007and.xlsxformati.e.XMLbased
format

POIjarsupportsallofthese
formats

JXLAPIwaslastupdatedintheyear2009

POIisregularlyupdatedand
released

TheJXLdocumentationisnotascomprehensiveasthatofPOI

POIhasawellpreparedand
highlycomprehensive
documentation

JXLAPIdoesntsupportrichtextformatting

POIAPIsupportsrichtext
formatting

JXLAPIisfasterthanPOIAPI

POIAPIisslowerthanJXLAPI

Q#47)WhatisthedifferencebetweenSeleniumandQTP?
Feature

Selenium

QuickTestProfessional(QTP)

Browser
Compatibility

Seleniumsupportsalmostallthepopular
browserslikeFirefox,Chrome,Safari,
InternetExplorer,Operaetc

QTPsupportsInternetExplorer,Firefox
andChrome.QTPonlysupports
WindowsOperatingSystem

Distribution

Seleniumisdistributedasanopensource
toolandisfreelyavailable

QTPisdistributedasalicensedtooland
iscommercialized

Application
underTest

Seleniumsupportstestingofonlyweb
basedapplications

QTPsupportstestingofboththeweb
basedapplicationandwindowsbased
application

Object
Repository

ObjectRepositoryneedstobecreatedasa
separateentity

QTPautomaticallycreatesand
maintainsObjectRepository

Language
Support

Seleniumsupportsmultipleprogramming
languageslikeJava,C#,Ruby,Python,
Perletc

QTPsupportsonlyVBScript

Vendor

AsSeleniumisafreetool,userwouldnot

Userscaneasilygetthevendors

http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

15/44

11/29/2016

Vendor
Support

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

AsSeleniumisafreetool,userwouldnot
getthevendorssupportintroubleshooting
issues

Userscaneasilygetthevendors
supportincaseofanyissue

Q#48)CanWebDrivertestMobileapplications?
WebDrivercannottestMobileapplications.WebDriverisawebbasedtestingtool,thereforeapplications
onthemobilebrowserscanbetested.
Q#49)Cancaptchabeautomated?
No,captchaandbarcodereadercannotbeautomated.
Q#50)WhatisObjectRepository?HowcanwecreateObjectRepositoryinSelenium?
ObjectRepositoryisatermusedtorefertothecollectionofwebelementsbelongingtoApplication
UnderTest(AUT)alongwiththeirlocatorvalues.Thus,whenevertheelementisrequiredwithinthe
script,thelocatorvaluecanbepopulatedfromtheObjectRepository.ObjectRepositoryisusedtostore
locatorsinacentralizedlocationinsteadofhardcodingthemwithinthescripts.
InSelenium,objectscanbestoredinanexcelsheetwhichcanbepopulatedinsidethescriptwhenever
required.
Thatsallfornow.
HopeinthisarticleyouwillfindanswerstomostfrequentlyaskedSeleniumandWebDriverInterview
questions.TheanswersprovidedherearealsohelpfulforunderstandingtheSeleniumbasicsand
advancedWebDrivertopics.
DoyouhaveanySeleniumInterviewquestionsthatarenotansweredhere?Pleaseletusknowin
commentsbelowandwewilltrytoanswerall.
=>ThisfinishesnotjustthisarticlebutourcompleteSeleniumtrainingseries.ChecklistofALL30+
tutorialslistedonthispage.Pleaseletusknowyourcommentsandquestions.

a Share 146 d Tweet 5 f +1 30 h Pin 3 k Share 91


RecommendedReadingOnlyForYou:
LearningbasicsofQTPautomationtoolandpreparationofQTPinterviewquestions
37MostCommonLoadRunnerInterviewQuestionsandBestAnswers
Willautomatedtestingtoolsmaketestingeasier?
Softwaretestingquestionsandanswers
QTPInterviewQuestionsandAnswerswithUsefulInterviewTips
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

16/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

WhatisDifferenceBetweenTestPlan,TestStrategy,TestCase,TestScript,TestScenarioand
TestCondition?
HowtoLocateElementsinChromeandIEBrowsersforBuildingSeleniumScriptsSelenium
Tutorial#7

NeverMissAnotherPost
Enteryouremail:

Yes,StartSendingNewPosts

241comments
#1dwarika
Awesomepost
#2rushsun
Excellentblogforseleniumlearners.
#3Jack
Awesomeq&A
#4ShrutiShrivastava
@Dwarika@Rushsun@Jack
Thankyoufortheappreciation..
#5Test
V.gudarticles.
Alotcanbegainedfromtheseartices.
#6Supriya
Excellentanddetailedanswers.IwillbereferringallthesetutorialsforlearningSelenium.
#7Nikesh
AnstoQ#49iswrong.
#8Roopesh
ExcellentArticles..
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

17/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

#9Sweta
NiceandHelpful.
Keepdoingsuchthingstohelpus
#10ShrutiShrivastava
@Test@Supriya@Roopesh@Sweta
Thankyoufortheappreciativewords.
#11Roman
Hi,
Itsaverygoodpost.IthinkaddingQ&Aaboutpageobjectcouldbegreat.Itsawidelyused
patternnowadays.
#12Charan
Thanksverymuch!!!
VeryUsefulandInformative.
#13krishna
goodquestionsandanswersforselenium
#14Brij
Couldyoupleasemakeavideoforhowtoreadtheexcelfile.Also,whenyoucallTestNGa
frameworkthanwhatisthedifferencebetweenTestNGframeworkandregularframework.
Couldyoupleasegiveexampleofimplicitandexplicitwait.
#15Shwetank
Wonderfulcollectionwithamazingexplanation.
#16TaiLe
Greatcollection.
Thankyousomuchforyourcourse:)
#17Thiru
goodpost
#18Jamuna
InformativeOne..
#19Shakun
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

18/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

Goodandhelpfularticle.
Thanks..!!
#20HanumanReddy
ThankyouverymuchforhelpingUS
Wehopethisyearyouwillhavehappiness
#21chiranjeevi
iwanttoknwhowtotestmultipletestsinmultiplebrowsersattimeusinggrid.douhaveany
code.plspostinurwebsite.
#22AnkGupta
Nicepost..canfindallimportantquestionofSelenium
#23hari
Goodcollection.
#24Ashim
Reallyexcellent.Ithelpedmealot.
#25vehla
Katalbaijikatal..
wahsirrajmahesirralati
.
#26sandeepchopra
Awesomenote..Supersebhiupar.:)
#27DeepakRawat
Itsaverygoodcollectionandhelpfulforall.
#28Sibaram
AwesomePostShruti.Thanksforsharing:)
#29Naveen
Thanksforputtingtogethersuchwonderfulpost.Thisisgoingtohelpalotofus.
Justtoaddsomeinformationfor
Q48:CanWebDrivertestMobileapplications?
a)MobileapplicationscannotbeautomatedwithWebDriveralone,Howeverwithhelpofthird
partytooldlikeappiummobileapplicationcanbeautomated.
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

19/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

#30Arun
Thanksalot:)
#31AbhijeetShitole
Verynice
#32Chaitanya
Excellentpost.MaybeyoucanalsoporvidesomeinfoonhowaretheDBconnectivitiesmade
fromthetool.
#33Heshan
ThereisaconflictinQ48.
itshouldbeas:
WebDrivercannottestMobileapplications.WebDriverisawebbasedtestingtool,therefore
applicationsonthemobilebrowserscannotbetested.
AndNicearticle
#34MahidharCh
Itsnicecollection
#35NKiranKumar
Verymuchhelpful.Thanksalot.:)
#36DCS
VeryHelpful,Thanksforsharing
#37NitiPatel
thankyouverymuchforwritingsuchadetailedarticle.Itisveryhelpful:)
#38Anand
Thankyouforthisarticle,itwasveryinformative.
Recentlyihadattendedaninterviewonseleniumwheretheyhadaskedmetowriteawebdriver
programtocountthenumberofhyperlinksinawebpage.Itisalsomostfrequentquestionnowa
days.soplsaddthisquestiontothelistitmightbeusefulforsomeoneelse.
#39Rajani
ExcellentArticaltogainseleniumknowledge.Thankyou.
#40Santosh
Pleasecorrectthesyntaxforquestion28.
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

20/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

InsteadoffindElementitismentionedasfindElements.
#41Anand
Thankyousomuch..
#42prasad
Good
#43NirmalaTajne
Hello,
Verygoodcollectionofquestionsandanswers.Reallyhelpful
#44prakash
verynicearticle,iwantconnectinurcirclesoplzsendurlinkdenid
#45surekha
Thankyou
#46Jitendra
Veryhelpful.Thanksalot.
#47MATS
Averydescriptivetutorial.Thathelpbeginnersgainexpertise.Thankyou!!
#48Asheesh
Thanksforputtingtogethersuchwonderfulpost.Thisisgoingtohelpalotofus.
#49sathya
Thankyou.Veryinformative.
#50hari
Thanksfortheinfo.Veryuseful.
#51Kuban
Thanksverymuch!!!
VeryUsefulandInformative.
#52Vipin
Thankyou..ItisveryusefulforseleniumLearners
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

21/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

#53Sunil
Gr8job.wonderfulpost.Thanksforsharingknowledge.
Keeppostingandupdatingnewquestionstoo
Thankalot:)
#54venkateswarlu
exlent
#55Rajagopal
verygood.Thanks
#56VIKRANT
keeppostingsuchhelpfuldata.Reallyverygoodsetofquestions.
#57ArchanaSingh
verygoodpost.
#58Sram
Iappreciatedyou
#59shailesh
Ihaveoneproblemafterlunchingwebbrowser,iamnotgettingmyURLihavewrittenright
codeonly..???
#60yerriswamy
yesreallyitsveryusefulltoallandalsoeasytounderstandgreatwork
#61DivyanshuRawat
verygoodpost.veryhelpful..keeppostingsuchkindofinformativepost.
#62Jitendra
goodquestionsandanswersforselenium
#63Jitendrakumarpal
ExcellentArticaltogainseleniumknowledge.Thankyou.
#64LynT
Verygoodcompilation!Thanks!
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

22/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

#65TPR
excellentitisveryhelpfulforeveryone
Thankslot
#66Farid
Wonderful..collectionwithamazingexplanation.Thankyou.
#67PratikChirkute
Reallygoodarticle.Keepitup.
#68Vikram
Reallygoodandinformativearticle.Thanksforsharing!!
#69Kiran
Thankyou!
#70yugandhar
verygood
#71VijayaLakhsmi
GoodExplanation
#72chitra
verygoodandhelpful
#73Akshay
VeryhelpfulseriesofSelenium.IwouldrequestSoftwareTestingHelpteamtomakeamobile
appsoanytime,anywherewecanuseit..
Thankyouformakingthisseriesavailableforus.
Iwishallthebestforfuturearticles.
#74Nisha
Itsveryuseful.Verygoodpost
#75Prasanna
thankssir
#76shashank
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

23/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

Coveredallthebasiclevelseleniumquestionsaskedininterviews.Helpsinquickrevision.Good
JobTeam.Keepupdating!
#77Ranjith
VeryHelpfulinformationthankyou
#78AnilAlluri
Hi,
Thisishelpfulforseleniumstudents.InQ22havesomewrongstatement.pleasecheckthisasa
report.
thisisSelected():
booleanbuttonSelected=driver.findElement(By.id(gbqfba)).isSelected()
#79Rohit
Toomuchuseful&sharpanswerswithavalidpoint!!
ThankYou.
#80Andy
Conciseandtothepoint,justwhatIneededtogetmymojotostudyselenium:)
#81BharathUrs
Averygoodarticle/referencesonselenium.
Thankyou:)
#82sandip
averynicearticallikeit
Thankyou
#83Shahrukhkhan
Nicetutorial
#84Nirmala
WebDriverdriver=newChromeDriver()
WebDriverdriver=newInternetExplorerDriver()wecannotlaunchInternetExplorerandChrome
driverdirectlyusinhinstance.weneedsetsystemproperty
#85Nirmala
Q#31)CanSeleniumhandlewindowsbasedpopup?
WecanhandlethewindowpopupusingAUTOIT
#86ASIFAlberto
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

24/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

Thanks:)
Somuchhelpful:)
keepposting..
#87shivappa
verygoodonemoreonbasics
#88Bhawna
GoodOne!!
#89PrakashKerlekar
Verygoodarticle.
PleasekeepsharingTestingknowledge.
Thanku
#90zubita
MobileTestingispossibleandcandoneusingsele,,
#91Robin
Veryhelpfulandappreciateyourwork
thankyou
#92Yatin
Veryhelpful.
Thankyou
#93KeshavNarayanDhakane
Best,Welldescribed
#94JustPassingBy
Greatarticleforbeginnerslikeme!
Thanks
#95Sumanth
Ijusthavereadthisarticleandattendinganinterviewforautomation..Trulywonderfularticle
#96Anish
seleniumserverstandalonejarcontainsallthelibraryfilestorunautomationscriptsthenwhydo
weneedtouseseleniumjavajars?
#97radhakrishna
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

25/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

VeryhelpfulThanks!!
#98Sinhala
Veryinformativearticle,Thanks
#99AmritaGautam
ThanksItwasaveryhelpfularticle
#100TCK
Q32)Insteadofdismissintheexplanationyouvewrittenaccept()forbothaccept()aswellas
dismiss().Apartfromthis,theArticleissuperb.
voiddismiss()Theaccept()methodclicksontheCancelbuttonassoonasthepopupwindow
appears.
#101sridhar
veryniceandinformativearticle
#102SenthilKumarDevaraj
ReallyGoodPostTeam..!WorthvisitingthePage.!
#103MnhNguyen
Usefularticle.Keepgoing!
#104MinhNguyen
Nicearticle.Ireallyappreciatewithit!
#105vishwa
superb
#106anusha
Thankyouverymuchsir
#107Muthupondi
Veryusefulpost.Thankusomuch
#108MurtazaMansoor
simplyawesome
#109MurtazaMansoor
extremelyusefulpost.Thanks
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

26/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

#110sivaram
Hey,
youguysneedastandingovationforprovidingawesomestuffforfreeofcost.Thanksbuddies:)
#111Mani
ThankyouverymuchReallyveryuseful:)
#112DilRice
Itisveryhelpfulandgoodarticle..Thankusomuch
#113Suresh
Itsgoodarticle
#114Basant
HiTeam,
Thanksforyourefforts.
Ihadaquerywhichifacedduringaninterview,heaskedmethatifawebelementisnothaving
anylocatorsormanyofwebelementsarehavingsameattributes.Thenhowtoretrievethe
informationofaparticularelement.
#115Yugi
Explanationissuperandeasytounderstand.tq
#116Ganesh
Seleniumversionanddateofreleaseitwillhelptoknowaboutseleniumfrombegning.
#117hari
veryhelpfulandgoodarticle..
Thankusomuch:)
#118Savitri
Hi,
Theabovearticleisveryusefultoknowtheimportantquestionsaskedintheinterviews.ButIfyou
canexplainmoreaboutobjectrepositorythenitwillbeagreathelp.
Thanks,
Savitri
#119shivsagar
Hi,
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

27/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

Thatwasaexcellentcollectionofquestions.Great:)
#120kiran
Hi,
GoodExplanationandeasytolearn.thankuuuuusoomuch.
Regards,
kiran
#121AshokKumarVerma
Hi,
IwanttouseWebDriverdriverobjectintwoormoreclasswithoutopeningmorebrowser
open.AlsoanybodyprovidetheformatofTestNGcodeasperabovemention.
::
moreclassusesamedriversamebrowserwithtestngannotation
#122Amit
AbovequestionsareveryhelpfulandIthinkyoushouldaddsomeadvancedlevelquestions.Ihave
beenaskedquestionsininterviewlike:
Whataretheproblemsyouhavefacedwhilescriptinginseleniumandhowdidyouresolve
them.
WhataredisadvantageofPOM.
whatisdesiredCapabilities
QuestionsfromTestNG.
#123RAVI
Ihaveaquestion.
Question.
Supposeyouhaveautomatedallthe1000testcases.Ifclientaskedtoruntwotestcasessuppose
thoseare576and598.Thenhowwillitperformed?
#124Jagan
Hello,
Thisisveryhelpfulforustorushintointerview.Thanksforpostingsuchawonderfulnotesand
makingtheinterviewseasythanku.
#125Mahesh
Helloteam,
YouvemistakenlymentionedseleniumRCisintroducedtoovercomeSameoriginpolicyin
questionno.14.
But,SameoriginpolicyistheonlyreasontoavoidusingSeleniumRCandbecauseofthatthey
introducedWebDrivertoovercomethisproblem.
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

28/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

Pleaseupdatethesame,ifIamnotwrong.
#126dheerajsaurabh
thisisveryhelpfulforus..
#127suraj_pp
Excellentarticle.Thanksamillion.Itsbeenveryhelpful.
#128sirishakumari
Howtoexplainautomationlifecycle?and
whatisactualautomationprocess(selenium)inpractical?
plzmailme
#129VIKASH
Howtohandlescrollupandscrolldowninseleniumwebdriver?
Plzadvice.
#130NareshKumarDavuluri
Thanksatonforthesequestions.Theyreallyhelp.
Youcouldalsopleaseincludetheseaswell:
51.Whatisthedifferencebetweendriver.get()anddriver.navigate().to()commands?
52.Cantweuse
FirefoxDriver()driver=newFirefoxDriver()insteadof
WenbDriverdriver=newFirefoxDriver()
#131SHIVAKUMAR
ReallyGreatworkcarriedbysoftwaretestinghelpteam!!!!!keepitupthegoodwork!!!
Articleswerereallyhelpful.
Thankyouverymuch:)
#132NareshGajula
Verygoodquestions(withans).Thankyousomuchforhelpingmany!!
#133Raj
UsingAppiumwecanautomateMobileapplicationswithSelenium.
#134DipeshJain
Veryniceexplanation.
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

29/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

#135nagabhushanam
Verygoodquestions(withans).Thankyousomuchforhelpingmany!!
#136Smitha
Howtoautomate/testforthebanners(advertisementsthatkeeprollingonthewebpage)?Isthis
possible?
#137Smitha
Howtotest/automatethebannersonthewebpage?
#138Deepali
Reallyverymuchinformative..
#139A
Littleunclearon48thanswer
#140Deepu
InSeleniumIDEIamwrittinganprogramtogeneratetheordernumber.SothenexttimewhenI
runitthrowsanerrorbecauseithasthesameOrdernumber.Howtohandlethis
#141TejeshwarJaiswal
Hi,IwanttoknowdatadriventestingusingwebdriverthroughexcelsheetandCSVfile.
Couldyoupleasehelpitout.
#142pavan
Awesomeintroductiontobasicsofselenium,ifpossiblepostsomemorerealtimechallenging
interviewquestions.
LikeComparingthelogoonwebpage,Tocrossverifythewebpageopenediscorrectornot,to
checkhowmanyadvertisementwindowsopenedin1webpage,countingnumberofelements
presentonwebpagewith1lineofcode.
#143Nagappan
ThankyouSoMuch!!!
#144Navaneetha
IhavereadsomewherethatSeleniumWebDrivercouldbeusedtotestMobileapplicationsaswell.
Isthattrue?
#145Jain
AwesomeknowledgeonSelenium,verycrispandpointtopoint.
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

30/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

#146ArchitJain
AwesomePost.Thanksalot!
#147chandrashekar.k
Hi,
Thisiswonderfulpostbutcanyoupleaseletmeknowwhatallconceptsaremustformetocrack
anyinterviewforSelenium.Thanksinadvanceforyourresponse.
#148Neha
Verypreciseandaccurate.Thankyouforpostingit:)
#149sourabhp
great
#150Samps
whatisthemajordifferenceinbetweenrelativevsabsolutexpath..
Forexample:
.
1sttimemyxpathis>.//*[@spellcheck=false]
thiscaseitwillbeshown2matchingnodes..andsecondtimeimfilteringthisxpathto>
.//*[@spellcheck=false][@id=Email]thistimeihaveonlyonematchingnodesoicansay
thisisabsolute!
#151Sureshk
DonowthePOMframework.Supriya
#152amy
VeryniceQNA
#153Vivek
AwesomePost!!!
Verygoodforseleniumleaner..
#154Santanu
MobileappscanbetestedaswehaddoneitforAndriod,HTML5,Windows,Blackberryandto
someextentiOStoowaybackin2011to2013.
Reallysurprisinganswer.
#155Sam
Hi,
Nicepost,Iwouldalsoliketoaddfewinterviewquestionswhichihavefacedinrecenttimes
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

31/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

Crossbrowsing
ConnectionstoDatabase
WindowHandlings
AboutFramework
AboutContIntegrationtoolandbuildtools
challenges
#156Kannan
OnQ#32,
voiddismiss()Theaccept()methodclicksontheCancelbuttonassoonasthepopupwindow
appears.
Intheabovesentence,thewordaccept()shouldbereplacedwithdismiss().
#157Megha
GoodPost,helpfull
#158Manikanta
Excellentarticle
#159SDP
GoodandHelpfulpost
#160PiyushKulkarni
Nicearticle!!
Butthereisonemajorpartismissingthatisdatadriventestingindetail:
1.Using.csvfile
2.Dataprovider
3.Usingexcelfile
#161TestingGoddess
Youareamazing!But,youneedtoreadtheabovecommentsandmakenecessarychangesinthe
article.
#162NavnitMishra
PleasecheckyourbrowserversionwithrespecttotheDriverversionandthenruntheprogram.
#163RajatTrikha
IrealylikethepostandsinceIhavesomebasicunderstandingofselenium.Soiwasabletolink
everyanswerwithmyunderstanding.
Lookforwardformoresucharticles.
#164khushbu
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

32/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

Thanksforsharing.Itwasveryuseful.
#165SwethaM
AwesomeinformationaboutSeleniumItisveryusefulforSeleniumlearners
#166Shiv
ManyAnswersarewrong.e.gdifferenceb/wimplicitwaitandexplicitwait
#167AbhishekBhandary
Actuallymyproblemisthatihaveusedjavascriptexecutortofindtheelementbyidbutidofthat
elementhastochangeeverytimesoiknowinthatcasedynamicxpathshouldbeusedbutresultis
comingwithsomeerrorsocanyouhelpmehowtowritedynamicxpathinjavascriptexecutor.
#168R
Excellent,thankyoufortheinformation
#169Ashu
CanyouexplainImportorg.openqa.selenium.WebdriverasWebdriverisInterfaceandorgopenqa
seleniumwhatarethey?
#170anilkanpan
itreallywonderfullinterviewQ/Aforfresher
#171DavinderSingh
ThanksforexplainingallquestionshoweverijustwantedtoaskyouaboutJenkinsifpossiblefor
you.
#172onlineseleniumtraining
thanksforlistingimportantquestionsandanswers
#173Shwetha
Thankyouverymuchforthisinformation.Everythingwasprecise.Itwasveryhelpful!
#174sudha
ReallygoodandHelpfullTrytogivethebasiccodeforsomequestionslikedatareadingExcel
sheetetc
Thanksalot
#175Guru
Awesomearticle!Thanksalotfortheshare.
Iwouldonlyrequesttheauthortokeepituptodatefromtimetotime.Willbereallyhelpful!
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

33/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

#176sachinduve
Hi,howdowecreatebatchfile(.bat)toexecuteseleniumtestsuitewhenweareaddingjar/library
filesusingMavendependencies.
#177Manishasah
yourQ#48)CanWebDrivertestMobileapplications?
answeriswrongwecanuseappiupwithwebdrivertotestmobileapps.
#178MehulMistry
VeryGoodArtical,KeepDoingthis
#179A.Sivaprasad
thisinformationisveryusefullforme
#180Dirk
YouranswersforWaitsiswrong.
#181ExcellentInfoandveryeasytoget
Thankyou
#182parilshah
hi@shruti.howru?
#183parilshah
himanisha,neha,smitha,deepali
howruall?
#184Rajanireddy
verynice
butaddfewmorequestionsandanswers
#185Yuvaraj
Whichtestcaseshouldnotbeautomated?
#186Akashsaini
Thisisagreatpost.goodforgettingaquickrevision.
#187Anbarasu
HiShruthi,Thisisreallyhelpfultonewlearnerandtheycanbeeasilyabletounderstoodabout
selenium.
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

34/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

Thanksforthispost..
Haveagreatfuture.
#188SharadJadhav
ReallyniceandhelpingtothenewlearnersasAnbarasuMsaidabove.
Iappreciateandrequestyoutopostmorequestionswitheasyanswers.
Ihopeyouwillpost.
#189suresh
howtocountnoofcheckboxesarecheckedorunchecked
#190AjayLanjewar
Thisisverygoodarticleforbeginners.
#191AjayLanjewar
Thisisverygoodarticleforbeginners.Thankyousomuch.
Regards,
Ajay
#192DarrenBroklyn
Q
WriteyourgherkinformatandrunittocreateyourStepdefinition.Howdoyouknowyourtesthas
passed?
#193Yogesh
Thanksforsharingyourknowledge.
InthetypesofframeworkIcouldnotseePageobjectmodelwhichisusedextensivelyacrossthe
market,pleaseincludematerialsregardingPOMframework.
#194Pouli
Thanksverymuch!believemeansweredallmyinterviewquestionfromthisblogasfaras
seleniumconcerened!
Keepitupadmin!
#195Anuradha
Veryhelpful.
#196Manju
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

35/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

Goodone!!!!!!!
#197Sandy
GoodArticlelikedit
#198Anoop
HowtohandleversionsoftestsinSelenium?
#199SachinChorghe
Thisisreallyhelpfulforbeginners.Thankyouforsharingknowledge.
#200KRavi
HelloSir,
Oneclarificationtestersarerequiredforbigcompaniesorsmallcompanies?
Anyneedoftestersinacompany,ififhowfor..whatisourpreference
Whyallareaskingexperienceandofferslowsalary.
Pleasegiveans.
Thankyou
#201MukeshSinghRajput
Awesome!!
Thisisagreatpost.goodforgettingaquickrevisionindetail.
#202Rumpa
Awesomepost..Thankyou
#203mahendra
pleaseanyoneexplainingframeworksandhowtoimplementframework,jarfilesandtestngfiles
inproject
pleaseexplaining
thankingyou..
#204SantoshKumar
ThereisonecorrectioninapartofQ.No.25.Itsaysthatnavigate().to()Thiscommandletsthe
usertolaunchanewwebbrowserwindowandnavigatetothespecifiedURL.
Correction:navigate().to()doesntalwaysopenanewwindow.Ifbrowserisalreadyopened,itjust
navigatetothespecifiedURLinthesameopenwindow.
#205eaccmk
NicelyarticulatedintheformofQA.
BestpartisCodeSnippetwithcomments,thnx!
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

36/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

#206Bhaskar
Ilikethisarticle,verygood
#207Lalitha
Thankyou,itwasneatandclear
#208Shaifali
howtofindxpathofachildelementifwebpagedonthaveanyid,nameoranyotherlocator?
#209Udhay
goodcollection.
#210arjun
hisir
howtohandlecaptchaandbarcodepleasereplysir
#211Nikhil
Veryinformativearticleandreallyhelpfulforbeginners
THANKYOU
#212Rubal
selenium200plzhelpmehowtouseaaa
#213SharmilaKulkarni
AwesomeArticle,thankyou!
#214priteebanerjee
pleasepleaseanswertothisquestionineedthistonightbcozihvinterviewtomorrow..
Qus:howreportingdoneinautomation??
Qus2:whatarethebuildintoolsuseinautomation??
#215KhanhDo
Thanksforyourarticle.Ithelpsmealot.
#216rakesh
AtQ#22)Howcanyoufindifanelementindisplayedonthescreen?
Isthebelowmethodexplanationistypoerrororwhat?
isSelected():
booleanbuttonSelected=driver.findElement(By.id(gbqfba)).isDisplayed()
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

37/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

Iguessitshouldbe:
booleanbuttonSelected=driver.findElement(By.id(gbqfba)).isSelected()
PleasecorrectmeifIamwrong.
#217sreenivas
Reallyverygoodinformation,thankyousomuch..:)
#218khosruzzaman
IamnotClearaboutFrameWorkQuestion?
#219priyanka
howtoautomatescrolldownusingseleniumwebdriver?
#220RohitSinhaShrivastava
Istartedlearningseleniumsome1monthsbackandbelievemewhateveryouhavepostedhave
helpedmelottoacquireproficiencyinselenium.
Ithinkyourpostisphenomenalforinterviewpurposeanditsalsoasynopsisofseleniumoverall.
Keepitupandkudostoyouforyourefforts.
CheersShruti!!!..:)
#221AdityaBarbadikar
ExcellentArticle
#222PriyaShanthiJandla
GoodArticle.Veryinformative
#223R.ashok
HowdoyouhandletheFrameworks?.
explaintheHybridArchitecture?
#224Malika
Greatcollectionofquestionsandanswers.Thanksforputtingthemalltogether.
Thanksagainforyourtimeandhardwork.
#225ManmohanSingh
Yourpostismostlyuseless!
Thetestngvsjunitquestiondoesnottellushowthetwoaredifferent.Insteadtherearealotof
unrelatedpointslikeopensourceinthatanswer.Lookslikeyougetpaidbytheword.
#226lakshminarayana
guysihaveaquestionthatigotfrominterview.Theinterviewerwasaskingme
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

38/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

lia
lia
a
a
hegavemeDomStractureandaskedmewhatisthexpathforvaluea?
iwastotallyconfusedandiinspectedtheelementsandgivenvalueofxpathtoaas=
//@magicdom#@!/*&/
cananyonesolvemyproblem
#227STTA
Interviewercanaskbelowgivenquestiononcorejavapoints.Preparethesethingbeforeinterview
1.Interface
2.Inheritance
3.String
4.Collectionframework
#228Swapnil
WhichinstallationrequiredforseleniumwebdriverusingC#Invisualstudio,Pleasegivemethe
detaillistofinstallationsstepbystep.
#229PunithTS
Thanksalotbuddy..Greathelpforthosewhojustwanttoquicklylookupsomequestions..
#230Nagendra
Niceeasytoremberredthnq
#231Rishikesh
Excellent,Reallyawesomearticle!
#232Nasara
Verysimplequestions..normallythestandardofquestionsininterviewisgreaterthantheone
mentionedhere
#233vikasreddy
goodexplanationgoodjob
#234Kanna
awesomearticle
#235Vishwajeet
Salute!
#236Bibhishan
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

39/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

Whatagreatarticleits!!terrific!!
#237Premkumar
Writeascripttochecktheusernamefieldwhichshouldonlyaccept4digitorcharecter
#238Sabrine
Perfect!thankyou
#239Madhu
Thanks..veryuseful..
#240divs
Usefularticle.Gotinterestinlearningseleniumonmyownafterreadingthis
#241Raman
Thanks!VeryHelpful.

LeaveaComment
Name
Mail
Website(Optional)

Submit

STARTHERE!
Home
GetFREEUpdates
TestingRESOURCES
QATestingTRAINING
PremiumeBook
FREEeBooks
ALLArticles
ContactUs
WhatReadersSayAboutUs
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

40/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

YourFeedback!

Help&Tutorials
ISTQBStudyGuide
ISTQBPremiumStudyGuide
FreeQATraining
FreeSeleniumTraining
FreeQTPTraining
FreeQCTraining
HPLoadRunnerTutorials
JIRATutorials
101+InterviewQuestions

FollowUs!

Adv

http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

41/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

Categories
AgileTesting
AutomationTesting
BasicsofSoftwaretesting
BugDefecttracking
CareerinSoftwareTesting
CookieTesting
CrowdsourcedTesting
DatabaseTesting
GameTesting
General
GUITesting
Howtobeagoodtester
HPQualityCenter
InstallationTesting
Interviews
ISOstandards
ISTQBCertification
LoadRunnerTutorials
ManualTesting
MobileTesting
PerformanceTesting
QAcertifications
QAforum
QAleadership
QAteamskills
QATestengineersPayscale
QTPTutorials
Qualityassurance
Questions&answers
Reviews
Securitytesting
SeleniumTutorials
Softskillsfortesters
SoftwareJobOpenings
SoftwareTestingBooks
SoftwareTestingEvents
softwaretestinglinks
SoftwareTestingResume
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

42/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

SoftwareTestingTemplates
SoftwareTestingTools
SoftwareTestingTraining
TestManagementTools
TestPlanTemplate
Teststrategy
TestervsDeveloper
Testingbestpractices
TestingConcepts
TestingInterviewquestions
TestingLifecycle
TestingMethodologies
TestingNews
TestingSkillImprovement
TestingTipsandresources
TestingWebServices
Typesoftesting
WebTesting
Winrunner
WriteForUs
Search

Aboutus|Articles|Contactus|Directory|Affiliates|Advertise|TestingServices

DownloadFreeeBook+GetBlog

Allarticlesarecopyrightedandcannotbereproducedwithoutpermission.
Updates

PrivacyPolicy|LinktoUs

20062015SoftwareTestingHelpReadourCopyrightPolicy|
YourEmail:

LatestArticles!
3WorstDefectReportingHabitsandHowtoBreakThem
TheCompleteBeginnersGuidetoResponsiveWebDesignTesting
10WorstThingsaCriticWouldSayAboutYourSoftware
TestLodgeTutorialHowtoOrganizeYourSoftwareTestingProjectsUsingTestLodge
TestManagementTool
HowDoYouDecideWhichDefectsareAcceptablefortheSoftwaretoGolive?
9WaystoQuicklyImproveYourWritingSkillsasaSoftwareTester
AppiumTutorialHowtoPerformAutomationTestingofAndroidAppsonaniOSSystem
http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

43/44

11/29/2016

50MostPopularlyAskedSeleniumInterviewQuestionsandAnswersSeleniumTutorial#33

BestOnlineTraining

http://www.softwaretestinghelp.com/seleniuminterviewquestionsanswers/

44/44

You might also like