Here are some of the most popularly asked Selenium interview questions which are being asked during evaluation for Selenium Automation Engineers. These will certainly help you prepare one for yourself. Lets us know if it does and also help us and others by submitting a new question that has been asked to you. our quick refresher guide on selenium should help you to brushup all the key points while preparing for the interview.
refer other interview questions at automated-360
UFT Interview Questions. Test Complete Interview Questions
Selenium Interview Questions
Updated November 24, 2021: Latest Version of Selenium 4 has been released on October 13, 2021.
check out the latest version here
You may want to mention the languages(s), you are comfortable with. The rest of the interview might be related to that.
The answer should be – No, Selenium supports the testing of web applications only. You cannot automate desktop applications.
– Selenium support only web-based applications, it doesn’t support any windows based applications.
– Using the Selenium tool alone mobile applications cannot be tested, with the use of Appium we can achieve it.
– The Windows-based popup cannot be tested using Selenium alone we need to use AutoIT to handle the windows based popups.
– Selenium doesn’t have inbuilt reporting capability so JUnit/ TestNG need to use.
– Limited support for image testing.
– Selenium IDE supports only Firefox browsers.
– Selenium doesn’t have a built-in object repository.
– Selenium is open-source so no reliable support is available.
Double Slash “//” – Double slash is used to create Xpath with relative path i.e. the XPath would be created to start selection from anywhere within the document.
To avoid the “Same Origin Policy” proxy injection method is used, in proxy injection mode the Selenium Server acts as a client configured HTTP proxy, which sits between the browser and application under test and then masks the AUT under a fictional URL
@Before public void method() – It will perform the method () before each test, this method can prepare the test
@Test public void method() – Annotations @Test identifies that this method is a test method environment
@After public void method()- To execute a method before this annotation is used, the test method must start with test@Before
Selenium WebDriver: Selenium WebDriver is a tool used to automate testing for the web applications. It allows us to execute tests against different browsers like Firefox, Chrome, IE & Safari. Selenium WebDriver eliminated the use of Selenium Server thus making it work faster than RC
Syntax:
WebElement element = driver.findElements(By.xpath(“//div[@id='example']//ul//li”));
findElements(): findElements() is used to find all the elements in the current web page matching to the specified locator value. Take a note that all the matching elements would be fetched and stored in the list of WebElements.
Syntax:
List <WebElement> elementList = driver.findElements(By.xpath(“//div[@id='example']//ul//li”));
Host
Port Number
Browser
URL
ID
ClassName
Name
TagName
LinkText
PartialLinkText
XPath
CSS Selector
Verify will log the failure but continue to execute the test case.
@Test
Soft Assert does not throw an exception when an assert fails and would continue with the next step after the assert statement.Hard Assert: Hard Assert throws an AssertException immediately when an assert statement fails and the test suite continues with next
@Test
Explicit Waits
Fluent Waits
The advantages of using POM are:
– Allows us to separate operations and flows in the UI from Verification improves code readability
– Since the Object Repository is independent of Test Cases, multiple tests can use the same Object Repository
– Reusability of code
driver.quit() – Used to close all the browser instances
String text = driver.findElement("elementLocator").getText();
driver.manage().deleteAllCookies();
automated-360.com
Selenium Interview Questions
.pressKey(“non-text keys”) – Used for keys like control, function keys, etc that are non-text.
.releaseKey(“non-text keys”) – Used in conjunction with keypress event to simulate releasing a key from keyboard event.
element.getAttribute("title");
driver.findElement(By locator).isDisplayed();
IAnnotationTransformer ,
IAnnotationTransformer2 ,
IConfigurable ,
IConfigurationListener ,
IExecutionListener,
IHookable ,
IInvokedMethodListener ,
IInvokedMethodListener2 ,
IMethodInterceptor ,
IReporter,
ISuiteListener,
ITestListener .
[…] This can also be used a reference guide for preparing for interviews, when you quickly need to brush-up the concepts. Do not forget to let us know your feedback and if you want more to add onto this. You may want to refer our earlier post on Selenium Interview Questions. […]