Selenium Interview Questions Download PDF

1 . How do I copy a content from webpage and paste it in notepad in selenium and validate

using "driver.getAttribute("text");" to read text or label. Using "driver.getAttribute("valeu");" to read text box values.


2 . Why do some projects use selenium with Java and some with c#? Are there any dvantages/disadvantages

Yes, You can do some project use selenium with java and C#. Many people prefer java these days in Market. Because We have very good support for Java with Selenium. Java is a platform independent. Java is taught in most of the colleges and schools since it’s free.


3 . Can someone help me with one scenario to Automate: It's like, I am clicking on next button it is redirecting to next page but on next page some button is visible but loader on page is still loading I want to wait until that loader stop. How to wait until the loader stop?

WebDriverWait wait = new WebDriverWait(driver, 30); WebElement element = wait.until( ExpectedConditions.visibilityOfElementLocated(By.xpath("someButton")));


4 . Which is better way of creating object repository in POM? 1. Page wise 2. In .properties file

Defining WebElements in Page Wise will be the Best.


5 . how to get the value against supplier dropdown

u can try this WebElement ele=driver.findElement(By.xpath("//select[@id='editQuoteItemSupplierId']/option"); String value=ele.getAttribute("value");


6 . What is best possible way to access a web element whose name Or case selector is keeps on changing. What should be xpath?

In such cases, you can use xpath using contains(). Might be some part of property of webelements remains same. You can even try with xpath using starts-with


7 . I can go with customized xpath with the help of sibling or parent relationships

If u have some static element to decide xpath relative to it ... Then yes , go with that. Provided ur xpath doesnt ends up being too complex


8 . What are the threads in testng? What is use of it?

TestNG provides multiple ways to execute tests in separate threads. In testng.xml, if we set 'parallel' attribute on the tag to 'tests', testNG will run all the '@Test' methods in tag in the same thread, but each tag will be in a separate thread. This helps us to run test methods / classes / tests in parallel.


9 . We have 3 class is class a,class b and class c, how do we use methods present in classes a and b in c without creating an abject of class a and b

If we declare the method s of class A and B as static then in class c we can call those methods by using class name without creating any object. Without using class name and create object of a and b is it possible to call those methods into class c


10 . Can I have two pom file and if yes how to execute two pom file separately from cmd. And How to execute both from cmd

Yes we can have multiple pom.xml files. And Wats the use of two.POM.xml


Post Question Details

Ques. 5oy83q

Posted On: 4/29/2023 7:34:44 AM


Ques. efznni

Posted On: 9/21/2022 7:04:49 PM


Ques. bbhjzJK

Posted On: 3/4/2020 11:22:03 PM