{"iq":[{"id":"1",
"q":"What is Automation Testing?",
"answer":"Automation testing is the process of testing the software using an automation tool to find the defects.\n\nIn this process, executing the test scripts and generating the results are performed automatically by automation tools.\n\nSome most popular tools to do automation testing are HP QTP/UFT, Selenium WebDriver, etc.,"
},
{"id":"2",
"q":"What are the benefits of Automation Testing?",
"answer":"This is one of the common interview questions in any Automation testing job.\n\nSaves time and money. Automation testing is faster in execution.\n\nReusability of code. Create one time and execute multiple times with less or no maintenance.\n\nEasy reporting. It generates automatic reports after test execution.\n\nEasy for compatibility testing. It enables parallel execution in the combination of different OS and browser environments.\n\nLow-cost maintenance. It is cheaper compared to manual testing in a long run.\n\nAutomated testing is more reliable.\n\nAutomated testing is more powerful and versatile.\n\nIt is mostly used for regression testing. Supports execution of repeated test cases.\n\nMinimal manual intervention. Test scripts can be run unattended.\n\nMaximum coverage. It helps to increase the test coverage."
},
{"id":"3",
"q":"What type of tests have you automated?",
"answer":"Our main focus is to automate test cases to do Regression testing, Smoke testing, and Sanity testing. Sometimes based on the project and the test time estimation, we do focus on End to End testing."
},
{"id":"4",
"q":"What is a Framework?",
"answer":"A framework defines a set of rules or best practices which we can follow in a systematic way to achieve the desired results. There are different types of automation frameworks and the most common ones are:\n\nData Driven Testing Framework\n\nKeyword Driven Testing Framework\n\nHybrid Testing Framework"
},
{"id":"5",
"q":"How many test cases you have automated per day?",
"answer":"It depends on Test case scenario complexity and length.\n\nI did automate 2-5 test scenarios per day when the complexity is limited.\n\nSometimes just 1 or fewer test scenarios in a day when the complexity is high."
},
{"id":"6",
"q":"Will there be journal replay programs in case of incomplete entries (if there is a failure in the middle of one)?",
"answer":"Each journal (group) write is consistent and won’t be replayed during recovery unless it is complete."
},
{"id":"7",
"q":"Why should Selenium be selected as a test tool?",
"answer":"Selenium is free and open source have a large user base and helping communities have cross Browser compatibility (Firefox, Chrome, Internet Explorer, Safari etc.) have great platform compatibility (Windows, Mac OS, Linux etc.) supports multiple programming languages (Java, C#, Ruby, Python, Pearl etc.) has fresh and regular repository developments supports distributed testing"
},
{"id":"8",
"q":"What are the testing types that can be supported by Selenium?",
"answer":"Selenium supports the following types of testing:\n\nFunctional Testing\n\nRegression Testing"
},
{"id":"9",
"q":"When should I use Selenium IDE?",
"answer":"Selenium IDE is the simplest and easiest of all the tools within the Selenium Package.\n\nIts record and playback feature makes it exceptionally easy to learn with minimal acquaintances to any programming language.\n\nSelenium IDE is an ideal tool for a naïve user."
},
{"id":"10",
"q":"What is Selenese?",
"answer":"Selenese is the language which is used to write test scripts in Selenium IDE."
},
{"id":"11",
"q":"What is the difference between assert and verify commands?",
"answer":"Assert: Assert command checks whether the given condition is true or false. Let’s say we assert whether the given element is present on the web page or not. If the condition is true then the program control will execute the next test step but if the condition is false, the execution would stop and no further test would be executed.\n\nVerify: Verify command also checks whether the given condition is true or false. Irrespective of the condition being true or false, the program execution doesn’t halt i.e. any failure during verification would not stop the execution and all the test steps would be executed."
},
{"id":"12",
"q":" What is an XPath?",
"answer":"XPath is used to locate a web element based on its XML path. XML stands for Extensible Markup Language and is used to store, organize and transport arbitrary data. It stores data in a key-value pair which is very much similar to HTML tags. Both being markup languages and since they fall under the same umbrella, XPath can be used to locate HTML elements.\n\nThe fundamental behind locating elements using XPath is the traversing between various elements across the entire page and thus enabling a user to find an element with the reference of another element. "
},
{"id":"13",
"q":"What is the Object ID composed of in MongoDB?",
"answer":"Object ID is composed of:\n\n3 bytes incremented counter\n\nClient machine ID\n\nTimestamp\n\nClient process ID"
},
{"id":"14",
"q":"What is the difference between “/” and “//” in Xpath?",
"answer":"Single Slash “/” – Single slash is used to create Xpath with absolute path i.e. the xpath would be created to start selection from the document node/start node.\n\nDouble Slash “//” – Double slash is used to create Xpath with relative path i.e. the xpath would be created to start selection from anywhere within the document."
},
{"id":"15",
"q":" When should I use Selenium Grid?",
"answer":"Selenium Grid can be used to execute same or different test scripts on multiple platforms and browsers concurrently so as to achieve distributed test execution, testing under different environments and saving execution time remarkably."
},
{"id":"16",
"q":"What do we mean by Selenium 1 and Selenium 2?",
"answer":"Selenium RC and WebDriver, in a combination are popularly known as Selenium 2. Selenium RC alone is also referred as Selenium 1."
},
{"id":"17",
"q":"Which is the latest Selenium tool? ",
"answer":"WebDriver"
},
{"id":"18",
"q":" How do I launch the browser using WebDriver?",
"answer":"WebDriver driver = new FirefoxDriver();\n\nWebDriver driver = new ChromeDriver();\n\nWebDriver driver = new InternetExplorerDriver();"
},
{"id":"19",
"q":"How to type in a textbox using Selenium?",
"answer":"User can use sendKeys(“String to be entered”) to enter the string in the textbox.\n\nSyntax:\n\nWebElement username = drv.findElement(By.id(“Email”));\n\nusername.sendKeys(“sth”); "
},
{"id":"20",
"q":" How can you find if an element in displayed on the screen?",
"answer":"WebDriver facilitates the user with the following methods to check the visibility of the web elements. These web elements can be buttons, drop boxes, checkboxes, radio buttons, labels etc.\n\nisDisplayed()\n\nisSelected()\n\nisEnabled()\n\n\nSyntax:\n\nisDisplayed():\n\nboolean buttonPresence = driver.findElement(By.id(“gbqfba”)).isDisplayed();\n\nisSelected():\n\nboolean buttonSelected = driver.findElement(By.id(“gbqfba”)).isDisplayed();\n\nisEnabled():\n\nboolean searchIconEnabled = driver.findElement(By.id(“gbqfb”)).isEnabled();"
},
{"id":"21",
"q":"How can we get a text of a web element?",
"answer":"Get command is used to retrieve the inner text of the specified web element. The command doesn’t require any parameter but returns a string value. It is also one of the extensively used commands for verification of messages, labels, errors etc displayed on the web pages.\n\nSyntax:\n\nString Text = driver.findElement(By.id(“Text”)).getText();"
},
{"id":"22",
"q":" How to select value in a dropdown?",
"answer":"Value in the drop down can be selected using WebDriver’s Select class.\n\nSyntax:\n\nselectByValue:\n\nSelect selectByValue = new Select(driver.findElement(By.id(“SelectID_One”)));\n\nselectByValue.selectByValue(“greenvalue”);\n\nselectByVisibleText:\n\nSelect selectByVisibleText = new Select (driver.findElement(By.id(“SelectID_Two”)));\n\nselectByVisibleText.selectByVisibleText(“Lime”);\n\nselectByIndex:\n\nSelect selectByIndex = new Select(driver.findElement(By.id(“SelectID_Three”)));\n\nselectByIndex.selectByIndex(2);"
},
{"id":"23",
"q":"How can we locate elements using their text in XPath?",
"answer":"Using the text() method -\n\nxPathExpression = //*[text()='username']."
},{"id":"24",
"q":"How can we move to parent of an element using XPath? ",
"answer":"Using '..' expression in XPath we can move to parent of an element."
},{"id":"25",
"q":"How can we move to nth child element using XPath?",
"answer":"There are two ways of navigating to the nth element using XPath-\n\nUsing square brackets with index position-\n\nExample - div[2] will find the second div element.\n\nUsing position()-\n\nExample - div[position()=3] will find the third div element."
},{"id":"26",
"q":"What is the syntax of finding elements by class using CSS Selector?",
"answer":"By .className we can select all the element belonging to a particluar class e.g. '.red' will select all elements having class 'red'."
},
{"id":"27",
"q":"What is the syntax of finding elements by id using CSS Selector?",
"answer":"By #idValue we can select all the element belonging to a particluar class e.g. '#userId' will select the element having id - userId."
},{"id":"28",
"q":"How can we select elements by their attribute value using CSS Selector?",
"answer":"Using [attribute=value] we can select all the element belonging to a particluar class e.g. '[type=small]' will select the element having attribute type of value 'small'."
},{"id":"29",
"q":"How can we move to nth child element using css selector?",
"answer":"Using :nth-child(n) we can move to the nth child element e.g. div:nth-child(2) will locate 2nd div element of its parent."
},
{"id":"30",
"q":"What is fundamental difference between XPath and css selector?",
"answer":"The fundamental difference between XPath and css selector is using XPaths we can traverse up in the document i.e. we can move to parent elements. Whereas using CSS selector we can only move downwards in the document."
},
{"id":"31",
"q":" How can we launch different browsers in selenium webdriver?",
"answer":"By creating an instance of driver of a particular browser-\n\nWebDriver driver = new FirefoxDriver();"
},
{"id":"32",
"q":"What is the use of driver.get(\"URL\") and driver.navigate().to(\"URL\") command? Is there any difference between the two?",
"answer":"Both driver.get(\"URL\") and driver.navigate().to(\"URL\") commands are used to navigate to a URL passed as parameter.\n\nThere is no difference between the two commands."
},{"id":"33",
"q":"How can we type text in a textbox element using selenium?",
"answer":"Using sendKeys() method we can type text in a textbox-\n\nWebElement searchTextBox = driver.findElement(By.id(\"search\"));\n\nsearchTextBox.sendKeys(\"searchTerm\");"
},
{"id":"34",
"q":"What are the four parameter you have to pass in Selenium?",
"answer":" Four parameters that you have to pass in Selenium are\n\nHost\n\nPort Number\n\nBrowser\n\nURL."
},{"id":"35",
"q":"What is the difference between setSpeed() and sleep() methods?",
"answer":"Both will delay the speed of execution.\n\nThread.sleep () : It will stop the current (java) thread for the specified period of time. Its done only once\n\n\nIt takes a single argument in integer format\n\nEx: thread.sleep(2000)- It will wait for 2 seconds\n\nIt waits only once at the command given at sleep\n\nSetSpeed () : For specific amount of time it will stop the execution for every selenium command.\n\nIt takes a single argument in integer format\n\nEx: selenium.setSpeed(“2000”)- It will wait for 2 seconds\n\nRuns each command after setSpeed delay by the number of milliseconds mentioned in set Speed\n\nThis command is useful for demonstration purpose or if you are using a slow web application"
},
{"id":"36",
"q":" What is same origin policy? How you can avoid same origin policy?",
"answer":"The “Same Origin Policy” is introduced for security reason,and it ensures that content of your site will never be accessible by a script from another site.\n\nAs per the policy, any code loaded within the browser can only operate within that website’s domain.\n\n\nTo avoid “Same Origin Policy” proxy injection method is used, in proxy injection mode the Selenium Server acts as a client configured HTTP proxy ,which sits between the browser and application under test and then masks the AUT under a fictional URL"
},
{"id":"37",
"q":"What is heightened privileges browsers?",
"answer":"The purpose of heightened privileges is similar to Proxy Injection,allows websites to do something that are not commonly permitted.\n\nThe key difference is that the browsers are launced in a special mode called heightened privileges.\n\nBy using these browser mode,\n\nSelenium core can open the AUT directly and also read/write its content without passing the whole AUT through the Selenium RC server.."
},
{"id":"38",
"q":"How you can use “submit” a form using Selenium ?",
"answer":"You can use “submit” method on element to submit form-element.submit () ;\n\nAlternatively you can use click method on the element which does form submission"
},
{"id":"39",
"q":"What are the features of TestNG and list some of the functionality in TestNG which makes it more effective?",
"answer":"TestNG is a testing framework based on JUnit and NUnit to simplify a broad range of testing needs, from Unit Testing to Integration Testing. And the functionality which makes it efficient testing framework are\n\nSupport for annotations\n\nSupport for data-driven testing\n\nFlexible test configuration\n\nAbility to re-execute failed test cases."
},
{"id":"40",
"q":"What is splitting in mongodb?",
"answer":"It is a background process that is used to keep chunks from growing too large." },
{"id":"41",
"q":" Mention how do you use indexes in a collection?",
"answer":"To list a collection’s index, use the db.collection.getIndexes() method otherwise a similar method based on your driver."
},{"id": "42",
"q":"What is GridFS in MongoDB? ",
"answer":"The GridFS is a specification for storing and retrieving files that precede the BSON-document size limit of 16MB. Rather than storing a file in a single document. The GridFS categorize a file into parts, or chunks and stores each of those chunks as an individual document."
},{"id":"43",
"q":" Can you run multiple JavaScript operations in a single MongoDB instance?",
"answer":"Yes, The V8 JavaScript engine is included in 2.4 which provides multiple JavaScript operations to execute at the same time."
},{"id":"44",
"q":" Which attribute you should consider throughout the script in frame for “if no frame Id as well as no frame name”?",
"answer":"You can use…..driver.findElements(By.xpath(“//iframe”))….This will return list of frames.\n\nYou will ned to switch to each and every frame and search for locator which we want.\n\nThen break the loop."
},
{"id":"45",
"q":" Explain what are the JUnits annotation linked with Selenium?",
"answer":"The JUnits annotation linked with Selenium are\n\n@Before public void method() – It will perform the method () before each test, this method can prepare the test\n\n@Test public void method() – Annotations @Test identifies that this method is a test method environment\n\n@After public void method()- To execute a method before this annotation is used, test method must start with test@Before "
},{"id":"46",
"q":"Explain what is the difference between find elements () and find element () ?",
"answer":"find element ():\n\nIt finds the first element within the current page using the given “locating mechanism”. It returns a single WebElement\n\nfindElements () : Using the given “locating mechanism” find all the elements within the current page. It returns a list of web elements."
},
{"id":"47",
"q":"Explain how you can login into any site if it’s showing any authentication popup for password and username?",
"answer":"Pass the username and password with url"
},
{"id":"48",
"q":" Explain how Selenium Grid works?",
"answer":"Selenium Grid sent the tests to the hub.\n\nThese tests are redirected to Selenium Webdriver, which launch the browser and run the test. With entire test suite, it allows for running tests in parallel.."
},
{"id":"49",
"q":" Can we use Selenium grid for performance testing?",
"answer":"Yes. But not as effectively as a dedicated Performance Testing tool like Loadrunner."
},
{"id":"50",
"q":" While injecting capabilities in webdriver to perform tests on a browser which is not supported by a webdriver what is the limitation that one can come across?",
"answer":"Major limitation of injecting capabilities is that “findElement” command may not work as expected."
},
{"id":"51",
"q":" Mention when to use AutoIT?",
"answer":"Selenium is designed to automate web-based applications on different browsers.But to handle window GUI and non-HTML popups in the application you need AutoIT."
},
{"id":"52",
"q":" Mention what is desired capability? How is it useful in terms of Selenium?",
"answer":"The desired capability is a series of key/value pairs that stores the browser properties like browser name, browser version, the path of the browser driver in the system, etc. to determine the behavior of the browser at run time.\n\n\n\nFor Selenium,\n\nIt can be used to configure the driver instance of Selenium WebDriver.\n\nWhen you want to run the test cases on a different browser with different operating systems and versions."
},
{"id": "53",
"q":" To generate pdf reports mention what Java API is required? ",
"answer":"To generate pdf reports, you need Java API IText."
},
{"id":"54",
"q":" Can you run multiple JavaScript operations in a single MongoDB instance?",
"answer":"Yes, The V8 JavaScript engine is included in 2.4 which provides multiple JavaScript operations to execute at the same time."
},
{"id":"55",
"q":" Mention what is IntelliJ?",
"answer" :"Intellij is an IDE that helps you to write better and faster code for Selenium. Intellij can be used in the option to Java bean and Eclipse."
},
{"id":"56",
"q":"In Selenium what are Breakpoints and Startpoints?",
"answer":"Breakpoints: When you implement a breakpoint in your code, the execution will stop right there.\n\nThis helps you to verify that your code is working as expected.\n\nStartpointsStartpoint indicates the point from where the execution should begin.\n\nStartpoint can be used when you want to run the testscript from the middle of the code or a breakpoint. "
},
{"id":"57",
"q":"How to connect a Database in selenium?",
"answer":"As we all know Selenium WebDriver is a tool to automate User Interface. We could only interact with Browser using Selenium WebDriver.\n\nWe use JDBC Driver to connect the Database in Selenium (While using Java Programming Language).."
},
{"id":"58",
"q":"How To Resize Browser Window Using Selenium WebDriver?",
"answer":"To resize the browser window to particular dimensions, we use ‘Dimension’ class to resize the browser window."
},
{"id":"59",
"q":"How To Scroll Web Page Down Or UP Using Selenium WebDriver?",
"answer":"JavaScript scrollBy() method scrolls the document by the specified number of pixels."
},
{"id":"60",
"q":" How To Perform Right Click Action (Context Click) In Selenium WebDriver?",
"answer":"We use Actions class in Selenium WebDriver to do Right-Click (Context Click) action."
},
{"id":"61",
"q":"How To Perform Drag And Drop Action in Selenium WebDriver?",
"answer":"We use Actions class to do Drag And Drop Action."
},
{"id":"62",
"q":"What is TestNG?",
"answer":"TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing to integration testing." },
{"id":"63",
"q":"How to create and run TestNG.xml? ",
"answer":"In TestNG framework, we need to create TestNG XML file to create and handle multiple test classes.We do configure our test run, set test dependency, include or exclude any test, method, class or package and set priority etc in the XML file."
},{"id": "64",
"q":"What is the use of @Listener annotation in TestNG?",
"answer":"TestNG listeners are used to configure reports and logging. One of the most widely used listeners in TestNG is ITestListener interface. It has methods like onTestStart, onTestSuccess, onTestFailure, onTestSkipped etc. We should implement this interface creating a listener class of our own. Next, we should add the listeners annotation (@Listeners) in the Class which was created.."
},{"id":"65",
"q":" Can captcha be automated?",
"answer":"No, captcha and bar code reader cannot be automated."
},{"id":"66",
"q":" What is a data driven framework?",
"answer" :"A data driven framework is one in which the test data is put in external files like csv, excel etc separated from test logic written in test script files. The test data drives the test cases, i.e. the test methods run for each set of test data values. TestNG provides inherent support for data driven testing using @dataProvider annotation."
},
{"id":"67",
"q":"What is a hybrid framework?",
"answer":"A hybrid framework is a combination of one or more frameworks.\n\nNormally it is associated with combination of data driven and keyword driven\n\nframeworks where both the test data and test actions are kept in external files(in the form of table)."
},{"id":"68",
"q":"What is a node in selenium grid?",
"answer":"Nodes are the machines which are attached to the selenium grid hub and have selenium instances running the test scripts.Unlike hub there can be multiple nodes in selenium grid."
},
{"id":"69",
"q":"How can we set priority of test cases in TestNG?",
"answer":"Using priority parameter in @Test annotation in TestNG we can define priority of test cases. The default priority of test when not specified is integer value 0. Example-\n\n@Test(priority=1)"
},
{"id":"70",
"q":" Name an API used for reading and writing data to excel files.",
"answer":"Apache POI API and JXL(Java Excel API) can be used for reading, writing and updating excel files."
},
{"id":"71",
"q":"Can we use Selenium grid for performance testing?",
"answer":"Yes. But not as effectively as a dedicated Performance Testing tool like Loadrunner."
},
{"id":"72",
"q":" Explain how you can handle colors in web driver?",
"answer":"Using linkText() and partialLinkText() we can locate a link. The difference between the two is linkText matches the complete string passed as parameter to the link texts. Whereas partialLinkText matches the string parameter partially with the link texts.\n\nWebElement link1 = driver.findElement(By.linkText(\"artOfTesting\"));\n\nWebElement link2 = driver.findElement(By.partialLinkText(\"artOf\"));"
},
{"id":"73",
"q":"How can we find all the links on a web page?",
"answer":"All the links are of anchor tag 'a'. So by locating elements of tagName 'a' we can find all the links on a webpage.\n\nList<WebElement> links = driver.findElements(By.tagName(\"a\"));"
},
{"id":"74",
"q":"What are DesiredCapabilities in selenium webdriver?",
"answer":"Desired capabilities are a set of key-value pairs that are used for storing or configuring browser specific properties like its version, platform etc in the browser instances. "
},
{"id":"75",
"q":"How can we find all the links on a web page? ",
"answer":"All the links are of anchor tag 'a'. So by locating elements of tagName 'a' we can find all the links on a webpage.\n\nList<WebElement> links = driver.findElements(By.tagName(\"a\"));"
},
{"id":"76",
"q":" How can we capture screenshots in selenium?",
"answer":"Using getScreenshotAs method of TakesScreenshot interface we can take the screenshots in selenium.\n\nFile scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);\n\nFileUtils.copyFile(scrFile, new File(\"D:\\testScreenShot.jpg\"));"
},
{"id":"77",
"q":"How can we check if an element is getting displayed on a web page?",
"answer":"Using isDisplayed method we can check if an element is getting displayed on a web page.\n\ndriver.findElement(By locator).isDisplayed();"
},
{"id":"78",
"q":" How can we check if an element is enabled for interaction on a web page?",
"answer":"Using isEnabled method we can check if an element is enabled or not.driver.findElement(By locator).isEnabled();"
},
{"id":"79",
"q":"What is the difference between driver.findElement() and driver.findElements() commands? ",
"answer":"The difference between driver.findElement() and driver.findElements() commands is-\n\nfindElement() returns a single WebElement (found first) based on the locator passed as parameter. Whereas findElements() returns a list of WebElements, all satisfying the locator value passed.\n\nSyntax of findElement()-\n\nWebElement textbox = driver.findElement(By.id(\"textBoxLocator\"));\n\nSyntax of findElements()-\n\nList <WebElement> elements = element.findElements(By.id(“value”));\n\nAnother difference between the two is- if no element is found then findElement() throws NoSuchElementException whereas findElements() returns a list of 0 elements."
},
{"id":"80",
"q":"What is Robot API?",
"answer":"Robot API is used for handling Keyboard or mouse events. It is generally used to upload files to the server in selenium automation.\n\nRobot robot = new Robot();\n\nrobot.keyPress(KeyEvent.VK_ENTER);"
}
]
}
"q":"What is Automation Testing?",
"answer":"Automation testing is the process of testing the software using an automation tool to find the defects.\n\nIn this process, executing the test scripts and generating the results are performed automatically by automation tools.\n\nSome most popular tools to do automation testing are HP QTP/UFT, Selenium WebDriver, etc.,"
},
{"id":"2",
"q":"What are the benefits of Automation Testing?",
"answer":"This is one of the common interview questions in any Automation testing job.\n\nSaves time and money. Automation testing is faster in execution.\n\nReusability of code. Create one time and execute multiple times with less or no maintenance.\n\nEasy reporting. It generates automatic reports after test execution.\n\nEasy for compatibility testing. It enables parallel execution in the combination of different OS and browser environments.\n\nLow-cost maintenance. It is cheaper compared to manual testing in a long run.\n\nAutomated testing is more reliable.\n\nAutomated testing is more powerful and versatile.\n\nIt is mostly used for regression testing. Supports execution of repeated test cases.\n\nMinimal manual intervention. Test scripts can be run unattended.\n\nMaximum coverage. It helps to increase the test coverage."
},
{"id":"3",
"q":"What type of tests have you automated?",
"answer":"Our main focus is to automate test cases to do Regression testing, Smoke testing, and Sanity testing. Sometimes based on the project and the test time estimation, we do focus on End to End testing."
},
{"id":"4",
"q":"What is a Framework?",
"answer":"A framework defines a set of rules or best practices which we can follow in a systematic way to achieve the desired results. There are different types of automation frameworks and the most common ones are:\n\nData Driven Testing Framework\n\nKeyword Driven Testing Framework\n\nHybrid Testing Framework"
},
{"id":"5",
"q":"How many test cases you have automated per day?",
"answer":"It depends on Test case scenario complexity and length.\n\nI did automate 2-5 test scenarios per day when the complexity is limited.\n\nSometimes just 1 or fewer test scenarios in a day when the complexity is high."
},
{"id":"6",
"q":"Will there be journal replay programs in case of incomplete entries (if there is a failure in the middle of one)?",
"answer":"Each journal (group) write is consistent and won’t be replayed during recovery unless it is complete."
},
{"id":"7",
"q":"Why should Selenium be selected as a test tool?",
"answer":"Selenium is free and open source have a large user base and helping communities have cross Browser compatibility (Firefox, Chrome, Internet Explorer, Safari etc.) have great platform compatibility (Windows, Mac OS, Linux etc.) supports multiple programming languages (Java, C#, Ruby, Python, Pearl etc.) has fresh and regular repository developments supports distributed testing"
},
{"id":"8",
"q":"What are the testing types that can be supported by Selenium?",
"answer":"Selenium supports the following types of testing:\n\nFunctional Testing\n\nRegression Testing"
},
{"id":"9",
"q":"When should I use Selenium IDE?",
"answer":"Selenium IDE is the simplest and easiest of all the tools within the Selenium Package.\n\nIts record and playback feature makes it exceptionally easy to learn with minimal acquaintances to any programming language.\n\nSelenium IDE is an ideal tool for a naïve user."
},
{"id":"10",
"q":"What is Selenese?",
"answer":"Selenese is the language which is used to write test scripts in Selenium IDE."
},
{"id":"11",
"q":"What is the difference between assert and verify commands?",
"answer":"Assert: Assert command checks whether the given condition is true or false. Let’s say we assert whether the given element is present on the web page or not. If the condition is true then the program control will execute the next test step but if the condition is false, the execution would stop and no further test would be executed.\n\nVerify: Verify command also checks whether the given condition is true or false. Irrespective of the condition being true or false, the program execution doesn’t halt i.e. any failure during verification would not stop the execution and all the test steps would be executed."
},
{"id":"12",
"q":" What is an XPath?",
"answer":"XPath is used to locate a web element based on its XML path. XML stands for Extensible Markup Language and is used to store, organize and transport arbitrary data. It stores data in a key-value pair which is very much similar to HTML tags. Both being markup languages and since they fall under the same umbrella, XPath can be used to locate HTML elements.\n\nThe fundamental behind locating elements using XPath is the traversing between various elements across the entire page and thus enabling a user to find an element with the reference of another element. "
},
{"id":"13",
"q":"What is the Object ID composed of in MongoDB?",
"answer":"Object ID is composed of:\n\n3 bytes incremented counter\n\nClient machine ID\n\nTimestamp\n\nClient process ID"
},
{"id":"14",
"q":"What is the difference between “/” and “//” in Xpath?",
"answer":"Single Slash “/” – Single slash is used to create Xpath with absolute path i.e. the xpath would be created to start selection from the document node/start node.\n\nDouble Slash “//” – Double slash is used to create Xpath with relative path i.e. the xpath would be created to start selection from anywhere within the document."
},
{"id":"15",
"q":" When should I use Selenium Grid?",
"answer":"Selenium Grid can be used to execute same or different test scripts on multiple platforms and browsers concurrently so as to achieve distributed test execution, testing under different environments and saving execution time remarkably."
},
{"id":"16",
"q":"What do we mean by Selenium 1 and Selenium 2?",
"answer":"Selenium RC and WebDriver, in a combination are popularly known as Selenium 2. Selenium RC alone is also referred as Selenium 1."
},
{"id":"17",
"q":"Which is the latest Selenium tool? ",
"answer":"WebDriver"
},
{"id":"18",
"q":" How do I launch the browser using WebDriver?",
"answer":"WebDriver driver = new FirefoxDriver();\n\nWebDriver driver = new ChromeDriver();\n\nWebDriver driver = new InternetExplorerDriver();"
},
{"id":"19",
"q":"How to type in a textbox using Selenium?",
"answer":"User can use sendKeys(“String to be entered”) to enter the string in the textbox.\n\nSyntax:\n\nWebElement username = drv.findElement(By.id(“Email”));\n\nusername.sendKeys(“sth”); "
},
{"id":"20",
"q":" How can you find if an element in displayed on the screen?",
"answer":"WebDriver facilitates the user with the following methods to check the visibility of the web elements. These web elements can be buttons, drop boxes, checkboxes, radio buttons, labels etc.\n\nisDisplayed()\n\nisSelected()\n\nisEnabled()\n\n\nSyntax:\n\nisDisplayed():\n\nboolean buttonPresence = driver.findElement(By.id(“gbqfba”)).isDisplayed();\n\nisSelected():\n\nboolean buttonSelected = driver.findElement(By.id(“gbqfba”)).isDisplayed();\n\nisEnabled():\n\nboolean searchIconEnabled = driver.findElement(By.id(“gbqfb”)).isEnabled();"
},
{"id":"21",
"q":"How can we get a text of a web element?",
"answer":"Get command is used to retrieve the inner text of the specified web element. The command doesn’t require any parameter but returns a string value. It is also one of the extensively used commands for verification of messages, labels, errors etc displayed on the web pages.\n\nSyntax:\n\nString Text = driver.findElement(By.id(“Text”)).getText();"
},
{"id":"22",
"q":" How to select value in a dropdown?",
"answer":"Value in the drop down can be selected using WebDriver’s Select class.\n\nSyntax:\n\nselectByValue:\n\nSelect selectByValue = new Select(driver.findElement(By.id(“SelectID_One”)));\n\nselectByValue.selectByValue(“greenvalue”);\n\nselectByVisibleText:\n\nSelect selectByVisibleText = new Select (driver.findElement(By.id(“SelectID_Two”)));\n\nselectByVisibleText.selectByVisibleText(“Lime”);\n\nselectByIndex:\n\nSelect selectByIndex = new Select(driver.findElement(By.id(“SelectID_Three”)));\n\nselectByIndex.selectByIndex(2);"
},
{"id":"23",
"q":"How can we locate elements using their text in XPath?",
"answer":"Using the text() method -\n\nxPathExpression = //*[text()='username']."
},{"id":"24",
"q":"How can we move to parent of an element using XPath? ",
"answer":"Using '..' expression in XPath we can move to parent of an element."
},{"id":"25",
"q":"How can we move to nth child element using XPath?",
"answer":"There are two ways of navigating to the nth element using XPath-\n\nUsing square brackets with index position-\n\nExample - div[2] will find the second div element.\n\nUsing position()-\n\nExample - div[position()=3] will find the third div element."
},{"id":"26",
"q":"What is the syntax of finding elements by class using CSS Selector?",
"answer":"By .className we can select all the element belonging to a particluar class e.g. '.red' will select all elements having class 'red'."
},
{"id":"27",
"q":"What is the syntax of finding elements by id using CSS Selector?",
"answer":"By #idValue we can select all the element belonging to a particluar class e.g. '#userId' will select the element having id - userId."
},{"id":"28",
"q":"How can we select elements by their attribute value using CSS Selector?",
"answer":"Using [attribute=value] we can select all the element belonging to a particluar class e.g. '[type=small]' will select the element having attribute type of value 'small'."
},{"id":"29",
"q":"How can we move to nth child element using css selector?",
"answer":"Using :nth-child(n) we can move to the nth child element e.g. div:nth-child(2) will locate 2nd div element of its parent."
},
{"id":"30",
"q":"What is fundamental difference between XPath and css selector?",
"answer":"The fundamental difference between XPath and css selector is using XPaths we can traverse up in the document i.e. we can move to parent elements. Whereas using CSS selector we can only move downwards in the document."
},
{"id":"31",
"q":" How can we launch different browsers in selenium webdriver?",
"answer":"By creating an instance of driver of a particular browser-\n\nWebDriver driver = new FirefoxDriver();"
},
{"id":"32",
"q":"What is the use of driver.get(\"URL\") and driver.navigate().to(\"URL\") command? Is there any difference between the two?",
"answer":"Both driver.get(\"URL\") and driver.navigate().to(\"URL\") commands are used to navigate to a URL passed as parameter.\n\nThere is no difference between the two commands."
},{"id":"33",
"q":"How can we type text in a textbox element using selenium?",
"answer":"Using sendKeys() method we can type text in a textbox-\n\nWebElement searchTextBox = driver.findElement(By.id(\"search\"));\n\nsearchTextBox.sendKeys(\"searchTerm\");"
},
{"id":"34",
"q":"What are the four parameter you have to pass in Selenium?",
"answer":" Four parameters that you have to pass in Selenium are\n\nHost\n\nPort Number\n\nBrowser\n\nURL."
},{"id":"35",
"q":"What is the difference between setSpeed() and sleep() methods?",
"answer":"Both will delay the speed of execution.\n\nThread.sleep () : It will stop the current (java) thread for the specified period of time. Its done only once\n\n\nIt takes a single argument in integer format\n\nEx: thread.sleep(2000)- It will wait for 2 seconds\n\nIt waits only once at the command given at sleep\n\nSetSpeed () : For specific amount of time it will stop the execution for every selenium command.\n\nIt takes a single argument in integer format\n\nEx: selenium.setSpeed(“2000”)- It will wait for 2 seconds\n\nRuns each command after setSpeed delay by the number of milliseconds mentioned in set Speed\n\nThis command is useful for demonstration purpose or if you are using a slow web application"
},
{"id":"36",
"q":" What is same origin policy? How you can avoid same origin policy?",
"answer":"The “Same Origin Policy” is introduced for security reason,and it ensures that content of your site will never be accessible by a script from another site.\n\nAs per the policy, any code loaded within the browser can only operate within that website’s domain.\n\n\nTo avoid “Same Origin Policy” proxy injection method is used, in proxy injection mode the Selenium Server acts as a client configured HTTP proxy ,which sits between the browser and application under test and then masks the AUT under a fictional URL"
},
{"id":"37",
"q":"What is heightened privileges browsers?",
"answer":"The purpose of heightened privileges is similar to Proxy Injection,allows websites to do something that are not commonly permitted.\n\nThe key difference is that the browsers are launced in a special mode called heightened privileges.\n\nBy using these browser mode,\n\nSelenium core can open the AUT directly and also read/write its content without passing the whole AUT through the Selenium RC server.."
},
{"id":"38",
"q":"How you can use “submit” a form using Selenium ?",
"answer":"You can use “submit” method on element to submit form-element.submit () ;\n\nAlternatively you can use click method on the element which does form submission"
},
{"id":"39",
"q":"What are the features of TestNG and list some of the functionality in TestNG which makes it more effective?",
"answer":"TestNG is a testing framework based on JUnit and NUnit to simplify a broad range of testing needs, from Unit Testing to Integration Testing. And the functionality which makes it efficient testing framework are\n\nSupport for annotations\n\nSupport for data-driven testing\n\nFlexible test configuration\n\nAbility to re-execute failed test cases."
},
{"id":"40",
"q":"What is splitting in mongodb?",
"answer":"It is a background process that is used to keep chunks from growing too large." },
{"id":"41",
"q":" Mention how do you use indexes in a collection?",
"answer":"To list a collection’s index, use the db.collection.getIndexes() method otherwise a similar method based on your driver."
},{"id": "42",
"q":"What is GridFS in MongoDB? ",
"answer":"The GridFS is a specification for storing and retrieving files that precede the BSON-document size limit of 16MB. Rather than storing a file in a single document. The GridFS categorize a file into parts, or chunks and stores each of those chunks as an individual document."
},{"id":"43",
"q":" Can you run multiple JavaScript operations in a single MongoDB instance?",
"answer":"Yes, The V8 JavaScript engine is included in 2.4 which provides multiple JavaScript operations to execute at the same time."
},{"id":"44",
"q":" Which attribute you should consider throughout the script in frame for “if no frame Id as well as no frame name”?",
"answer":"You can use…..driver.findElements(By.xpath(“//iframe”))….This will return list of frames.\n\nYou will ned to switch to each and every frame and search for locator which we want.\n\nThen break the loop."
},
{"id":"45",
"q":" Explain what are the JUnits annotation linked with Selenium?",
"answer":"The JUnits annotation linked with Selenium are\n\n@Before public void method() – It will perform the method () before each test, this method can prepare the test\n\n@Test public void method() – Annotations @Test identifies that this method is a test method environment\n\n@After public void method()- To execute a method before this annotation is used, test method must start with test@Before "
},{"id":"46",
"q":"Explain what is the difference between find elements () and find element () ?",
"answer":"find element ():\n\nIt finds the first element within the current page using the given “locating mechanism”. It returns a single WebElement\n\nfindElements () : Using the given “locating mechanism” find all the elements within the current page. It returns a list of web elements."
},
{"id":"47",
"q":"Explain how you can login into any site if it’s showing any authentication popup for password and username?",
"answer":"Pass the username and password with url"
},
{"id":"48",
"q":" Explain how Selenium Grid works?",
"answer":"Selenium Grid sent the tests to the hub.\n\nThese tests are redirected to Selenium Webdriver, which launch the browser and run the test. With entire test suite, it allows for running tests in parallel.."
},
{"id":"49",
"q":" Can we use Selenium grid for performance testing?",
"answer":"Yes. But not as effectively as a dedicated Performance Testing tool like Loadrunner."
},
{"id":"50",
"q":" While injecting capabilities in webdriver to perform tests on a browser which is not supported by a webdriver what is the limitation that one can come across?",
"answer":"Major limitation of injecting capabilities is that “findElement” command may not work as expected."
},
{"id":"51",
"q":" Mention when to use AutoIT?",
"answer":"Selenium is designed to automate web-based applications on different browsers.But to handle window GUI and non-HTML popups in the application you need AutoIT."
},
{"id":"52",
"q":" Mention what is desired capability? How is it useful in terms of Selenium?",
"answer":"The desired capability is a series of key/value pairs that stores the browser properties like browser name, browser version, the path of the browser driver in the system, etc. to determine the behavior of the browser at run time.\n\n\n\nFor Selenium,\n\nIt can be used to configure the driver instance of Selenium WebDriver.\n\nWhen you want to run the test cases on a different browser with different operating systems and versions."
},
{"id": "53",
"q":" To generate pdf reports mention what Java API is required? ",
"answer":"To generate pdf reports, you need Java API IText."
},
{"id":"54",
"q":" Can you run multiple JavaScript operations in a single MongoDB instance?",
"answer":"Yes, The V8 JavaScript engine is included in 2.4 which provides multiple JavaScript operations to execute at the same time."
},
{"id":"55",
"q":" Mention what is IntelliJ?",
"answer" :"Intellij is an IDE that helps you to write better and faster code for Selenium. Intellij can be used in the option to Java bean and Eclipse."
},
{"id":"56",
"q":"In Selenium what are Breakpoints and Startpoints?",
"answer":"Breakpoints: When you implement a breakpoint in your code, the execution will stop right there.\n\nThis helps you to verify that your code is working as expected.\n\nStartpointsStartpoint indicates the point from where the execution should begin.\n\nStartpoint can be used when you want to run the testscript from the middle of the code or a breakpoint. "
},
{"id":"57",
"q":"How to connect a Database in selenium?",
"answer":"As we all know Selenium WebDriver is a tool to automate User Interface. We could only interact with Browser using Selenium WebDriver.\n\nWe use JDBC Driver to connect the Database in Selenium (While using Java Programming Language).."
},
{"id":"58",
"q":"How To Resize Browser Window Using Selenium WebDriver?",
"answer":"To resize the browser window to particular dimensions, we use ‘Dimension’ class to resize the browser window."
},
{"id":"59",
"q":"How To Scroll Web Page Down Or UP Using Selenium WebDriver?",
"answer":"JavaScript scrollBy() method scrolls the document by the specified number of pixels."
},
{"id":"60",
"q":" How To Perform Right Click Action (Context Click) In Selenium WebDriver?",
"answer":"We use Actions class in Selenium WebDriver to do Right-Click (Context Click) action."
},
{"id":"61",
"q":"How To Perform Drag And Drop Action in Selenium WebDriver?",
"answer":"We use Actions class to do Drag And Drop Action."
},
{"id":"62",
"q":"What is TestNG?",
"answer":"TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing to integration testing." },
{"id":"63",
"q":"How to create and run TestNG.xml? ",
"answer":"In TestNG framework, we need to create TestNG XML file to create and handle multiple test classes.We do configure our test run, set test dependency, include or exclude any test, method, class or package and set priority etc in the XML file."
},{"id": "64",
"q":"What is the use of @Listener annotation in TestNG?",
"answer":"TestNG listeners are used to configure reports and logging. One of the most widely used listeners in TestNG is ITestListener interface. It has methods like onTestStart, onTestSuccess, onTestFailure, onTestSkipped etc. We should implement this interface creating a listener class of our own. Next, we should add the listeners annotation (@Listeners) in the Class which was created.."
},{"id":"65",
"q":" Can captcha be automated?",
"answer":"No, captcha and bar code reader cannot be automated."
},{"id":"66",
"q":" What is a data driven framework?",
"answer" :"A data driven framework is one in which the test data is put in external files like csv, excel etc separated from test logic written in test script files. The test data drives the test cases, i.e. the test methods run for each set of test data values. TestNG provides inherent support for data driven testing using @dataProvider annotation."
},
{"id":"67",
"q":"What is a hybrid framework?",
"answer":"A hybrid framework is a combination of one or more frameworks.\n\nNormally it is associated with combination of data driven and keyword driven\n\nframeworks where both the test data and test actions are kept in external files(in the form of table)."
},{"id":"68",
"q":"What is a node in selenium grid?",
"answer":"Nodes are the machines which are attached to the selenium grid hub and have selenium instances running the test scripts.Unlike hub there can be multiple nodes in selenium grid."
},
{"id":"69",
"q":"How can we set priority of test cases in TestNG?",
"answer":"Using priority parameter in @Test annotation in TestNG we can define priority of test cases. The default priority of test when not specified is integer value 0. Example-\n\n@Test(priority=1)"
},
{"id":"70",
"q":" Name an API used for reading and writing data to excel files.",
"answer":"Apache POI API and JXL(Java Excel API) can be used for reading, writing and updating excel files."
},
{"id":"71",
"q":"Can we use Selenium grid for performance testing?",
"answer":"Yes. But not as effectively as a dedicated Performance Testing tool like Loadrunner."
},
{"id":"72",
"q":" Explain how you can handle colors in web driver?",
"answer":"Using linkText() and partialLinkText() we can locate a link. The difference between the two is linkText matches the complete string passed as parameter to the link texts. Whereas partialLinkText matches the string parameter partially with the link texts.\n\nWebElement link1 = driver.findElement(By.linkText(\"artOfTesting\"));\n\nWebElement link2 = driver.findElement(By.partialLinkText(\"artOf\"));"
},
{"id":"73",
"q":"How can we find all the links on a web page?",
"answer":"All the links are of anchor tag 'a'. So by locating elements of tagName 'a' we can find all the links on a webpage.\n\nList<WebElement> links = driver.findElements(By.tagName(\"a\"));"
},
{"id":"74",
"q":"What are DesiredCapabilities in selenium webdriver?",
"answer":"Desired capabilities are a set of key-value pairs that are used for storing or configuring browser specific properties like its version, platform etc in the browser instances. "
},
{"id":"75",
"q":"How can we find all the links on a web page? ",
"answer":"All the links are of anchor tag 'a'. So by locating elements of tagName 'a' we can find all the links on a webpage.\n\nList<WebElement> links = driver.findElements(By.tagName(\"a\"));"
},
{"id":"76",
"q":" How can we capture screenshots in selenium?",
"answer":"Using getScreenshotAs method of TakesScreenshot interface we can take the screenshots in selenium.\n\nFile scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);\n\nFileUtils.copyFile(scrFile, new File(\"D:\\testScreenShot.jpg\"));"
},
{"id":"77",
"q":"How can we check if an element is getting displayed on a web page?",
"answer":"Using isDisplayed method we can check if an element is getting displayed on a web page.\n\ndriver.findElement(By locator).isDisplayed();"
},
{"id":"78",
"q":" How can we check if an element is enabled for interaction on a web page?",
"answer":"Using isEnabled method we can check if an element is enabled or not.driver.findElement(By locator).isEnabled();"
},
{"id":"79",
"q":"What is the difference between driver.findElement() and driver.findElements() commands? ",
"answer":"The difference between driver.findElement() and driver.findElements() commands is-\n\nfindElement() returns a single WebElement (found first) based on the locator passed as parameter. Whereas findElements() returns a list of WebElements, all satisfying the locator value passed.\n\nSyntax of findElement()-\n\nWebElement textbox = driver.findElement(By.id(\"textBoxLocator\"));\n\nSyntax of findElements()-\n\nList <WebElement> elements = element.findElements(By.id(“value”));\n\nAnother difference between the two is- if no element is found then findElement() throws NoSuchElementException whereas findElements() returns a list of 0 elements."
},
{"id":"80",
"q":"What is Robot API?",
"answer":"Robot API is used for handling Keyboard or mouse events. It is generally used to upload files to the server in selenium automation.\n\nRobot robot = new Robot();\n\nrobot.keyPress(KeyEvent.VK_ENTER);"
}
]
}