Saturday, January 28, 2017

[TIPS] Selenium Implicit Wait - Turn ON and OFF

While automating web application Selenium Webdriver Implicit wait is applied to all findElement and findElements keyword till the element is visible. But in some case we need to check if fields visibility immediately on performing some actions. So why to wait for default implicit wait of 15 or 30 seconds.

Here is the simple tip to override Implicit default wait time by Turning OFF the implicit wait while performing action and validating field visibility. Below Java code snippet will be helpful -

 public void turnOFFImplicitWait(Webdriver driver)  {  
   driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);  
 }  

After verifying the step turn ON default implicit wait as below -
 public void turnONImplicitWait(Webdriver driver)  {  
   driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);  
 }  

Sunday, January 22, 2017

JAVA Interview questions for Selenium Position

Below Java questions I faced during my QA Automation Testing interview. Most of the answers I searched from Google, Java blogs and tutorials, so I pasted out the link against each question for your easy reference.

Click here for Selenium Webdriver Interview Questions/Answers

1. What is checked exception?
Exception checked during compile time (IOException, FileNotfound Exception)

2. What is unchecked exception?
Exception checked during runtime (Indexoutofbound, ArithmeticException, NullPointerException)

3. Can we make Array dynamic?

4. What is the Difference between array and collection?

5. What is collection?

6. What is HashMap in collection?

7. Difference between HashMap and Hash Table

8. Difference between SetMap and Queue map

9. What is HashSet?

10. Does Set has null value?

11. Polymorphism

12. Overriding (Overriding behavior of parent class and implementing new behavior)

13.   Overloading (Different parameter and different written type with same method name)

14.   Inheritance: Single, multilevel, hybrid

15.   How to achieve multiple inheritance in Java

16.   What is interface and abstract class. Difference?

17.   Can we extends abstract class?
Abstract classes cannot be instantiated, but they can be subclassed. When anabstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class. However, if it does not, then the subclass must also be declared abstract (source)

18.   Can we instantiate abstract class?
As above

19.   Can we change value of final variable in java? Why?

20.   Can a final variable be blank or empty? Why?

21.   What is constructor?

22.   Data encapsulation example in your project?

23.   What is the need of static variable in Java? Why it was need? What limitation did it overcome?

24.   What is inner class?

25.   Why is variable declaration of int, boolean, long start with small letter while String starts with Caps?

26.   Why String class doesn’t have constructor. Why dont we use 'new' keyword to create String object?

27.   Does static method can have static variable? – No
In Java, static means that it's a variable or function of a class and belongs to the complete class but not to one of its certain objects/methods. This means that static keyword can be used only in a 'class scope'

public static int javaMethod() {
    static int javaVariable = 24;             // not valid
    return ++javaVariable;
}

28.   Does non static method can have static variable? – Yes

29.   What is virtual method?

30. Is static constructor available in Java?

How to fix Wireless LAN (WLAN) issue Kali Linux virtualbox (wlan Not Showing)?

Type ifconfig command in Terminal
If wlan0 option is not displayed then follow the below step to fix -

1. Download 'Compact Wireless Driver' from http://linuxwireless.org/download/compat-wireless-2.6/
Select 'compat-wireless-2010-06-26-p.tar.bz2' file and download

2. Navigate to the download folder in Termainal

3. Extract the file with below command
# tar -jxvf compat-wireless-2010-06-26-p.tar.bz2

4. File is extracted in folder name same as file name.

5. Now got to extracted folder
# cd compat-wireless-2010-06-26-p.tar.bz2

6. Run the following command to fix the issue -
# make unload
# make load

7. Verify the wlan (Wireless adaptor) added in kalilinux
# ifconfig
airmon-ng

Thanks for reading post. Comment/share post.