Selenium Interview Questions and Answers
Question - 31 : - Can we use Selenium grid for performance testing?
Answer - 31 : -
Yes. But not as effectively as a dedicated Performance Testing tool like Loadrunner.
Question - 32 : - List the advantages of Webdriver over Selenium Server?
Answer - 32 : -
- If you are using Selenium-WebDriver, you don’t need the Selenium Server as it is using totally different technology
- Selenium Server provides Selenium RC functionality which is used for Selenium 1.0 backwards compatibility
- Selenium Web driver makes direct calls to browser using each browsers native support for automation, while Selenium RC requires selenium server to inject Javascript into the browser
Question - 33 : - Mention what are the capabilities of Selenium WebDriver or Selenium 2.0 ?
Answer - 33 : -
WebDriver should be used when requiring improvement support for
- Handling multiple frames, pop ups , multiple browser windows and alerts
- Page navigation and drag & drop
- Ajax based UI elements
- Multi browser testing including improved functionality for browser not well supported by Selenium 1.0
Question - 34 : - While injecting capabilities in webdriver to perform tests on a browser which is not supported by a webdriver what is the limitation that one can come across?
Answer - 34 : -
Major limitation of injecting capabilities is that “findElement” command may not work as expected.
Question - 35 : - Explain how you can find broken images in a page using Selenium Web driver ?
Answer - 35 : -
To find the broken images in a page using Selenium web driver is
- Get XPath and get all the links in the page using tag name
- In the page click on each and every link
- Look for 404/500 in the target page title
Question - 36 : - Explain how you can handle colors in web driver?
Answer - 36 : -
To handle colors in web driver you can use
Use getCssValue(arg0) function to get the colors by sending ‘color’ string as an argument
Question - 37 : - Using web driver how you can store a value which is text box?
Answer - 37 : -
You can use following command to store a value which is text box using web driver
driver.findElement(By.id(“your Textbox”)).sendKeys(“your keyword”);
Question - 38 : - Explain how you can switch between frames?
Answer - 38 : -
To switch between frames webdrivers [ driver.switchTo().frame() ] method takes one of the three possible arguments
- A number: It selects the number by its (zero-based) index
- A name or ID: Select a frame by its name or ID
- Previously found WebElement: Using its previously located WebElement select a frame
Question - 39 : - Mention 5 different exceptions you had in Selenium web driver?
Answer - 39 : -
The 5 different exceptions you had in Selenium web drivers are
- WebDriverException
- NoAlertPresentException
- NoSuchWindowException
- NoSuchElementException
- TimeoutException
Question - 40 : - Explain using Webdriver how you can perform double click ?
Answer - 40 : -
You can perform double click by using
Syntax- Actions act = new Actions (driver);
act.doubleClick(webelement);