A framework is a set of rules, guidelines and best practices that are followed to get the desired results. A testing framework should have the features listed below:Should support more than one browser.Should run on multiple platforms.Should run on multiple programming languages like Java, Python, C#, Ruby and so on.Efficient handling of test data.Test case creation and updating are easy and maintainable.Provision for setting priority for each test case execution.Efficient test report generation.Proper test history maintenance for interpreting trends and analysis of execution results.Integration with continuous integration tools like Jenkins.Minimal manual intervention.Increases efficiency and productivity.Ensures efficient test code coverage.The types ... Read More
Suppose there is a set S that is originally containing numbers from 1 to n. But unfortunately, due to some error, one of the numbers in the set got duplicated to another number in the set, which results in repetition of one number and loss of another number.Now if we have an array called nums that is representing the data status of this set after the error. Our task is to find the number occurs twice and then find the number that is missed. return the results in the form of an array.So, if the input is like [1, 2, ... Read More
We can verify the color and background color of a web element in Selenium with the help of getCSSValue() method.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class CssColorValue { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); String url = "https://www.tutorialspoint.com/index.htm"; driver.get(url); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); //getting color attribute with getCssValue() String colr = driver.findElement(By.xpath("//*[text()=’GATE Exams’]")) ... Read More
Suppose we have an array with n elements, we have to find the contiguous subarray of given length k that has the maximum average value. We have to return the maximum average value.So, if the input is like [1, 13, -5, -8, 48, 3] and k = 4, then the output will be 12.0, as (13-5-8+48)/4 = 12.0.To solve this, we will follow these steps −sum := 0for initialize i := 0, when i < k, update (increase i by 1), do −sum := sum + nums[i]maxi := sumfor initialize i := k, when i < size of nums, update ... Read More
The differences between Selenium and UTP are listed down below.sl.no.SeleniumUTP1It is open source and can be used free.It is a licensed tool and is commercialized for use.2It supports the majority of browsers like Chrome, Firefox, Internet Explorer, Safari and so on.It supports Chrome, Firefox and Internet Explorer.3It only tests web based applications.It tests both windows and web based applications.4There is no in built object Repository.By default, object repositories are available and maintained.5It can be developed on multiple languages like Java, C#, Javascript, Python and so on.It can be developed only on VB scripts.6There is no external support for vendors for ... Read More
Suppose we have a non-empty binary tree; we have to find the average value of the nodes on each level in the return the average values as an array.So, if the input is likethen the output will be [3, 14.5, 11].To solve this, we will follow these steps −Define an array resultDefine one queue qinsert root into qwhile (not q is empty), do −n := size of qDefine an array tempwhile n is non-zero, do −t := first element of qinsert value of t into tempdelete element from qif left of t is not null, then −insert left of t ... Read More
We can verify the visibility of web elements like edit box, checkbox, radio buttons and so on with the help of method listed bels −isDisplayed()This method checks if a webelement is present on the screen.Syntax −Boolean result = driver.findElement(By.xpath("//span[text()=’Coding Ground’]")).isDispayed();isSelected()This method checks the status of the radio button, check box and options in the static dropdown.Syntax −Boolean btnresult = driver.findElement(By.xpath("//xpath[contains(@class, ’gsc-search-button’)]")).isSelected();isEnabled()Syntax −Boolean btnresult = driver.findElement(By.xpath("//xpath[contains(@class, ’gsc-search-button’)]")).isEnabled();This method if an element is enabled or not.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class ElementStatus{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", ... Read More
Suppose we have a non-negative integer c, we have to decide whether there're two integers a and b such that it satisfies a^2 + b^2 = c.So, if the input is like 61, then the output will be True, as 61 = 5^2 + 6^2.To solve this, we will follow these steps −Define a function isPerfect(), this will take x, sr := square root of xreturn true when (sr - floor of sr) is 0From the main method do the following, if c is same as 0, then −return truefor initialize i := 0, when i < the ceiling of ... Read More
We can deal with reusable components in Selenium Java with the help of inheritance concept. It is a parent child relationship where the child class inherits the properties and methods of the parent class.ExampleFor Parent class.import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class Baseclass { public void login() throws IOException { Properties prop = new Properties(); //Reading values from property file FileInputStream ips = new FileInputStream( "C:\Users\ghs6kor\eclipse- workspace\Inheritance\config.properties"); prop.load(ips); System.setProperty("webdriver.gecko.driver", ... Read More
Suppose we have an integer array; we have to find three numbers whose product is maximum then return the maximum product.So, if the input is like [1, 1, 2, 3, 3], then the output will be 18, as the three elements are [2, 3, 3].To solve this, we will follow these steps −sort the array numsl := size of numsa := nums[l - 1], b := nums[l - 2], c := nums[l - 3], d := nums[0], e := nums[1]return maximum of a * b * c and d * e * aExample Let us see the following implementation to get ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP