21. What is the solution for java.lang.illegalstateexception in Selenium Webdriver?
The root cause of java.lang.illegalstateexception is we have not specified the path of the driver with the system property. Until you do not specify the driver details Selenium Webdriver will throw java.lang.illegalstateexception.
22. How to handle ElementNotVisibleException?
Reason 1– Duplicated xPath
While writing xPath for your application, you might have taken xPath that is matching with more than 1 element, in this case, Selenium will throw Element, not the visible exception.
First Solution: Try to write unique xPath that matches with a single element only.
Reason 2-
If you are trying to access some particular element on Web-page that is not currently visible, in this case also you will get the Element, not visible exception.
Second Solution: Use Explicit wait feature of Selenium and wait till the element is not visible. Once it is visible then you can perform your operations.
23. What is the solution for sendkeys(CharSequence) in Selenium?
Sometimes while creating project compiler version will be below 1.5 version so Selenium method that is sendKeys will not able to read by the compiler so we need to upgrade the compiler version to 1.5 and above.
Solution:
1- Change the compiler version from old version to 1.5 or greater.
2- Change the JRE version from JRE8 to JRE7.
How to change the compiler version:
1- Right click on project and Click on Java Compiler to 1.5 or later.
2- Check the latest version or select from dropdown.
3- Now you are done. Go back to the program and you will notice no error will be present.
24. How to Handle Stale element reference exception in Selenium Webdriver?
Two reasons for Stale element reference:
1 -The element has been deleted entirely.
Solution-1: You can refresh the page and again try for the same element.
Example- If you are trying to click on link and getting the exception then try in below format
driver.navigate().refresh();
driver.findElement(By.id(“urelementid”)).click();
2- The element is no longer attached to the DOM.
Solution-2: Sometimes it takes the time to attach element on DOM so you can retry using for loop and try catch.
for(int i=0i<=2;i++)
{
{try{ Driver.findElement(By.id()).click();
break; }
catch(Exception e)
{ Sysout(e.getMessage()); }
}
In the above program, we will try for specific element max 3 times and if the element is located in the first shot itself then it will break from for loop and come out of the loop.
25. What are the Selenium Tools, and Testing Framework that you are using in your current project?
We are using Selenium Webdriver for creating Test Cases.
Java as the programming language for enhancing test cases.
TestNG framework for generating test reports. grouping test cases & executing test batches.
Selenium Grid for parallel test execution.
Maven as the project management tool.
26. What is your Project Operating Environment?
Server side OS: Windows 2012 Server.
Client Side OS : Microsoft Windows 10.
27. What is your project domain and application environment?
Our project is in banking domain.
Our application environment is distributed web application developed using Java Technology.
Database is Oracle.
28. What are the major challenges in functional testing?
Object or element identification.
Debugging issues.
29. What are the difficulties that you faced in object identification?
Some elements not recognized properly using selenium web-driver element locators.
30. How have you conducted data driven testing in your project?
We conducted data driven testing using external excel file as resource.
We added third party excel jar files to java project e.g. POI.
And using external excel file as resource, means test data file, we conducted data driven testing.
hi,your blog is very useful. all the questions are so challenging. thank you for posting all important questions.
http://www.trainingpune.in/selenium-training-in-pune.html