• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/65

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

65 Cards in this Set

  • Front
  • Back
What is Selenium?

Selenium is a free automated testing suite used to test web applications. It supports different platforms and browsers. The four components of Selenium are Selenium I.D.E., Selenium RC, Selenium Webdriver, and Selenium Grid.

Can you describe the architecture of Selenium?

Selenium IDE, Selenium RC(Selenium 1), Selenium Webdriver, and Selenium Grid.

What is Selenium IDE?
It is a Firefox plugin that uses the Selenese language to write test scripts in the IDE. It stands for Selenium Integrated Development Environment. It is the simplest framework in the Selenium Suite. It allows us to record and playback the scripts.





What is Selenium RC

Selenium RC is also known as Selenium 1. Selenium RC 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) but many see it as obsolete. It relies on JavaScript for automation but can also support Java.

What is Selenium Webdriver?

Selenium WebDriver 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.

What is Selenium Grid?

Selenium Grid is a feature in Selenium that allows you to run test cases in different machines across different platforms.

What are the types of Webdriver APIs that are available in Selenium?
Some of the most popular ones are ChromeDriver, Firefox Driver, GeckoDriver, AndroidDriver
How many parameters can Selenium have at minimum?
The four parameters that you have to pass in Selenium are Host, Port Number, Browser, and URL. Host is the parameter that we use to bind Selenium to a specific IP. Port number is the IP port that is used to connect Selenium tests to the selenium grid hub. Browser and URL are just the browser and application URL that we will use to execute our Selenium scripts.
What is Automation Testing?
Automation testing is the process of using tools to test a software or application. In this process, we execute the test scripts and generate the results with an automation tool. The most popular tool for automation testing is Selenium Webdriver.



The benefits of automation testing are that it saves time and money. You can reuse the code and it is also easy to report.




Some of the limitations are that we cannot test windows applications, it is hard to handle dynamic elements, and it is impossible to automate captcha. It is also impossible to read bar codes.

What is a framework?
Bodies of code written by devs to create a product

What is Encapsulation? An example of it in Selenium?

Encapsulation is data hiding.



All classes in an automation framework are examples of encapsulation. We use Page Factory model to encapsulate WebElements in to Page Objects

What is Abstraction? What is an example of it in Selenium?

Abstraction is the methodology of hiding the implementation of internal details and showing the functionality to the user. It is implementation hiding.




Abstract class is used in defining common super class while writing Page Object Model. We usually create an abstract class named BasePage to have all common members for every page written in this class(example. getPageTitle)


Webdriver itself is an interface(which is abstraction). Listeners are also abstraction

An example of Interface in your Automation Framework?

WebDriver driver = new ChromeDriver();




WebDriver itself is an Interface.We are initializing Chrome browser using Selenium WebDriver. It means that we are creating a referance variable(driver) of the interface(WebDriver) amd creating an Object.

An example of Inheritance in your automation framework?
We create a Base/Generic class in the Framework to initialize WebDriver interface, waits, etc.We extend the Base/Generic class into other classes.
An example of Polymorphism in your automation framework
Method Overloading- Implicit wait is an example of method overloading. In implicit wait, we use different time stamps such as SECONDS, MINUTES, HOURS, etc.



Method Overriding- We use a method which was already implemented in another class by changing its parameters.For example, we can create a null Thread.sleep() method in the base class. When we inherit it we can add the time(5 seconds)

How to group test cases?

You can use TestNG to group test cases similarly to how Cucumber has tags. You give the testcases a group and then in the testNG.xml file you say which groups you want to run

How to run Grouped Test cases

This will run the group "smokeTest"

What are meta groups?

Groups within groups




In the testNG.xml file you can put groups inside of other groups. This is called MetaGroups

How do you launch the Browser and Navigate to a URL?

WebDriver driver = new ChromeDriver();


driver.get("URL);

What is Soft Assert and Hard Assert?

Hard Assert throws an exception immidiatelywhen an assert statement fails.


Soft assert will not immediately throw an exception. Instead it will just collect all the errors and move on to the next step

What is Keyword-Driven testing? What is Data Driven testing?

In Keyword Driven we use a table format to define keywords or action words for each function/method that we would execute. It performs automation test scripts based on the keyword specified in the excel sheet




Data-Driven is focused on seperating the test scripts logic and the test data from each other. The test data is kept in external files such as Excel sheets and SQL database. The test scripts connect to the external resources to get the test data

How do I connect to SQL and get data from a Table(In order to do Data Driven Testing)

First you need to ConnectToSqlDB



Then you make a List that reads the online database

How do I use data from SQL to search up information

First you need to insert the class.



You make a List


You use a for loop to get the data

How do I connect to an Excel file to get Keywords from a table(For Keyword Driven)

You have to use the ConnectToExcelFile class



Then you have to make a String array where you put the path to the excel sheet and then read the data using the "fileReader2" method

How do I use the Keywords from a Table to run Methods?

You have to use switch statements

Drag and Drop

You use the Selenium Actions class.Drag and Drop method accepts two parameters source locator(start) and target locator(end)

How to run parallel test cases

We can use the "parallel" attribute in testng.xml to accomplish parallel test execution The parallel attribute of suite tag can accept 4 values


Tests-All the tests cases inside tag of testng.xml will run parallel


Classes-All the test cases inside a java class will run parallel


Methods-All methods with @Test annotation will execute parallel


Instances-Test cases in same instance will execute parallel BUT two methods in two different instances will run in different thread

How to exclude specific methods?

By adding the exclude tag in testng.xml. with this you can run all the methods in a class while excluding the ones you want

How do you set up test case priority

We can use the priority attribute to set the order of the test scripts

How to Hover over an element

You can use the Selenium action class and use the "moveToElement" method

How to check if something is Displayed, Enabled, or Clicked without using TestNG Assert

Pre-Requests Script vs Tests(Postman)

Pre-Requests script is a script that will always run before the request is started. Tests always run AFTER the request is done(Think of it like Before Method and After Method)


You can set scripts on different levels(Just like Variables).


1)Request


2)Folder


3)Collection


Request gets precedence

What are the Locators available in Selenium?
The locators are ID, Name, Class Name, Tag Name, LinkTest, Partial LinkTest, XPath, and 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 WebElement selenium?
WebElement in Selenium represents an HTML element. It basically represents a DOM element in a HTML document.
What is an XPath?
An XPath is something that we use to locate the elements. Using XPath we could navigate through elements and attributes in an XML document to locate the web elements
What is the difference between Absolute Path and Relative Path?
An absolute XPath starts from the root node and ends with the desired descendant element's node. It starts with the top HTML node and ends with the input node. When you create an absolute path you use /



Relative path can start from any node between the HTML page to the current element's node which is the last node of the element. We create relative paths with //

What are Soft Assert and Hard Assert in Selenium?
Hard asserts throws an exception immediately after an assert statement fails. It will stop the test.



Soft Assert will not immediately throw an exception or stop the test. Instead, it will just collect all the errors and move on to the next step.

What is the difference between setSpeed() and sleep() methods?
Both the sleep() and setSpeed() methods are used to delay the execution speed.setSpeed() will apply a delay time before every Selenium operation while sleep() will only apply the delay once(when its called)
How do you launch a browser in Selenium?
WebDriver driver = new ChromeDriver();



ChromeDriver is a class, and it implements the WebDriver interface




‘WebDriver‘ is an interface and we are creating an object of type WebDriver instantiating an object of ChromeDriver class.

What are some exceptions you have faced in Selenium?
One of the most common exceptions is ElementNotVisibleException. This exception will be thrown when you are trying to locate a particular element on the webpage that is not currently visible even though it is present in the DOM. You can deal with this exception by using waits.



(DOM is Document Object Model. It is a cross-platform and language-independent interface that treats an XML or HTML document as a tree structure wherein each node is an object representing a part of the document. It is JavaScript so you dont need to know it)

What are the different types of waits in Selenium?
The three types of waits are Implicit Wait, Explicit Wait, and Fluent Wait.



Implicit waits tell 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.




Explicit wait is applied on a certain element with a expected condition and time. There are a lot of different types of expected conditions like titleContains(), alertIsPresent(), and elementToBeSelected().




Fluent wait sets a time and a frequency.

What happens if you mix both implicit and explicit wait?
Explicit wait will overwrite the implicit wait.Explicit wait is defined whenever it is necessary in the code. Implicit wait is defined only once in the code and it will remain the same throughout the driver object instance. Because explicit wait is more specific then it gets first preference.
What happens if you mix both sleep() and Implicit wait in Selenium?
If we use both of the waits then they will stack.sleep() will pause the execution first and then the implicit wait will follow
How to login into any site if it is showing an Authentication Pop-up for Username and Password?
We pass the username and password with the URL



http://username:password@urlHttp://KingIceSonic:Kimlasca@ebay.com

Important Selenium methods
You can input text into the text box by using the sendKeys() method



driver.findElement().sendKeys();




You can clear the text of a text box by using the clear() method




driver.findElement().clear();




You can get the text of a web element by using the getText() method




String text= driver.findelement().getText();


System.out.println(text);




Fetch the current page URL in Selenium.




driver.getCurrentUrl();




To maximize the browser we use the maximize() method




driver.manage().window().maximize();




You can use the deleteAllCookies() method to delete the cookies.




driver.manage().deleteAllCookies();




You can use driver.close() to close the Webdriver




You can submit a form using the submit() method.




driver.findElement().submit();




To press the enter key you need to use the Selenium Enum Keys. Keys.ENTER

How to input text in the text box without using sendKeys()?
You can use the JavascriptExecutor
You can use the JavascriptExecutor
How do you click on a hyperlink using Selenium Webdriver?
By using the click() method. There is a selector specifically made for linkText. You can click on it like any other selector
What are the two ways to open an URL?
driver.get("url")

driver.navigate.to("url)




driver.get() will open the URL and wait for the page to load. driver.navigate.to() will open the URL and it will NOT wait for the whole page to load

What are the different types of navigation commands in Selenium Webdriver?

You can use the Navigate interface to navigate back and forth in a browser. driver.navigate().back will take you to the previous page while driver.navigate().forward will take you to the next page. driver.navigate().refresh will refresh the current page.



driver.navigate().forward();

driver.navigate().back();


driver.navigate().refresh();


driver.navigate().to("URL");

What are the ways to refresh a browser in Selenium?

You can use driver.navigate().refresh , you can also use the sendKeys method and press F5




driver.navigate().refresh()


sendKeys(Keys.F5) on any textboxdriver.get("URL") on the current URL

What is the difference between driver.close() and driver.quit()
driver.close makes it so that you close the current Webdriver instance. driver.quit() will close all the opened Webdriver instances
What is the difference between driver.findElement() and driver.findElements()
findElement() returns a single WebElement whereas findElements() returns a list of WebElements. If findElement does not find any elements then it will throw an exception while findElements() will just return a list of 0 elements.
How can we handle Web-based Pop ups or Alerts in Selenium
To handle Web-based alerts or popups we need to switch to the alert window and call Selenium WebDriver Alert API methods.



dismiss(); - To click cancel button


accept(); - To click Ok button


getText(); - To get the text in the alert


sendKeys(); - To enter text in the alert box

What is JavaScriptExecutor? Things you can do with JavascriptExecutor?
Sometimes web controls don't react well against selenium commands and we may face issues. To overcome these issues we can use JavaScriptExecutor interface. It provides a mechanism to execute Javascript through Selenium driver.
How to select a value in a dropdown?
  By using Select class  
you can do selectByVisibleText, selectByIndex, and selectByValue.
By using Select class



you can do selectByVisibleText, selectByIndex, and selectByValue.





Can you use Selenium for Rest API testing?
No. Selenium automates web browsers. Rest API & many other APIs don't contain UI.
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



1)Using testng.xml


2)Using data providers

How do we use Appium in Selenium?


What are the desired capabilities?

First we set the desired capabilities in a base class(Before Method)


These desired capabilities are deviceName, udid, platformName(Android), platformVersion(9), appPackage, and appActivity

What are the desired capabilities needed for Appium testing?
device name

udID


platform name (Android)


Platform version (9)


appPackage


appActivity


noReset

How to handle hidden elements in Selenium WebDriver?
  We can handle hidden elements by using javaScript executor
   
We can handle hidden elements by using javaScript executor



What is the use of @Listener annotation in TestNG?

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.
What is the time unit we specify in test suites and test cases?
We specify the time unit in test suites and test cases is in milliseconds.
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.
What is Page Object Model in Selenium?

i

How can you use the Recovery Scenario in Selenium WebDriver?
By using a Try Catch Block