
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

3K+ Views
Definition and UsageThe abs() function is an in-built function in PHP iterpreter. This function accepts any number as argument and returns a positive value, disregarding its sign. Absolute value of any number is always positive.This function always returns positive number.Syntaxabs( mixed $num)ParametersSr.NoParameter & Description1numThis parameter stores a value whose absolute value is to be obtained.Return ValuesPHP abs() function returns absolute value of num. If data type of num is float, return type is also float.For integer parameter, return type is integer.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example shows that ... Read More

468 Views
Explicit waits are applied to a specific element in the web page. It shall pause the execution till the condition is satisfied. Explicit wait is also a dynamic one since if the wait time is fifteen seconds and the conditions (like waiting for an element to be clickable, visible or selectable and so on) are satisfied before this specified time, the control will move to the next step.Explicit wait is more customizable since we can set it up for the condition. The listof some of the expected conditions for explicit waits are listed below −textToBePresentInElement()Syntaxw.until(ExpectedConditions.textToBePresentInElement(By.id(““), “Tutorialspoint”));textToBeClickable()Syntaxw.until(ExpectedConditions.textToBeClickable(By.id(““)));alertisPresent()Syntaxw.until(ExpectedConditions.alertisPresent())= null);frameToBeAvailableAndSwitchToIt()Syntaxw.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id(““)));Explicit is complex in ... Read More

650 Views
Implicit is the default waiting time for each test step in our execution. Thus if we keep an implicit wait of ten seconds, each test step will wait for that amount of time for an action to take place and then move to the next step.Implicit wait is a dynamic wait which means if the wait time is ten seconds and the web element on which the next action is to be taken is available at the fifth second, then control will immediately move to the next test step rather than waiting for the full ten seconds.However if the element ... Read More

9K+ Views
The differences between get() and navigate() methods are listed below.sl.no.get()navigate()1It is responsible for loading the page and waits until the page has finished loading.It is only responsible for redirecting the page and then returning immediately.2It cannot track the history of the browser.It tracks the browser history and can perform back and forth in the browser.ExampleWith get().import 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; import java.util.List; public class LaunchBrw { 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"; ... Read More

1K+ Views
findElement() and findElements() method tries to search an element in DOM.The differences between them are listed below −sl.no.findElement()findElements()1It returns the first web element which matches with the locator.It returns all the web elements which match with the locator.2Syntax − WebElement button = webdriver.findElement(By.name(""));Syntax − List buttons = webdriver.findElements(By.name(""));3NoSuchElementException is thrown if there are no matching web elementsEmpty list is returned if there are no matching elements.ExampleUsing findElements ().import 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 RowFindElements { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver ... Read More

259 Views
The different methods of creating a css expression are listed below −Using a class as css selectorThis will select all the web elements of that particular class. (Represented by (.) for example - .classname)Using an id as css selector.This will select the web element of that particular id. (Represented by (#) for example - #ID)Using a tagname and attribute value as selector.This will select the web element of that particular attribute value combination. (Represented by tagname [attribute=’value’])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 CssExpression { public static void main(String[] args) { ... Read More

172 Views
Suppose we have a Binary Search Tree, we have to convert it into a Greater Tree such that every key of the original BST is changed to the original key + sum of all keys greater than the original key in BST.So, if the input is likethen the output will beTo solve this, we will follow these steps −Define a function revInorder(), this will take tree root and s, if root is null, then −returnrevInorder(right of root, s)s := s + val of rootval of root := srevInorder(left of root, s)From the main method, do the following −if root is ... Read More

353 Views
Suppose we have an array and an integer k, we have to find the number of unique k-diff pairs in the array. Here the k-diff pair is like (i, j), where i and j are both are present in the array and their absolute difference is k.So, if the input is like [3, 1, 4, 1, 5], k = 2, then the output will be 2, as there are two 2-diff pairs in the array-like (1, 3) and (3, 5).To solve this, we will follow these steps −Define maps called seen and doneDefine one set sif k < 0, then ... Read More

215 Views
Suppose we have two strings; we have to find the longest uncommon subsequence of these two strings. The longest uncommon subsequence is actually the longest subsequence of one string and this subsequence should not come in the other string. So, we have to find the length of the longest uncommon subsequence. If the longest uncommon subsequence doesn't exist, return -1.So, if the input is like "aabbac", "aabbcc", then the output will be 6To solve this, we will follow these steps −if a is same as b, then −return -1Otherwisereturn maximum of size of a and size of bExample Let us see ... Read More

2K+ Views
Suppose we have to check whether a given number is perfect number or not. A number is said to be a Perfect Number when that is equal to the sum of all its positive divisors except itself. The number n will be in range 1^8.So, if the input is like 28, then the output will be True, as its sum of divisors − 1 + 2 + 4 + 7+ 14 = 28.To solve this, we will follow these steps −As the numbers are in range 10^8, there are only few perfect numbers, if the given input is in that ... Read More