Category Archives: Uncategorized

sql date functions part 1

Some of the sql date functions have been discussed in the previous article. In this tutorial you can check more date functions. 1. ADDDATE(): It adds time to a date.

Output: 2010-05-25 2. ADDTIME(): It returns a date/time after adding certian interval of time.

Output: 2010-05-15 10:10:20 3. CONVERT_TZ(): It converts a datetime… Read More »

sql date functions

In this tutorial, we are going to learn different kinds of date functions used in sql. In this page I am focusing on the most commonly used functions. 1. now() 2. sysdate() 3. curdate()/current_date() 4. curtime()/current_time() 5. current_timestamp() 6. date() 7. date_add() 8. date_sub() 9. datediff() 10. extract() 11. date_format()   1. NOW(): Returns the… Read More »

read text file in java

In this tutorial, we will look at how to read a text file in Java. We are using Files, BufferedReader and Scanner to read the file. 1. BufferedReader:

Output: Selenium and Java Tutorials Selenium Interview Questions Selenium and Java Tutorials Selenium Interview Questions 2. Using Files:

Output:  Selenium and Java Tutorials Selenium Interview… Read More »

sql top limit

TOP, LIMIT, ROWNUM in SQL: If you want to fetch top N rows from table, you can use TOP clause. This clause is useful when a table contains thousands of records because returning so many records can impact the performance. But all databases may not support TOP clause. SQL Server – TOP MySQL supports LIMIT… Read More »

how to find common elements in arraylists java

You were given two arraylists as below and you have to identify the common elements present in them. ArrayList1: [sleenium99, automation, tutorials, java] ArrayList2: [arraylist, sleenium99, automation, tutorials, collections] Output is: [sleenium99, automation, tutorials] Method 1: We are going to achieve this task with the help of retainAll method present in the ArrayList.

Output:… Read More »

java question 5

1 What is the output of below code snippet?

Options: A. “123451234512345” B. Prints a negative integer value C. “12345100000” D. Compilation error 2. Given the following definitions, which of these expressions will NOT evaluate to true?

Options: A. b1 | !b2 B. (i1 ^ 12) < 4 C. i2 & b1 D.… Read More »

java files

File class is present in java.io package and we can work with File class to read or write data.

Below are the methods present in File class. Method Type Description length() String Returns the length of the file. canRead() Boolean Tests whether the file is readable or not. canWrite() Boolean Tests whether the file… Read More »

java map examples

Difference between HashMap, LinkedHashMap, TreeMap and Hashtable with examples: HashMap LinkedHashMap TreeMap HashTable Insertion Order No Yes Yes No Null key allowed allowed Not allowed Not allowed Null value allowed allowed allowed Not allowed Examples:

  Answer:

================== Duplicate keys are not allowed in map and each key can map to at most… Read More »

java-questions-4

1 Which one of the following represents legal flow control statements? a. break; b. break(); c. continue(inner); d. exit();   2. Predict the output from below java program.

Options: A. Got the exception 10 B. Go the exception 0 C. Compile time error D. Run-time error   3. Output of below java program.

Read More »

advanced sql functions

Advanced SQL functions: COALESE: This function is used to return first non-NULL value from the list or from the table. Examples: SELECT COALESCE(NULL, 1, 2, ‘selenium99.com’); –> Returns 1 SELECT COALESCE(NULL, 500, NULL, 200, ‘selenium99.com’); –> Returns 500 SELECT COALESCE(NULL, 77, ‘automation’, ‘selenium99.com’); –> returns 77 SELECT COALESCE(NULL, NULL, ‘automation’, ‘selenium99’); –> Returns automation SELECT COALESCE (NULL,NULL,NULL,NULL,’selenium99′,700);… Read More »

selenium interview questions basic level

In this article you will find the selenium interview questions of basic level. 1. What is an exception test in Selenium? An exception test is an exception that you expect will be thrown inside a test class. For example, if you have written an automation test script in such way that it should throw an… Read More »

hashset and linkedhashset differences in java

Differences between HashSet and LinkedHashSet in Java:   S.No HashSet LinkedHashSet 1 HashSet doesn’t maintain insertion order. LinkedHashSet maintains insertion order. 2 Unordered. Order is unpredictable when we iterate through the elements. Ordered and gives predictable output. 3 If you don’t want to maintain insertion order and should have unique values then you can use… Read More »

How to take screenshot using Selenium WebDriver

Taking screenshot using selenium is simple and it helps us to debug the failure and to find out the root cause. By looking at screenshot, we can get to know the details why and at which step test has failed. TakesScreenShot interface is used to achieve this task and this TakesScreenShot capability is enabled by… Read More »

How to select a dropdown using selenium web driver

In this article, we are going to learn about how to select a drop down using selenium webdriver. In our selenium automation, we may come across situations like entering text, selecting radio buttons and check boxes etc. Like this way, selenium handles dropdowns in an easy manner. Points to remember: Using selenium web driver, we… Read More »

TestNG annotations

Below is the list of annotations in TestNG. @BeforeTest @AfterTest @BeforeMethod @AfterMethod @BeforeSuite @AfterSuite @BeforeGroups @AfterGroups @BeforeClass @AfterClass @Test @BeforeTest: Executes before any method in a class which is having @Test annotation. @AfterTest: Executes after any method in a class which is having @Test annotation. @BeforeMethod: Executes every time before any test method in a… Read More »

Implicit and Explicit wait in Selenium

During automation script development, its common that at least once in their test execution, their scripts have failed due to WebDriver couldn’t able to find element in the web page. This issue can be resolved by using selenium wait conditions appropriately. Page load speed depends on the how fast the response is coming from web… Read More »

How to handle mouse hover events using Selenium WebDriver

In this article, we will learn about how to handle the mouse hover events using selenium webdriver. Firstly, we have to hover mouse over the menu item. This displays the dropdown list/sub menu items. Next, we have to select the sub elements from the list and have to click on one of the sub element.… Read More »

encapsulation in java

Encapsulation in java: Encapsulation = Data Hiding + Abstraction. It means if any component is following Abstraction as well as data hiding then it is also following Encapsulation. Encapsulation: It is actually the process of binding data members and methods together in a unit. Each class in java itself is an example of encapsulation. It… Read More »

general selenium questions

1. Find element using xpath and cssSelector. Html code: <a class=”shopicon relative”>Shopping</a> Solution:  //a[@class=’shopicon relative’]   –> using xpath in firefox .shopicon.relative   –> using cssSelector in chrome //a[text()=’Shopping’] –> text() method 2. In the “in.rediff.com” website, ways to find NEWS link are: Using cssSelector: .navbar>:nth-child(1)>:nth-child(2) .navbarul>:nth-child(2) Using xpath: //a[text()=’NEWS’]   Related articles: Waits in Selenium WebDriver