ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Practical Interview Questions On Software Testing - Part 2
    카테고리 없음 2020. 3. 6. 03:21

    Recently I am getting messages with the core problem ‘Getting stuck in my Career’. No Interview calls. Only Automation. Tool-focused interviews.

    No practical tool experience. Especially from the 5-8+ experience bracket. Yeah!

    I know, continuous rejection is frustrating. I have been there. But nothing can be done about it. Accept the fact that industry has transitioned faster than your skills. We are awesome Functional testers. Superb Agile professionals. Good Domain knowledge.

    Effective Team managers. One of the most common situation, how will you start Testing without any functional requirement specification or any related documents? No wonder there are sometimes these kind of situations, ex. Resource attrition, no-documentation-with-agile-projects, etc. The only hope in these situations is ‘Exploratory Testing’. Since there are no documents to refer, refer the application directly? Explore it, Test it.

    Gradually the flows make sense and we actually start testing it. Other option is to sit with Business analysts and developers to get application understanding – listening to experts instead of reading a document. Any technology or tool is worthless unless it is being used by ‘some’ organization somewhere. It all starts from organizations adopting the new technology or a tool and then it gets popular slowly. In that sense QA Job Descriptions are a great source of current technology, i.e.

    Practical tech. Being used by IT organizations. Be it Selenium, Protractor, Appium, API tools, Big Data Testing, etc. Everything is embedded in the QA Job descriptions, you just need to mine some data 😉 But don’t worry. Continuing on our “JD Talks” series – we mine hundreds of QA Job descriptions to come up with latest tools, technology, languages and concepts.

    Let’s see what the fourth set of JDs talk about. As soon as you write Selenium Automation in your resume, interviewer is bound to give you a sheet of paper & ask write a Java program. Though Selenium doesn’t require extensive Java knowledge but still there is a set of basic Java programs that you should be able to write on-the-spot. Continuing on our Java interview series for Selenium Automation, this article covers five of the common Java Sort programs frequently asked in the basic technical interview. The questions are easy, but don’t forget to mark these java programs in your to do list before attending any entry-level technical interview for Selenium automation testing. “How do you connect to a Database?” the interviewer asked.

    That was simple, right. Using a Database connection string I said. But what do you pass in connection string and how does it works at the backend?

    They need the details. As a tester, most of the testing is centered on web applications (i.e. Browser) and now-a-days mobile apps.

    But as with API testing, Database testing & SQL is growing in demand. Database knowledge is something every tester is expected to know about. So with this article we try to explain how to connect to a database, in detail.

    Any technology or tool is worthless unless it is being used by ‘some’ organization somewhere. It all starts from organizations adopting the new technology or a tool and then it gets popular slowly.

    In that sense QA Job Descriptions are a great source of current technology, i.e. Practical tech. Being used by IT organizations.

    Be it Selenium, Protractor, Appium, API tools, Big Data Testing, etc. Everything is embedded in the QA Job descriptions, you just need to mine some data 😉 But don’t worry.

    Continuing on our “JD Talks” series – we mine hundreds of QA Job descriptions to come up with latest tools, technology, languages and concepts. Let’s see what the third set of JDs talk about.

    A thought that crosses every tester’s mind who is searching for a better QA opportunity. Why am I not getting selected?

    Because you were not the best fit. Best fit in terms of technology, experience, salary, attitude, skills, behavior, etc. Only QA knowledge is not enough to land you a job.

    Yes, companies look for the ‘Best Fit’ among the available candidates. Some look for tech-savvy candidates, other focus more on the learning attitude.

    Every company has its own set of guidelines – what we call as company culture. With this article, I try to elaborate on some of the perspectives around Software Testing interview. It has helped me, and I hope this helps fellow testers as well in their quest for the next dream job. Posts navigation.

    Testing

    Basic & Advanced Selenium Interview Questions:In this post, we see both basic and advanced Selenium Interview Questions. Our main focus is on Selenium WebDriver Interview Questions and also we write & too.Are you ready to ace your upcoming job interview? Wouldn’t it be great if you knew exactly what questions a hiring manager would be asking you in your next selenium automation coding interview? It’s always important to be prepared to respond effectively to the questions that interviewers typically ask.

    Interviewers or hiring managers may ask different questions based on your experience level. Here we have covered Selenium Interview Questions asked in companies.No mater you are an experienced or freshers, we have covered for all levels based on the requests we got from our readers.Before going ahead, let’s see some unavoidable Interview Questions such as What Are The Reasons For Choosing and.I don’t want to take much time of yours but I couldn’t move further without mentioning about this inevitable job interviews question which every hiring manager asks you in any interview i.e.,.In Selenium interviews, interviewers expect you to have good knowledge on Java.

    We have created this Selenium Java interview questions & Selenium Python interview questions for you.AndIn the below video, you can find some of the popular Selenium WebDriver Interview Questions which we didn’t mention in this post. Check the below video to watch “Real Time Selenium Interview Questions And Answers For Experienced And Freshers”. Please be patient. The selenium tester interview questions video will load in some time.1. What is Automation Testing?Automation testing is the process of testing a software or application using an automation testing tool to find the defects. In this process, executing the test scripts and generating the results are performed automatically by automation tools.

    It is required when we have huge amount of. Some most popular tools to do automation testing are HP QTP/UFT, etc., 2. What are the benefits of Automation Testing?This is one of the common interview questions in any Automation testing job. Saves time and money. Automation testing is faster in execution. Reusability of code. Create one time and execute multiple times with less or no maintenance.

    Easy reporting. It generates automatic reports after test execution. Easy for compatibility testing. It enables parallel execution in the combination of different OS and browser environments.

    Low-cost maintenance. It is cheaper compared to manual testing in a long run. Automated testing is more reliable. Automated testing is more powerful and versatile.

    Automation tools allow us to integrate with Tools, etc.,. It is mostly used for regression testing. Supports execution of repeated test cases. Minimal manual intervention.

    Test scripts can be run unattended. Maximum coverage. It helps to increase the test coverage.3. What are the challenges and limitations of Selenium WebDriver?As we all know Selenium WebDriver is a tool which automates the browser to mimic real user actions on the web.

    Selenium is a free open source testing tool. Some of the challenges with selenium webdriver are as follows. We cannot test windows application. We cannot test mobile apps. Limited reporting. Handling dynamic Elements.

    Handling page load. Handling pop up windows. Handling captcha4.

    What type of tests have you automated?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.5.

    How many test cases you have automated per day?It is one of the Selenium Tricky Interview Questions. Actually it depends on Test case scenario complexity and length. I did automate 2-5 test scenarios per day when the complexity is limited. Sometimes just 1 or fewer test scenarios in a day when the complexity is high. What is a Framework?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:.

    Keyword Driven Testing Framework. Hybrid Testing Framework.

    Behavioural Driven Framework7. Have you created any Framework?If you are a beginner: You can say “No, I didn’t get a chance to create framework from the scratch.

    I have used the framework which is already available. My contribution is mostly in creating test cases by using the existing framework.”If you are a beginner but have good knowledge on creating framework: You can say “Yes, I have involved in developing framework along with other automation tester in my company.”If you are an experienced tester: You can say “I have contributed in developing framework.” or You can say “Yes, I have created framework from the scratch. There was no automation process in my previous company. I designed the framework from the scratch.”8. Can you explain the Framework which you have used in your Selenium Project?Here we have clearly explained each component of Framework.

    Check this post to learn more about. Why do you prefer Selenium Automation Tool?I prefer Selenium Automation Tool because some of the benefits of Selenium to do automation testing are. Free and open source – It is a free open source tool. There is no need to allot budget for this tool. Help – Have large user base and helping communities.

    – It works on almost all popular browsers such as Chrome, Firefox, Internet Explorer, and Safari. Cross Platform compatibility – It works on platforms such as Windows, Linux, Mac.

    Multiple programming languages – It supports programming languages such as, Phyton, Perl, Php, C#, Ruby, etc.,. Parallel Execution – Selenium Grid supports parallel execution of Selenium Scripts. Continuous Integration – We can achieve nightly execution using Jenkins.10. What is Selenium?Selenium is an open source (free) automated testing suite to test web applications.

    It supports different platforms and browsers. It has gained a lot of popularity in terms of web-based automated testing and giving a great competition to the famous commercial tool HP QTP (Quick Test Professional) AKA HP UFT (Unified Functional Testing).Selenium is a set of different software tools. Each tool has a different approach in supporting web based automation testing.It has four components namely,. Selenium IDE (Selenium Integrated Development Environment). Selenium RC (Selenium Remote Control). Selenium WebDriver.

    Selenium Grid11. What is Selenium IDE?Selenium IDE (Integrated Development Environment) is a Firefox plugin.

    It is the simplest framework in the Selenium Suite. It allows us to record and playback the scripts. Even though we can create scripts using Selenium IDE, we need to use Selenium RC or Selenium WebDriver to write more advanced and robust test cases. What is Selenese?Selenese is the language which is used to write test scripts in Selenium IDE. Which is the only browser that supports Selenium IDE to be used?Firefox 14. What is Selenium RC?Selenium RC AKA Selenium Remote control / Selenium 1.

    Selenium Remote Control was the main Selenium project for a long time before the WebDriver merge brought up Selenium 2. Selenium 1 is still actively supported (in maintenance mode). It relies on JavaScript for automation. It supports Java, Javascript, Ruby, PHP, Python, Perl and C#.

    It supports almost every browser out there. What is Selenium WebDriver?Selenium WebDriver AKA Selenium 2 is a browser automation framework that accepts commands and sends them to a browser. It is implemented through a browser-specific driver. It controls the browser by directly communicating with it. Selenium WebDriver supports Java, C#, PHP, Python, Perl, Ruby.Learn 16. What is Selenium Grid?Selenium Grid is a tool used together with Selenium RC to run tests on different machines against different browsers in parallel.

    That is, running multiple tests at the same time against different machines running different browsers and operating systems. In simple words, it is used to distribute your test execution on multiple platforms and environments concurrently. When do you use Selenium Grid?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 18. What are the advantages of Selenium Grid?It allows running test cases in parallel thereby saving test execution time.It allows multi-browser testingIt allows us to execute test cases on multi-platform 19. What is a hub in Selenium Grid?A hub is a server or a central point that controls the test executions on different machines.

    What is a node in Selenium Grid?Node is the machine which is attached to the hub. There can be multiple nodes in Selenium Grid. What are the types of WebDriver APIs available in Selenium?. Firefox Driver. Gecko Driver.

    InternetExplorer Driver. Chrome Driver. HTMLUnit Driver. Opera Driver. Safari Driver. Android Driver. iPhone Driver.

    EventFiringWebDriver22. Which WebDriver implementation claims to be the fastest?The fastest implementation of WebDriver is the HTMLUnitDriver. It is because the HTMLUnitDriver does not execute tests in the browser. Starting a browser and running test cases took more time compared to running the scripts without a browser. HTMLUnitDriver took a simple HTTP request-response mechanism for test case execution.23.

    What are the Programming Languages supported by Selenium WebDiver?. C#. Python.

    Ruby. Perl. PHP24. Which language is not supported by selenium?Selenium supports all major programming languages such as Java, C#, Perl, Python, Ruby, PHP, Scala and Groovy. As of today, others are not compatible. What are the Operating Systems supported by Selenium WebDriver?.

    Windows. Linux. Mac OS X. iOS. Android26.

    What are the testing types that can be supported by selenium?Testing types that can be supported by Selenium are as follows:. Functional Testing. Regression Testing. Retesting. Acceptance Testing.

    End-to-End Testing. Smoke Testing. Sanity Testing. Responsive Testing. Cross Browser Testing. UI Testing.

    Integration Testing27. How many parameters can selenium commands have at minimum?There are four parameters that you have to pass in Selenium are. Host. Port Number. Browser. URLHost: It is the parameter which we use to bind Selenium to a specific IP. Usually, we run selenium tests on our local machine so the value will be ‘localhost’.

    You can sepcify IP address instead of localhost.java -jar -host Port Number: TCP/IP port which is used to connect selenium tests to the selenium grid hub. Default port hub is 4444.java -jar -role hub -port 4444Make sure no other application in your system is using this port. You may face an exception like Exception in thread “main” java.net.BindException: Selenium is already running on port 4444. Or some other service is.If this occurs you can either shutdown the other process that is using port 4444, or you can tell Selenium-Grid to use a different port for its hub. Use the -port option for changing the port used by the hub.java -jar -role hub -port 4441Browser: To pass the browser which has to execute our selenium scriptsURL: To pass the application URL 28. What are the Open-source Frameworks supported by Selenium WebDriver?. JUnit.

    TestNGRead: 29. What are the Locators available in Selenium?In Selenium WebDriver, there are 8 different types of locators. ID –. ClassName –.

    Name –. TagName –. LinkText –. PartialLinkText –.

    XPath –. CSS Selector –Click here to see the detailed post on. What is an XPath?XPath is used to locate the elements. Using XPath, we could navigate through elements and attributes in an XML document to locate web elements such as textbox, button, checkbox, Image etc., in a web page.31. When you use these locators ID, Name, XPath, Or CSS Selector?ID & Name locators will be used when there are unique identifiers & unique names available on the web page.CSS Selector can be used for performance and when ID & Name locators are not unique.XPath is used when there is no preferred locators.

    What is the difference between “/” and “//”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.Double 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. What is the difference between Absolute Path and Relative Path?Absolute XPath starts from the root node and ends with desired descendant element’s node. It starts with top HTML node and ends with input node. It starts with a single forward slash(/) as shown below. What is the difference between Assert and Verify in Selenium?Assert: In simple words, if the assert condition is true then the program control will execute the next test step but if the condition is false, the execution will stop and further test step will not be executed.Verify: In simple words, there won’t be any halt in the test execution even though the verify condition is true or false.For detailed post check the below link.35.

    What are Soft Assert and Hard Assert in Selenium?Soft Assert: Soft Assert collects errors during @Test Soft Assert does not throw an exception when an assert fails and would continue with the next step after the assert statement.Hard Assert: Hard Assert throws an AssertException immediately when an assert statement fails and test suite continues with next @TestDetailed Post: 36. What is the difference between setSpeed and sleep methods?Both sleep and setSpeed are used to delay the execution speed.setSpeed: It set up speed that will apply a delay time before every Selenium operation.sleep: It set up wait only for once when called in our Selenium script. What are the verification points available in Selenium?In Selenium IDE, we use Selenese Verify and Assert Commands as Verification pointsIn Selenium WebDriver, there is no built-in features for verification points. It totally depends on our coding style.

    Some of the Verification points are. To check for page title. To check for certain text.

    To check for certain element (text box, button, drop down, etc.)38. How to launch a browser using Selenium WebDriver?WebDriver is an Interface. We create an Object of a required driver class such as FirefoxDriver, ChromeDriver, InternetExplorerDriver etc.,To launch Firefox Driver:WebDriver driver = new FirefoxDriver;Note: If you use geckodriver with Selenium, you must upgrade to Selenium 3.3. Here we have to set the property as follows.

    SetProperty ( 'webdriver.gecko.driver', 'D:Selenium EnvironmentDriversgeckodriver.exe' );To launch Chrome Driver:WebDriver driver = new ChromeDriver;To launch Internet Explorer Driver:WebDriver driver = new InternetExplorerDriver;To launch Safari Driver:WebDriver driver = new SafariDriver; 39. Is the FirefoxDriver a Class or an Interface?FirefoxDriver is a Java class, and it implements the WebDriver interface.

    What is the super interface of WebDriver?SearchContext acts as the super interface of Web Driver. Explain the line of code Webdriver driver = new FirefoxDriver;? FirefoxDriver driver = new FirefoxDriver ( );If we create a reference variable driver of type WebDriver then we could use the same driver variable to work with any browser of our choice such as IEDriver, SafariDriver etc., 43. What is WebElement selenium?WebElement in Selenium represents an HTML element. It basically represents a DOM element in a HTML document. What are the different exceptions you have faced in Selenium WebDriver?Some of the exceptions I have faced in my current project are. ElementNotVisibleException.

    StaleElementReferenceExceptionElement Not visible Exception:This exception will be thrown when you are trying to locate a particular element on webpage that is not currently visible eventhough it is present in the DOM. Also sometimes, if you are trying to locate an element with the xpath which associates with two or more element.Stale Element Reference Exception.

    A is thrown in one of two cases, the first being more common than the second.The two reasons for Stale element reference are. The element has been deleted entirely. The element is no longer attached to the DOM.We face this stale element reference exception when the element we are interacting is destroyed and then recreated again. When this happens the reference of the element in the DOM becomes stale.

    Hence we are not able to get the reference to the element.Some other exceptions we usually face are as follows:. WebDriverException. IllegalStateException. TimeoutException. NoAlertPresentException. NoSuchWindowException. NoSuchElementException45.

    How to handle STALEELEMENTREFERENCEEXCEPTION?Before looking how to handle Stale Element Reference Exception through Page Object Model. Let’s see what is Stale Element Reference Exception first.Stale means old, decayed, no longer fresh. Stale Element means an old element or no longer available element.

    Assume there is an element that is found on a web page referenced as a WebElement in WebDriver. If the DOM changes then the WebElement goes stale. If we try to interact with an element which is staled then the StaleElementReferenceException is thrown.Here we have given solutions to in detail. What are the types of waits available in Selenium WebDriver?In Selenium we could see three types of waits such as Implicit Waits, Explicit Waits and Fluent Waits. Implicit Waits –.

    Explicit Waits –. Fluent Waits –47. What is Implicit Wait In Selenium WebDriver?Implicit waits tell to the WebDriver to wait for a certain amount of time before it throws an exception. Once we set the time, WebDriver will wait for the element based on the time we set before it throws an exception. The default setting is 0 (zero).

    We need to set some wait time to make WebDriver to wait for the required time.48. What is WebDriver Wait In Selenium WebDriver?WebDriverWait is applied on a certain element with defined expected condition and time.

    This wait is only applied to the specified element. This wait can also throw an exception when an element is not found.49. What is Fluent Wait In Selenium WebDriver?FluentWait can define the maximum amount of time to wait for a specific condition and frequency with which to check the condition before throwing an “ ElementNotVisibleException” exception.50. What happen if you mix both implicit wait and explicit wait in a Selenium Script?As per the official Selenium documentation, it is suggested not to mix both Implicit waits and Explicit Waits. Mixing both of them can cause unpredictable wait times.Implicit wait is defined only once in the code. It will remain same throughout the driver object instance.Explicit wait is defined whenever it is necessary in the code. This wait will call at the time of execution.

    It is a conditional wait.Explicit wait will overwrite the implicit wait where ever explicit wait is applied. So, Explicit Wait gets first preference then Implicit Wait. What happen if you mix both Thread.Sleep and WebDriver Waits in a Selenium Script?Thread.sleep method can be used to pause the execution for specified time in millisecondsIf we use WebDriver waits along with Thread.sleep method then webdriver will hold the execution for specified time and then will follow other wait.

    Test execution time will become more, if we mix both waits. How to Login into any site if it is showing an Authentication Pop-Up for Username and Password?To do this we pass username and password with the URL. What is the alternative to driver.get method to open an URL using Selenium WebDriver?Alternative method to driver.get(“url”) method is driver.navigate.to(“url”) 65. What is the difference between driver.get and driver.navigate.to(“url”)?driver.get: To open an URL and it will wait till the whole page gets loadeddriver.navigate.to: To navigate to an URL and It will not wait till the whole page gets loaded 66. Can I navigate back and forth in a browser in Selenium WebDriver?We use Navigate interface to do navigate back and forth in a browser. It has methods to move back, forward as well as to refresh a page.driver.navigate.forward; – to navigate to the next web page with reference to the browser’s historydriver.navigate.back; – takes back to the previous webpage with reference to the browser’s historydriver.navigate.refresh; – to refresh the current web page thereby reloading all the web elementsdriver.navigate.to(“url”); – to launch a new web browser window and navigate to the specified URL 67.

    What are the different types of navigation commands?Refer above question (Can I navigate back and forth in a browser) 68. How to fetch the current page URL in Selenium?To fetch the current page URL, we use getCurrentURL. DeleteAllCookies ( );71. What are the ways to refresh a browser using Selenium WebDriver?There are multiple ways to refresh a page in selenium. Using driver.navigate.refresh command as mentioned in the question 45.

    Using driver.get(“URL”) on the current URL or using driver.getCurrentUrl. Using driver.navigate.to(“URL”) on the current URL or driver.navigate.to(driver.getCurrentUrl);. Using sendKeys(Keys.F5) on any textbox on the webpage72. What is the difference between driver.getWindowHandle and driver.getWindowHandles in Selenium WebDriver?driver.getWindowHandle – It returns a handle of the current page (a unique identifier)driver.getWindowHandles – It returns a set of handles of the all the pages available. What is the difference between driver.close and driver.quit methods?Purpose of these two methods (driver.close and driver.quit) is almost same. Both allow us to close a browser but still, there is a difference.driver.close: To close current WebDriver instancedriver.quit: To close all the opened WebDriver instances 74. What is the difference between driver.findElement and driver.findElements commands?The difference between driver.findElement and driver.findElements commands is-.

    findElement 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. Syntax of findElement-WebElement textbox = driver.findElement(By.id(“textBoxLocator”));Syntax of findElements-List elements = element.findElements(By.id(“value”));. Another difference between the two is- if no element is found then findElement throws NoSuchElementException whereas findElements returns a list of 0 elements.75.

    What Is The Difference Between MaxSessions Vs. MaxInstances Properties in Selenium Grid?MaxInstances is the no.

    Of browser instances of the same version of the browser that can run on the remote machine.Let’s see an example below. Browser browserName= firefox, version= 11, maxInstances= 2, platform= WINDOWSAs per the above example, it will allow us to run 4 instances of both IE and Firefox at the same time (in parallel) in a remote machine.MaxSession says how many browsers, independent of the type & version, can run in parallel on the remote machine.It supersedes the “MaxInstances” setting.If maxSession=1 then no more than a single browser would run. If maxSession=2 then any of the below combinations can run at a time irrespective of what MaxInstances we have defined.2 Internet Explorer2 Firefox1 Internet Explorer + 1 Firefox 76.

    How to find whether an element is displayed on the web page?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. isDisplayed. SelectByValue ( Value );78.

    How to capture Screenshot in Selenium WebDriver?Test cases may fail while executing the test scripts. While we are executing the test cases manually we just take a screenshot and place in a result repository. The same can be done by using Selenium WebDriver.Some of the scenarios we may need to capture a screenshot using Selenium WebDriver arei. Application issuesii. Assertion Failureiii. Difficulty to find Webelements on the web pageiv. Timeout to find Webelements on the web pageSelenium provides an interface called TakesScreenshot which has a method getScreenShotAs which can be used to take a screenshot of the application under test.In Selenium 3, we may face few issues while capturing Screenshots. To overcome we use aShot utility. Click on below links to see posts related to the normal way of capturing a screenshot and capturing a screenshot using aShot utility.79.

    How to mouse hover on a web element using WebDriver?By using Actions class. MoveToElement ( ele ). Perform ( );80. How can we handle Web-based Pop-ups or Alerts in Selenium?To handle Web-based alerts or popups, we need to do switch to the alert window and call Selenium WebDriver Alert API methods.dismiss: To click on Cancel button.accept: To Click on OK button.getText: To get the text which is present on the Alert.sendKeys: To enter the text into the alert box.81. How can we handle windows based pop up?Selenium doesn’t support windows based applications. It is an automation testing tool which supports only web application testing. We could handle windows based popups in Selenium using some third party tools such as AutoIT, Robot class etc.

    How to handle hidden elements in Selenium WebDriver?It is one of the most important selenium interview questions.We can handle hidden elements by using javaScript executor. FindElement ( By. Id ( 'Id Value' ) ). Click ( );Sometimes web controls don’t react well against selenium commands and we may face issues with the above statement (click).

    To overcome such kind of situation, we use JavaScriptExecutor interface.It provides a mechanism to execute Javascript through Selenium driver. It provides “executescript” & “executeAsyncScript” methods, to run JavaScript in the context of the currently selected frame or window.There is no need to write a separate script to execute JavaScript within the browser using Selenium WebDriver script. Just we use predefined interface named ‘Java Script Executor’.

    We need to import the JavascriptExecutor package in the script.Package. ExecuteScript ( Script, Arguments );Script – The JavaScript to executeArguments – The arguments to the script(Optional). May be empty.Returns – One of Boolean, Long, String, List, WebElement, or null.Let’s see some scenarios we could handle using this Interface:1. To type Text in Selenium WebDriver without using sendKeys method2. To click a Button in Selenium WebDriver using JavaScript3. To handle Checkbox4.

    To generate Alert Pop window in selenium5. To refresh browser window using Javascript6. To get innertext of the entire webpage in Selenium7. To get the Title of our webpage8.

    To get the domain9. To get the URL of a webpage10. To perform Scroll on an application using Selenium11. To click on a SubMenu which is only visible on mouse hover on Menu12. To navigate to different page using Javascript 87. How do you read test data from excels?Test data can efficiently be read from excel using JXL or POI API. POI API has many advantages than JXL.Click here to see a practical example of using.

    Software Testing Help

    Is it possible to automate the captcha using Selenium?No, It’s not possible to automate captcha and bar code reader. Can You Use Selenium For Rest API Testing Or Web Services Testing?Simple answer for this is Selenium is not a tool for API Testing. It automates web browsers.

    Rest API & Web Services contains no UI. So we cannot automate using Selenium. How to handle Ajax calls in Selenium WebDriver?Handling AJAX calls is one of the common issues when using Selenium WebDriver. We wouldn’t know when the AJAX call would get completed and the page has been updated. In this post, we see how to handle AJAX calls using Selenium.AJAX stands for Asynchronous JavaScript and XML.

    AJAX allows the web page to retrieve small amounts of data from the server without reloading the entire page. AJAX sends HTTP requests from the client to server and then process the server’s response without reloading the entire page. To handle AJAX controls, wait commands may not work.

    It’s just because the actual page is not going to refresh.When you click on a submit button, the required information may appear on the web page without refreshing the browser. Sometimes it may load in a second and sometimes it may take longer. We have no control over loading time. The best approach to handle this kind of situations in selenium is to use dynamic waits (i.e. WebDriverWait in combination with ExpectedCondition)Some of the methods which are available are as follows:1. TitleIs – The expected condition waits for a page with a specific title. Until ( ExpectedConditions.

    TextToBePresentInElement ( By. Id (“ title’” ), “ text to be found” ) );91. List some scenarios which we cannot automate using Selenium WebDriver?1. Bitmap comparison is not possible using Selenium WebDriver2. Automating Captcha is not possible using Selenium WebDriver3. We can not read bar code using Selenium WebDriver 92. What is Object Repository in Selenium WebDriver?Object Repository is used to store element locator values in a centralized location instead of hard coding them within the scripts.

    We do create a property file (.properties) to store all the element locators and these property files act as an object repository in Selenium WebDriver. How you build Object Repository in your project?In QTP, there is an Object Repository concept.

    Practical Interview Questions On Software Testing - Part 2 Online

    When a user records a test, the objects and its properties are captured by default in an Object Repository. QTP uses this Object Repository to play back the scripts. Coming to Selenium, there is no default Object Repository concept. It doesn’t mean that there is no Object Repository in Selenium.

    Even though there is no default one still we could create our own. In Selenium, we call objects as locators (such as ID, Name, Class Name, Tag Name, Link Text, Partial Link Text, XPath, and CSS). Object repository is a collection of objects. One of the ways to create Object Repository is to place all the locators in a separate file (i.e., properties file). But the best way is to use Page Object Model. In the Page Object Model Design Pattern, each web page is represented as a class. All the objects related to a particular page of a web application are stored in a class.

    Interview

    What is Page Object Model in Selenium?is a Design Pattern which has become popular in Selenium Test Automation. It is widely used design pattern in Selenium for enhancing test maintenance and reducing code duplication. Page object model (POM) can be used in any such as modular, keyword driven, hybrid framework etc.

    A page object is an object-oriented class that serves as an interface to a page of your Application Under Test(AUT). The tests then use the methods of this page object class whenever they need to interact with the User Interface (UI) of that page. The benefit is that if the UI changes for the page, the tests themselves don’t need to change, only the code within the page object needs to change.

    Subsequently, all changes to support that new UI is located in one place. What is Page Factory?We have seen that ‘Page Object Model’ is a way of representing an application in a test framework. For every ‘page’ in the application, we create a Page Object to reference the ‘page’ whereas a ‘Page Factory’ is one way of implementing the ‘Page Object Model’. What is the difference between Page Object Model (POM) and Page Factory?Page Object is a class that represents a web page and hold the functionality and members.Page Factory is a way to initialize the web elements you want to interact with within the page object when you create an instance of it. What are the advantages of Page Object Model Framework?Code reusability – We could achieve code reusability by writing the code once and use it in different tests.Code maintainability – There is a clean separation between test code and page specific code such as locators and layout which becomes very easy to maintain code. Code changes only on Page Object Classes when a UI change occurs.

    It enhances test maintenance and reduces code duplication.Object Repository – Each page will be defined as a java class. All the fields in the page will be defined in an interface as members. The class will then implement the interface.Readability – Improves readability due to clean separation between test code and page specific code 98. How can you use the Recovery Scenario in Selenium WebDriver?By using “ Try Catch Block” within Selenium WebDriver Java tests.

    SwitchTo ( ). Frame ( );103.

    How to connect a Database in selenium?As we all know Selenium WebDriver is a tool to automate User Interface. We could only interact with Browser using Selenium WebDriver.We use JDBC Driver to connect the Database in Selenium (While using Java Programming Language).104. How To Resize Browser Window Using Selenium WebDriver?To resize the browser window to particular dimensions, we use ‘Dimension’ class to resize the browser window.105. How To Scroll Web Page Down Or UP Using Selenium WebDriver?JavaScript scrollBy method scrolls the document by the specified number of pixels.106. How To Perform Right Click Action (Context Click) In Selenium WebDriver?We use Actions class in Selenium WebDriver to do Right-Click (Context Click) action.107. How To Perform Double Click Action In Selenium WebDriver?We use Actions class to do Double click action in selenium.108. How To Perform Drag And Drop Action in Selenium WebDriver?In some applications, we may face a situation to automate drag and drop an item from one location to another location. We could not achieve these using basic elements.

    Selenium has provided an “Actions” class to handle this kind of scenarios. We overcome this kind of scenarios such as drag and drop using Actions Class.To achieve this, we use Actions class in Selenium WebDriver.109. How To Highlight Element Using Selenium WebDriver?By using JavascriptExecutor interface, we could highlight the specified element110. Have you used any crossbrowsertesting tool to run selenium scripts on cloud?I have used BrowserStack to run selenium tests on multiple browsers & Multiple operating systems in parallel.

    Earlier we have made a video on how to use BrowserStack to run selenium scripts on the cloud. Find the link in the description below. What is desired capabilities?In Selenium we use desired capabilities to handle SSL certificates in chrome browserWe need to create an instance of DesiredCapabilities. DesiredCapabilities desiredCapability = DesiredCapabilities. Chrome ( );112. What is Continuous Integration?Continuous Integration is abbreviated as CI.

    Continuous Integration is a development practice which aims to make sure the correctness of a software. After each commit, a suite of tests run automatically and test the software to ensure whether the software is running without any breaks. If any test fails, we will get immediate feedback say “build is broken”.In simple words, continuous integration is a process of verifying the correctness of a software.Some of the continuous integration tools are Jenkins, TeamCity, Bamboo, Travis, Circle Ci, Bitbucket.We can schedule the test suite execution using these CI Tools. How to achieve Database testing in Selenium?As we all know Selenium WebDriver is a tool to automate User Interface.

    We could only interact with Browser using Selenium WebDriver.Sometimes, we may face a situation to get the data from the Database or to modify (update/delete) the data from the Database. If we plan to automate anything outside the vicinity of a browser, then we need to use other tools to achieve our task. To achieve the Database connection and work on it, we need to use JDBC API Driver.The Java Database Connectivity (JDBC) API provides universal data access from the Java programming language. Using the JDBC API, you can access virtually any data source, from relational databases to spreadsheets and flat files.

    It lets the user connect and interact with the Database and fetch the data based on the queries we use in the automation script. JDBC is a SQL level API that allows us to execute SQL statements. It creates a connectivity between Java Programming Language and the database.Using JDBC Driver we could do the followingi. Establish a Database connectionii. Send SQL Queries to the Databaseiii. Process the results 114.

    How to delete Browser Cookies with Selenium Web Driver? DeleteAllCookies ( );TestNG Interview Questions:Here we have dealt with some important TestNG interview questions. If you want to learn more interview questions related to TestNG then here you go. We have a special post on. Also, you could find here 115.

    What is TestNG?TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing to. What are the annotations available in TestNG?@BeforeTest@AfterTest@BeforeClass@AfterClass@BeforeMethod@AfterMethod@BeforeSuite@AfterSuite@BeforeGroups@AfterGroups@Test 117. What is TestNG Assert and list out some common Assertions supported by TestNG?TestNG Asserts help us to verify the condition of the test in the middle of the test run.

    Based on the TestNG Assertions, we will consider a successful test only if it is completed the test run without throwing any exception.Some of the common assertions supported by TestNG are. assertEqual(String actual,String expected). assertEqual(String actual,String expected, String message).

    assertEquals(boolean actual,boolean expected). assertTrue(condition). assertTrue(condition, message). assertFalse(condition).

    assertFalse(condition, message)118. How to create and run TestNG.xml?In TestNG framework, we need to create T estNG 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.119. How to set test case priority in TestNG?We use priority attribute to the @Test annotations. In case priority is not set then the test scripts execute in alphabetical order. Test Case 2120. What is Parameterized testing in TestNG?Parameterized tests allow developers to run the same test over and over again using different values.There are two ways to set these parameters:. with testng.xml -.

    with Data Providers –121. How to run a group of test cases using TestNG?TestNG allows you to perform sophisticated groupings of test methods. Not only can you declare that methods belong to groups, but you can also specify groups that contain other groups. Then TestNG can be invoked and asked to include a certain set of groups (or regular expressions) while excluding another set.

    This gives you maximum flexibility in how you partition your tests and doesn’t require you to recompile anything if you want to run two different sets of tests back to back.Groups are specified in your testng.xml file and can be found either under the or tag. Groups specified in the tag apply to all the tags underneath. WebDriver player = new ChromeDriver ( options );I would like to conclude this post here. Final words, Bookmark this post “Selenium Interview Questions” for future reference. We are keep on updating this post based on user requests.We got multiple requests from our readers. Some of them I have included here.

    Is there any selenium certification?Usually, certifications are provided by companies that have developed a propritey tool like QTP, AWS, Salesforce etc., Selenium is an open source software testing tool. There are many certification providers (training institutes) who provide certification in Selenium but Selenium being open source software, it does not offer any certification of their own. If I am in your position, I prefer certification in a programming language like Java instead of Selenium. Can I learn selenium on my own?You can self learn Selenium. I know many automation testers who learn selenium on their own by going through Selenium blogs like SoftwareTestingMaterial. Learn Selenium online and practice it until you feel confident. Once you become confident include your automation skills in your resume and if possible showcase your automation skills to your managers.

    So that you may grab an opportunity in your current organization itself.Before learning Selenium I suggest you learn Manual Testing concepts and Java (core Java is fine). Start with Java and then move on to Selenium. What are the basics of selenium?Selenium suite is comprised of 4 basic components namely Selenium IDE, Selenium RC, WebDriver, and Selenium Grid. Is Selenium easy to learn?Yes ofcourse. Learning Selenium is easy.

    How many days it will take to learn selenium?1-2 Months enough if you can spend atleast 3-4 hours pers day. Please add Selenium interview questions for freshersHere we have covered most of the interview questions which help you to attend Selenium Interview as a fresher. Please include Selenium interview questions for 2 years experienceHopefully we have covered most of the interview questions for 2 years experienced.

    I have three years of experience and I would like to prepare for an interview. Please include Selenium interview questions for 3 years experience.We have covered Selenium WebDriver interview questions for 3 years experienced too. I am working as a manual tester and applying for automation job. Can you please list Selenium interview questions for 5 years experience etc.,This list of 100+ Selenium Interview questions help you to crack your interview. If you have any queries, you can comment below. Our team will help you.We are here to help you guys, we will include Selenium advanced interview questions frequently. Also we are planning to provide Selenium Interview Questions and Answers PDF Download link.

    Check out this space again to download it.Don’t miss. Hi Prajwal, It depends on experience and company.

Designed by Tistory.