CSS Corp – Selenium Interview Questions
Here is the list of Selenium Interview Questions which are recently asked in CSS Corp company. These questions are included for both Freshers and Experienced professionals. Our Selenium Training has Answered all the below Questions.
1. Write Palindrome – code
Java implementation of the approach
public class GFG {
// Function that returns true if
// str is a palindrome
static boolean isPalindrome(String str)
{
// Pointers pointing to the beginning
// and the end of the string
int i = 0, j = str.length() - 1;
// While there are characters to compare
while (i < j) {
// If there is a mismatch
if (str.charAt(i) != str.charAt(j))
return false;
// Increment first pointer and
// decrement the other
i++;
j--;
}
// Given string is a palindrome
return true;
}
// Driver code
public static void main(String[] args)
{
String str = "geeks";
if (isPalindrome(str))
System.out.print("Yes");
else
System.out.print("No");
}
}
Output:
No
2. Print all 111, 222,…999 no’s.. Code
3. How to Handle drop down?
String mainPage = driver.getWindowHandle();
Alert alt = driver.switchTo().alert(); // to move control to alert popup
alt.accept(); // to click on ok.
alt.dismiss(); // to click on cancel.
//Then move the control back to main web page-
driver.switchTo().window(mainPage); → to switch back to main page.
4. How to click on a hyper link using linkText?
driver.findElement(By.linkText(“facebook”)).click();
driver.findElement(By.partialLinkText(“aceb”)).click();
5. What is a framework?
A framework is also known as software framework, is a platform that provides a foundation for developing software applications. In this platform the program that can be selectively modified by adding code.
A framework is generally more comprehensive than a protocol and more prescriptive than a structure.
6. Can WebDriver test Mobile applications?
Yes!!. Webdriver test mobile applications.
7. How can we get a text of a web element?
import 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 GetElementText{
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","C:\\Users\\Credo\\Desktop\\Java\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.get("https://www.credosystemz.com/");
// identify element
WebElement p=driver.findElement(By.xpath("//h1"));
//getText() to obtain text
String s= p.getText();
System.out.println("Text content is : " + s);
driver.close();
}
}
8. How do I launch the browser using WebDriver?
Use the code:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class ChromeLaunch{
public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
String url = " https://www.credosystemz.com/";
driver.get(url);
}
}
Free PDF : Get our updated Selenium Course Content pdf
9. How to switch between windows?
10. Reason for leaving previous company
Confidently say positive answers for leaving previous company like looking for career growth, interested to learn new skills, work with new environment. Also interested to work with new challenges.
11. Draw framework diagram in your project
12. Explain the Type of reports?
Top 5 Important reports are,- Formal or Informal Reports
- Short or Long Reports
- Informational or Analytical Reports
- Proposal Report
- Vertical or Lateral Reports
13. When should I use Selenium Grid?
Uses:- It is used to runs test cases on different version of browsers on different OS simultaneously.
- we can multiple test cases simultaneously ensuring speedy execution.
- different versions of browsers and OS
14. What are the testing types that can be supported by Selenium?
Testing types which is supported by selenium are,- Functional Testing.
- Regression Testing.
- Sanity Testing.
- Smoke Testing.
- Responsive Testing.
- Cross Browser Testing.
- UI testing (black box)
- Integration Testing.
15. What is Selenese?
Uses:- It is used to runs test cases on different version of browsers on different OS simultaneously.
- we can multiple test cases simultaneously ensuring speedy execution.
- different versions of browsers and OS
16. What is difference between assert and verify commands?
We use Assert when we have to validate critical functionality. | Require the test method to continue execution even after the failure of the assertion statements. |
Assert is best used when the check value has to pass for the test to be able to continue to run. Like a log in | Verify is best used to check non critical things. Like the presence of a headline element. |
17. How to check if a button is enabled on the page?
Use the below code for to check the button is enabled on page, Boolean disabled = driver.executeScript("return arguments[0].hasAttribute(\"disabled\");", element);
Book a Free Mock Interviews and Test your Selenium skills with our Experts
TOP MNC's SELENIUM INTERVIEW QUESTIONS & ANSWERS
Here we listed all Selenium Interview Questions and Answers which are asked in Top MNCs. Periodically we update this page with recently asked Questions, please do visit our page often and be updated in Selenium.
Related Blogs
To become a Selenium Certified professional and join in your dream company, Enroll now for our Best Selenium Training. We help you to crack any levels of Selenium Interviews and We offering Selenium Training with Placement Assistance.