Selenium IDE Basics
-
What is Selenium IDE ?
- Selenium IDE (Integrated Development Environment) is an ideal tool used to develop selenium test scriptsIf you are getting a message, “Video is Unavailable” it means that the loading of the video is timing out. It’s almost and always related to a client connection problem.
- Which allows us to record user actions on browser window.
- It operates as a Mozilla Firefox add on and provides an easy to use interface for developing and running individual test cases or entire test suites.
- An open source functional automation tool.
- All of the above
Ans: 5
-
How do you open/start selenium-ide after installation ?
- Goto Start > All Programs > Selenium IDE
- First launch/open firefox browser and then click on ‘Tools’ tab in the menu bar and click Selenium IDE
- Click Shortcut option on the Desktop
- None of the above
Ans: 2
-
Features of selenium IDE ____
- Its main feature is record and playback
- Identifies element using id, name, xpath etc
- It has an option of asserting title of every page automatically
- It has a feature of exporting testcase/suite into different formats like C#, Java, Ruby, Python
- All of the above
Ans: 5
-
Selenium IDE runs in ____ browser
- Chrome
- IE 8
- Safari
- Firefox
- Netscape
Ans: 4
-
Selenium IDE can execute scripts created in ____
- Selenese only
- JAVA
- C#
- Ruby
- Python
Ans: 1
-
Selenium IDE can not upload files.
- TRUE
- FALSE
Ans: 1
-
Selenium IDE directly does not support Loops and Conditions
- TRUE
- FALSE
Ans: 1
-
Selenium IDE can read external files like ….
- .txt files
- .csv files
- Can’t read
- .xls files
- None of the above
Ans: 3
-
Selenium _____ are the way of finding HTML element on the page to perform Selenium actions
- xpath
- locators
- element id
- None of the above
Ans: 2
-
We use ____(for firefox) to identify elements
- Object Spy
- HTML DOM
- xpath
- Firebug
Ans: 4
-
What is selenese ?
- Selenium set of commands
- A type of language
- Scripting language
- All of the above
Ans: 1
-
____ is used when the expected value is mandatory to continue with next set of steps
- Verify
- WaitForText
- C#
- Assert
- VerifyText
Ans: 3
-
____ is used when the expected value is optional to continue with the next set of steps
- Verify
- Assert
- VerifyText
- WaitForText
Ans: 1
-
Can tests recorded using Selenium IDE be run in other browsers?
- Yes
- No
Ans: 1
-
What kind of application is the Selenium IDE?
- Windows Application
- Web application
- Firefox add-on
- None of the above
Ans: 3
-
A Selenium IDE test case has three columns, Command, Target and Value. What data is stored in the Target column?
- Element or location where the command is executed
- Test step execution result
- [Optional] purpose of the test step
- None of the above
Ans: 1
-
By default, in which format does the Selenium IDE save a test case?
- In proprietary format
- As HTML
- As Java source code
- As Ruby or Python or C# code depending on user options selected during installation
Ans: 2
-
What features are available in Selenium IDE to debug an automated test case?
- Toggle Breakpoint
- Pause/ Resume
- Step
- All of the above
Ans: 4
-
What is the Selenium print command?
- echo
- alert
- System.out.println()
Ans: 1
-
What is the difference between a command and the same command with “AndWait” (e.g. click and clickAndWait commands)?
- Selenium waits indefinitely for the result of the “AndWait” command.
- It waits for the result of the “AndWait” command but only for 30 seconds (default timeout).
- It waits for the result of the “AndWait” command but only up to a maximum of 30 seconds (default timeout).
- Some commands do not have an “AndWait” command, so this question is incorrect.
Ans: 3
-
What is the correct syntax to access the value of a Selenium variable called name?
- name
- $name
- {name}
- ${name}
Ans: 4
-
In which associative array does Selenium store all of a test case’s variables and their respective values?
- Array
- storedVars
- var
- There is no such array in Selenium.
Ans: 2
-
Where can you create your own Selenium commands?
- This is not possible.
- In user-extensions.js file
- In any JavaScript file, but the preferred name is user-extensions.js for consistency
- In any Java, C#, Python, Ruby, PHP or Perl file
Ans: 3
-
What is the purpose of the Find button?
- Highlight the element that is given in the locator
- Search the appropriate command for the given target
- Find the current value of the target
- None of the above
Ans: 1
-
Why are relative XPaths preferred over absolute XPaths as locators?
- For non-root elements, absolute XPaths are longer and slow down the test automation.
- Absolute XPaths fail if any part of the path changes even slightly.
- Relative XPaths are the default in Selenium.
- None of the above
Ans: 2
-
What is the best way to handle asynchronous data retrieval from the server as in AJAX applications?
- Run the test case at the slowest speed.
- Use the pause command.
- Use the “AndWait” commands.
- Use the “waitFor” commands.
Ans: 4
-
What happens when the application creates a JavaScript alert during test case play?
- The alert is suppressed by Selenium..
- If there is no command to handle the alert, the play is stopped with an error.
- If the alert is handled with assertAlert, assertAlertPresent or verifyAlert, no alert is displayed and there is no error.
- All of the above
Ans: 4
Selenium IDE Basics
-
What is Selenium RC?
- Selenium RC starts up browsers(one at a time) and then runs commands we pass along from our tests
- It allows us to use a programming language for maximum flexibility and extensibility in developing test logic
- It provides an API and library for each of its supports languages like Java, Ruby, Python, Perl and C#
- All of the above
Ans: 4
-
Selenium RC components are ___ Selenium server Client libraries
- Selenium
- Grid
- Both
- 1 & 2
Ans: 4
-
Selenium Server launches and kills browser
- TRUE
- FALSE
Ans: 1
-
____ provide the interface between each programming language and the Selenium RC server
- Selenium RC
- Client libraries
- Selenium Server
- None of the above
Ans: 2
-
Why selenium RC is used ?
- Used to automate web applications with more effective browser actions when compared to Selenium IDE
- We can handle multiple windows and pop-ups, we can use loops and conditions, capturing screenshot etc
- RC can perform Data-Driven (read/write data from external files) concept, decent report generation and mailing
- All of the above
Ans: 4
-
What are the languages and operating systems that support RC ?
- Java
- C#
- Perl
- Python
- All of the above
Ans: 5
- Sleep() method is used ___
- To pause the test execution untill the time provided in sleep method
- To stop the test
- To set the time of delay which will follow each and every selenium command
- None of the above
-
How do you select second value from a drop down menu ?
-
String a[]=selenium.getSelectOptions(locator of drop down);
-
selenium.select(""locator of drop down"", a[2]);
-
selenium.select("locator of drop down", "value);
-
"String a[]=selenium.getSelectOptions(locator of drop down);
-
selenium.select(""locator of drop down"", a[1]);
- None of the above
Ans: 3
-
-
What are the frameworks available in RC ?
- JUnit
- NUnit
- TestNG
- Bromine
- All of the above
Ans: 5
-
How do you run selenium commands in slow motion in Selenium RC?
- Thread.Sleep
- Selenium.SetSpeed
- Wait()
- Both 1 & 2
Ans: 4
Ans: 1
JUnit
-
What Is JUnit?
- It is a software testing framework to for unit testing.
- It is written in Java and designed to test Java applications.
- It is an Open Source Software
- All of the above
Ans: 4
-
How To Write a Simple JUnit Test Class?
-
"import org.junit.*; public class HelloTest { @Test public void testHello() { String message = ""Hello World!""; Assert.assertEquals(12, message.length()); } }"
-
"@Test public void testHello() { String message = ""Hello World!""; Assert.assertEquals(12, message.length()); }"
-
"public class HelloTest { @Test public void testHello() { String message = ""Hello World!""; Assert.assertEquals(12, message.length()); }"
- None of the above
Ans: 1
-
-
Why Not Just Use a Debugger for Unit Testing?
- Debugger is designed for automation unit testing
- Debugger is designed for manual debugging
- Debugger can be used for unit testing
- All of the above
Ans: 2
-
Do You Need to Write a Test Class for Every Class That Need to Be Tested?
- Yes
- No
Ans: 2
-
How to create a Test Suite using JUnit in Eclipse?
- Select File > New > Other… > Java > JUnit > JUnit Test Suite.
- Select the arrow of the button in the upper left of the toolbar. Select Other… > Java > JUnit > JUnit Test Suite,
- Right click on a package in the Package Explorer view in the Java Perspective, and select Other… > Java > JUnit > JUnit Test Suite,
- You can create a normal Java class, but include junit.framework.TestSuite as the super class of the test class you are creating.
- All of the above
Ans:5
-
How to Run a JUnit Test Case in Eclipse?
- You can right click on the test case class or test suite class and select Run As > JUnit Test.
- You can select a test case or suite and click the arrow on the icon or select Run from the toolbar, and select Run As > JUnit Test.
- Both 1 and 2
- None of the above
Ans: 3
-
ANT is a ___
- Build Tool Only For Java.
- Build Tools Only For .Net
- A language
- Build Tool
Ans: 4
-
How to make build directory in XML file?
- None of the above
Ans: 3
-
Which one is the properties of the Ant?
- Basedir
- basedir
- rootdir
- None of the above
Ans: 2
-
Which one is not a properties of the Ant?
- ant.java.version
- ant.version
- ant.create
- ant.home
Ans: 3
-
Which one is true method for message printing in xml file?
- printf
- println
- echo
- None of the above
Ans: 3
-
We can execute the class file with help of Ant?
- TRUE
- FALSE
Ans: 1
-
What is Stand for is Ant VM?
- Account Virtual Machines
- Accountable Virtual Machines
- Amountable Virtual Machines
- All of the above
Ans: 2
-
How to set the Source directory in Ant?
-
<Property name="dir.src" value="src"/>
-
<property name="dir.build" value="biuld"/>
-
<property name="dir.src" value="src"/>
- None of the above
Ans: 3
-
-
Ant Can make directory with relative path?
- TRUE
- FALSE
Ans: 1
-
Which one is the sign of path seperator in Ant?
- .
- ;
- ,
- :
Ans: 3
-
Can manual tester develop tests in Keyword Driven Framework?
- Yes
- No
- May be
- None of the above
Ans:1
-
Can you define different function libraries in Keyword Driven Framework?
- No
- Yes
- May be
- None of the above
Ans: 2
-
Each keyword related to a function defined in function library. Is this statement True?
- May be
- FALSE
- TRUE
- None of the above
Ans: 3
-
While Designing Keyword Driven Framework we can map keywords at ___
- Operation level
- Functional level
- Both Operation and functional level
- None of the above
Ans: 3
-
What are the common components of Keyword driven framework?
- Excel Sheet to Store the Keywords
- Function Library
- Test Control file
- Test Scripts
- All of the above
Ans: 5
-
What is Driver script in framework?
- Script is used to initialize and read the control files
- Consists details of all the Test scenarios to be automated.
- Driver Script reads the Test Case files. Checks the keywords and calls the appropriate utility script functions based on specific keyword
- None of the above
Ans: 3
-
Which of these WebDriver interface methods is used to open a URL in the browser?
- get
- navigate().to
- Any of the above
- None of the above
Ans: 3
-
What is the difference between WebDriver close and quit methods?
- Nothing, these methods are interchangeable.
- close method clears the browser memory and the quit method closes the browser window.
- close method closes the browser but the quit method additionally removes the connection to the server.
- close method closes the main browser window but the quit method closes all the browser windows including popups.
Ans: 4
-
When invoked on a web element, what does the submit method do?
- It is used to submit a form and it works on any web element.
- It is used to submit a form but it works only on the web element whose type is “submit”.
- It is the same as the click method.
- There is no submit method for a web element.
Ans: 1
-
Which WebDriver method is used to change focus to an alert, a web element or a browser window?
- changeFocus
- switchTo
- goTo
- setFocus
Ans: 2
-
What functionality does WebDriver support on browser cookies?
- add and delete an individual cookie
- delete all cookies
- Any of the above
- None of the above
Ans: 3
-
What is the scope of an implicit wait?
- All instances of WebDriver
- Current WebDriver instance
- Current expected condition
- Current web element
Ans: 2
-
What is Selenium Webdriver?
- It is an API
- A tool for writing automated tests of website
- Successor of Selenium RC
- All of the above
Ans: 4
-
Which browsers does Webdriver support?
- Chrome
- Internet Explorer
- Firefox Opera
- All of the above
Ans: 5
-
What are the advantages of webdriver?
- Unlike RC you don’t have to start a server in webdriver
- Tabs and pops are more or less the same. RC can also handle and Webdriver can also handle.
- Simulate key press events of keyboard.
- Better features for Ajax testing.
- All of the above
Ans: 5
-
How to create instance of firefox driver using webdriver?
-
driver = new FirefoxDriver();
-
driver = FirefoxDriver();
-
driver = new Firefox;
- None of the above
Ans: 1
-
-
What are the external files which will be required to develop Keyword driven framwork?
- TestNG
- JXL/POI
- JUnit
- TestNG plugin for eclipse
- All of the above
Ans: 5
-
What is the purpose of TestNG component in Keyword driven framework?
- in order to data drive our test
- in order to read excel file
- requires to verify conditions
- None of the above
Ans: 1
-
JXL/POI jar files are required to _____.
- requires to verify conditions
- in order to use Microsoft Excel files as data source
- in order to data drive our test
- All of the above
Ans: 2
-
How to create an instance of WebDriver?
-
WebDriver driver = FirefoxDriver();
-
WebDriver = new FirefoxDriver();
-
WebDriver driver = CreateObject FirefoxDriver();
-
WebDriver driver = new FirefoxDriver();
Ans: 4
-
-
How to navigate to the ITeLearn home page?
-
Webdriver.get("http://www.itelearn.com");
-
driver.navigate("http://www.itelearn.com");
-
driver.get("http://www.itelearn.com");
- None of the above
Ans: 3
-
-
How to find an element by Name?
-
WebElement searchBox = driver.findElement(By.name("someElement"));
-
-
WebElement searchBox = findElement(By.name("someElement"));
-
WebElement searchBox = driver.findElement(name("someElement"));
- All of the above
-
Display the title of the page ____.
-
System.out.println("Title: " + driver.Title());
-
System.out.println("Title: " + driver.getTitle());
-
System.out.println("Title: " + getTitle());
- None of the above
Ans: 2
-
-
Does Selenium supports regular expression?
- Yes
- No
Ans: 1
-
_____ statement matches links such as ‘Over $75′, ‘Over $85′ etc
-
selenium.click("link=^Over \\$[0-9]+$");
-
selenium.click("link=regexpi:^Over \\$+$");
-
selenium.click("link=regexpi:Over \\$[0-9]+$");
-
selenium.click("link=regexpi:^Over \\$[0-9]+$");
Ans: 4
-
-
____ statement clicks on the first image that has an id attribute that starts with ‘cat_prod_image’.
-
selenium.click("//img[(@id,'cat_prod_image')]");
-
selenium.click("[starts-with(@id,'cat_prod_image')]");
-
selenium.click("//img[starts-with(@id,'cat_prod_image')]");
None of the above
-
ANT
Webdriver Overview
Keyword Driven Framework
Ans: 1
Ans: 3
Hybrid Framework using Webdriver
-
“____ is the combination of both keyboard driven and data driven frameworks”
- Linear Framework
- Hybrid Framework
- Modular Framework
- Keyword Driven Framework
Ans: 2
-
In Which case we can design Hybrid Framework
- Rich Application functionality
- Data sensitive testing
- Regression testing
- All of the above
Ans: 4
-
What are the advantages of Hybrid framework?
- Flexible
- Increases accuracy
- Highest ROI
- All of the above
Ans: 4
-
In Hybrid framework, data can accessed through database, excel file, xml etc.
- TRUE
- FALSE
Ans: 1
-
Hybrid framework can be implemented for any application.
- TRUE
- FALSE
Ans: 1
-
What are the frameworks available other than DDF, KDF and Hybrid?
- Linear Framework
- Modular Framework
- Structured Framework
- All of the above
Ans: 4
Selenium Database Testing
-
What are the advantages of Database testing?
- Both functional and DB testing can be performed at the same time while running the automation script.
- Validate data displaying on a webpage and compare the same with database.
- Connect to SQL, MySQL servers etc.
- All of the above
Ans: 4
-
mysql coonection jar file is required to connect with database
- TRUE
- FALSE
Ans: 1
-
How to create instance of mysql to connect with database?
-
Object myDC = Class.forName(com.mysql.jdbc.Driver);
-
Object myDC = Class.forName(com.mysql.jdbc.Driver);
-
Object myDC = Class.forName("com.mysql.jdbc.Driver").newInstance();
- None of the above
Ans: 3
-
-
How to create database connection?
-
mycon = DriverManager.getConnection(myUName, myPWD)mySt=mycon.createStatement();
-
mycon = DriverManager.getConnection(mySQLDB, myUName, myPWD
-
mySt=mycon.createStatement(); mycon=getConnection(mySQLDB, myUName, myPWD)
-
mySt=mycon.createStatement();
- None of the above
Ans: 2
-
-
How to pass any sql query after database connection?
-
PreparedStatement preparedStatement = conn.prepareStatement("select * from YourTableName");
-
preparedStatement = conn.prepareStatement("select * from YourTableName");
-
PreparedStatement preparedStatement = prepareStatement("select * from YourTableName");
- All of the above
Ans: 1
-
-
What is Recordset in terms of Database?
- Recordset also works as a View in Database
- Recordset is a virtual table which stores data
- It is used to open database connection
- Recordset object is used to hold a set of records from a database table. A Recordset object consist of records and columns
Ans: 4
-
How to create record set?
-
set rs=CreateObject(""ADODB.recordset"")rs.Open ""Select * from Customers"", oConnection
-
PreparedStatement preparedStatement = conn.prepareStatement(""select * from YourTableName"");resultSet = preparedStatement.executeQuery();
-
PreparedStatement preparedStatement = conn.prepareStatement(""select * from YourTableName""); preparedStatement.executeQuery();
- None of the above
Ans: 2
-
-
___ statement will print the EmpID from the record set. Assume EmpID is Integer.
-
System.out.print(resultset.getInt("EmpID");
-
System.out.print(resultset.getString("EmpID")
-
System.out.print(resultset.getInt("Name")
- All of the above
Ans: 1
-
-
How to go on next data in record set?
-
resultset.First();
-
resultset.Last();
-
resultset.MoveNext();
-
resultset.next();
Ans: 4
-
-
___statement will close the database connection?
-
mycon.close;
-
mycon.close()
mycon.close();
- None of the above
Ans: 3
-
Selenium Grid
-
What is Selenium Grid?
- Scale by distributing tests on several machines
- manage multiple environments from a central point, making it easy to run the tests against a vast combination of browsers / OS.
- minimize the maintenance time for the grid by allowing you to implement custom hooks to leverage virtual infrastructure for instance
- All of the above
Ans: 4
-
The selenium-server-standalone package includes the ____.
- Hub
- Webdriver
- legacy RC needed to run the grid
- All of the above
Ans: 4
-
What is Hub in Selenium Grid?
- The Hub is framework to run the Grid.
- The Hub is the central point that will receive all the test request and distribute them the the right nodes.
- Both 1 & 2
- None of the above
Ans: 2
-
How to start Selenium hub?
- java -jar selenium-server-standalone-2.32.0.jar -role node
- java -role hub
- java -jar selenium-server-standalone-2.32.0.jar -role hub
- None of the above
Ans: 3
-
How to start Selenium nodes?
- java -jar selenium-server-standalone-2.32.0.jar -role node -hub http://localhost:4444/grid/register
- java -jar selenium-server-standalone-2.32.0.jar -role hub
- java -jar selenium-server-standalone-2.32.0.jar -role node
- All of the above
Ans: 1
-
How to start remote control on port “5556” and register it to the local hub?
- Dport =5556 launch-remote-contro
- ant -Dport =5555 launch-remote-contro
- ant -Dport =5556 launch-remote-contro
- None of the above
Ans: 3
TestNG
-
What is TestNG?
- TestNG is a testing framework
- designed to simplify a broad range of testing needs, from unit testing to integration testing
- Both 1 & 2
- None of the above
Ans: 3
-
What are the annotations available in TestNG?
- @BeforeSuite
- @AfterSuite
- @BeforeTest
- @BeforeGroups
- All of the above
Ans: 5
-
TestNG can be invoked from ____
- Command line
- ant
- Eclipse
- IntelliJ's IDEA
- All of the above
Ans: 5
-
____ statement will invoke TestNG from command line.
- java org.testng.TestNG testng1.xml [testng2.xml testng3.xml ...]
- ant -Dport =5556 launch-remote-contro
- java org.testng.TestNG
- None of the above
Ans: 1
Maven
-
What is Maven?
- software tool for project management
- build automation
- building and managing Java projects
- All of the above
Ans: 1
-
How to compile application sources using Maven?
- change to the directory where pom.xml is created by archetype:generate
- "execute the following command:mvn compile"
- Both 1 & 2
- None of the above
Ans: 3
-
What is an archetype?
- building and managing Java projects
- An archetype can be defined as an original pattern from which all other things of the same kind are made.
- Both 1 & 2
- None of the above
Ans: 2
-
What are the different dependency scopes have you used?
- compile
- provided
- test
- import
- All of the above
Ans: 5
-
How to prevent including JARs in WEB-INF/lib? I need a "compile only" scope!
- The scope should be used for this is:
- provided
- compile
- import
- test
Ans: 1
-
How to determine what version of a plugin being used?
- mvn=install help:describe
- mvn -Dplugin=help:describe
- Both 1 & 2
- mvn -Dplugin=install help:describe
Ans: 4
-
Is it possible to create my own directory structure?
- Yes
- No
Ans: 1
-
What is POM?
- Project Object Model
- xml file that contains information about project and configuration
- It contains default value for most projects.
- All of the above
Ans: 4
-
When you compile a Maven project, where do you find the class files?
- ${basedir}/target/classes
- ${basedir}/target
- $/target/classes
- None of the above
Ans: 1
-
What is the command to install JAR file in local repository?
- mvn jar
- mvn package
- mvn install
- None of the above
Ans: 3
Dynamic Pages, Window Alerts, Pop-Ups
-
Is Selenium able to handle dynamic AJAX elements?
- Yes
- No
- Cant Say
Ans: 1
-
How to use xpath for dynamic elements?
- Identify the pattern and modify xpath pattern
- Directly use the xpath?
- Both 1 and 2
- None of the above
Ans: 1
-
Selenium can handle Javascript alerts.
- TRUE
- FALSE
Ans: 1
-
Is Regular expression helps to identify dynamic elements?
- Yes
- No
- Not very compatible
Ans: 3
-
How to check if any check box is checked or not?
-
driver.findElement(By.id(<>).Selected()
-
driver.findElement(By.id(<>).isSelected()
-
driver.findElement(By.id(<>).isChecked()
- All of the above
Ans: 2
-
-
Can Selenium handle Alerts or Pop ups windows?
- Yes
- No
Ans: 1
-
What is getWindowHandle method?
- Method will help to handle parent window
- Method will help to handle of opened windows other than parent
- Only handles alert
- None of the above
Ans: 2
-
How to handle alert using selenium?
-
driver.switchto.popup()
-
driver.switchto
-
driver.switchto.alert()
- None of the above
Ans: 3
-
-
What is Iterator?
- Iterator enables you to cycle through a collection, obtaining or removing elements
- It basically starts at the beginning of a collection
- When you want to know which things are in a certain collection, you iterate over the collection, which is just another term for going through all elements. This is what an Iterator does
- All of the above
Ans: 4
-
After the popup actions, how to switch the driver back to the parent window?
-
browser.switchTo().window(parentWindowHandle);
-
browser.switchTo().alert();
- Both 1 & 2
- None of the above
Ans: 1
-