Interview Questions Flashcards

Interview Prep / Knowledge refresh

1
Q

What are the limitations of Selenium

A
  • Can only test web applications
  • Limited support for image testing
  • No built-in reporting
  • Limited test management
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the types of web locators

A
  • ID
  • linkText
  • Name
  • Tag name
  • Class name
  • X-Path
  • CSS selector
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the types of waits?

A
  • Implicit: wait for a defined period of time
  • Explicit: wait for a defined expected condition
  • Fluent: wait for a defined expected condition and check for element with defined frequency
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the navigation commands?

A
  • to()
    Navigates to provided URL
  • refresh()
    Refreshes the current page
  • forward()
    Goes to next page
  • back()
    Goes to previous page
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Difference between driver.close() and driver.quit()

A
  • close() command closes the browser’s current window.
  • quit() closes all open browser windows
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can we type text into an input box?

A

sendKeys()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How can we click a hyperlink?

A

Identify element using:
- linkText()
- partialLinkText()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How can we scroll down a page?

A

By using JavascriptExecutor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How to assert the title of a webpage?

A

getTitle() returns the title of the current webpage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to mouse hover over an element?

A

moveToElement() included in the Actions class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to retrieve CSS properties of an element?

A

getCssValue()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a Page Object Model?

A

A design pattern where:
- Every webpage is represented as a separate class
- Each class contains element identifiers and actions

Test cases are stores in separate classes than page object classes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Can Captcha be automated?

A

No

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How does Selenium handle Windows bases pop-ups?

A

Selenium cannot handle pop ups outside of the web page. Third party tools can be integrated with Selenium to handle pop-ups

AutoIT, Robot - simulates mouse movement, keystrokes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How can we take screenshots?

A

TakeScreenshot and getScreenshotAs()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Can you type in a textbox without using sendKeys()?

A

Yes, using JavascriptExecutor

JavascriptExecutor jse = (JavascriptExecutor) driver;

jse executeScript (“document getElementById( ‘email’).value=”abc.efg@xyz.com”);

16
Q

How can we select a value from a dropdown?

A

Using Select

17
Q

What does the switchTo() function do?

A

Used to switch between active windows

18
Q

How can we upload a file?

A

Using sendKeys() and file path

or Robot to simulate mouse/keys events

19
Q

How can we set the window size?

A

Using manage()
- maximize()
- setSize()

20
Q

findElement() vs findElements()

A

findElements() returns a list of elements
findElement() returns the first matching element

21
Q

How to handle an Authentication pop-up for Login?

A

Using Alert class and authenticateUsing method

22
Q

Single vs double slash in xPath?

A

Single slash creates absolute path
Double slash creates relative path

23
Q

How can we find broken links?

A

By checking response codes
200 OK - link is valid
404 - Link Not Found
400 - Bad Request
401 - Unauthorized
500 - Internal error