0% found this document useful (0 votes)
84 views

What Are The Significant Changes in Upgrades in Various Selenium Versions?

The document discusses the changes in different versions of Selenium and exceptions in Selenium WebDriver. It states that Selenium v1 included Selenium IDE, RC and Grid but no WebDriver. WebDriver was introduced in v2, which also deprecated RC. v3 currently includes IDE, WebDriver and Grid. It then lists and describes common exceptions in WebDriver like NoSuchElementException, TimeoutException, ElementNotVisibleException etc.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views

What Are The Significant Changes in Upgrades in Various Selenium Versions?

The document discusses the changes in different versions of Selenium and exceptions in Selenium WebDriver. It states that Selenium v1 included Selenium IDE, RC and Grid but no WebDriver. WebDriver was introduced in v2, which also deprecated RC. v3 currently includes IDE, WebDriver and Grid. It then lists and describes common exceptions in WebDriver like NoSuchElementException, TimeoutException, ElementNotVisibleException etc.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

What are the significant changes in upgrades in various Selenium

versions?

Selenium v1 included only three suite of tools: Selenium IDE, Selenium RC and
Selenium Grid. Note that there was no WebDriver in Selenium v1. Selenium WebDriver
was introduced in Selenium v2. With the onset of WebDriver, Selenium RC got
deprecated and is not in use since. Older versions of RC is available in the market
though, but support for RC is not available. Currently, Selenium v3 is in use, and it
comprises of IDE, WebDriver and Grid.

IDE is used for recording and playback of tests, WebDriver is used for testing dynamic
web applications via a programming interface and Grid is used for deploying tests in
remote host machines.

Explain the different exceptions in Selenium WebDriver

NoSuchElementException: This exception is thrown when an element with given attributes is


not found on the web page. This commonly seen exception class is a subclass
of NotFoundException class.

TimeoutException: This exception is thrown when a command performing an


operation does not complete in the stipulated time

ElementNotVisibleException: This exception is thrown when the element is present in


DOM (Document Object Model), but not visible on the web page.  That is, the web
element is in a hidden state.

StaleElementException: This exception is thrown when the element is either deleted


or no longer attached to the DOM

NoSuchWindowException: comes under NotFoundException class. This is thrown when


WebDriver tries to switch to an invalid window or the window is not available to switch. We
would use window handles to get the set of active windows and then perform actions on the
same i.e. driver.getWindowHandles();

NoSuchFrameException: When WebDriver is trying to switch to an invalid frame,


NoSuchFrameException under NotFoundException class is thrown.

NoAlertPresentException: under NotFoundException is thrown when WebDriver tries


to switch to an alert, which is not available.
org.openqa.selenium.NoAlertPresentException will be thrown If below automation code
calls accept() operation on Alert() class when an alert is not yet on the screen.
driver.switchTo().alert().accept();
InvalidSelectorException: This subclass of NoSuchElementException class occurs
when a selector is incorrect or syntactically invalid. This exception occurs commonly when
XPATH locator is used. To avoid this, we should check the locator used because the
locator is likely incorrect or the syntax is wrong. Using Firebug to find xpath can reduce this
exception.

How can you fetch an attribute from an element? How to retrieve typed
text from a textbox?

We can fetch the attribute of an element by using the getAttribute() method. To retrieve


some text from any textbox, we can use getText() method.

How to set the size of browser window using Selenium?

To maximize the size of browser window, you can use the following piece of code:
driver.manage().window().maximize(); – To maximize the window

To resize the current window to a particular dimension, you can use the setSize() method. 

To set the window to a particular size, use window.resizeTo() method.  This is achieved


through JavaScripExecutor. This might not work in certain cases.

Why and how will you use an Excel Sheet in your project?

The reason we use Excel sheets is because it can be used as data source for tests
(DataDriven Testing).

User name and password credentials of different environments: You can store the access
credentials of the different applications/ environments in the excel sheet. You can store
them in encoded format and whenever you want to use them, you can decode them instead
of leaving it plain and unprotected. You can store the data for different iterations to be
performed in the tests. For example while testing a web page, the different sets of input
data that needs to be passed to the test box can be stored in the excel sheet.

What Are The Locators Selenium Supports?


 ID: Unique for every web element
 Name: Same as ID although it is not unique
 CSS Selector: Works on element tags and attributes
 XPath: Searches elements in the DOM, Reliable but slow
 Class name: Uses the class name attribute
 TagName: Uses HTML tags to locate web elements
 LinkText: Uses anchor text to locate web elements
 Partial Link Text: Uses partial link text to find web elements
What are the benefits of selenium automation?
There are many benefits of using Selenium for automated testing.

 Open source: Since it is an OSS, so we don’t have to bear any licensing cost for using it.
 Cross-browser: It works on all standard browsers such as Chrome, FF, IE, and Safari.
We can run same the test script in all browsers.
 Multi-language: We can choose a familiar programming language from Java, Python,
C#, Ruby to use with Selenium.
 Cross-platform: It provides test compatibility across Window, Linux, and Mac OSX. We
can run same the test script on all platforms.
 Concurrency: With Selenium Grid, we can execute thousands of test in parallel.
 CLI support: We can create a test suite with hundreds of tests and launch it with a single
command.
 CI support: Jenkins is the best CI tool. It provides a Selenium plugin to configure tests
for nightly execution.
 Free help: We can get quick technical support from its large community.
 Tester friendly: A non-programmer can also automate using Selenium. It is not too
complicated to be used only by a programmer.
 Active project: Active development and bug fixes on the latest project.

What Are Different Types Of Web Driver APIs Supported In


Selenium?
Following are the web drivers supported in Selenium.

| WebDriver Name | WebDriver API | Supported Browser |


1. Gecko Driver (a.k.a. Marinetto) | FirefoxDriver() | Firefox
2. Microsoft WebDriver (a.k.a. Edge) | InternetExplorerDriver() | IE
3. Google Chrome Driver | ChromeDriver() | Chrome
4. HTML Unit Driver | WebClient() | {Chrome, FF, IE}
5. OperaChromium Driver | ChromeDriver() | Opera
6. Safari Driver | SafariDriver() | Safari
7. Android Driver, AndroidDriver() | Android browser
8. ios Driver | IOSDriver() | ios browser
9. EventFiringWebDriver | EventFiringWebDriver() | ALL

What Is XPath? How Does It Work?


XPath is the most-used locator strategies Selenium uses to find web elements.

 It works by navigating through the DOM elements and attributes to locate the target
object. For example – a text box or a button or checkboxes.
 Although, it guarantees to give you the element you are looking after. But it is slower
than as compared to other locators like ID, name or CSS selectors.
What Is The Command To Enter Text In The HTML Text Box
Using Selenium?
We can do so by using the sendKeys() method.

Other way is to use JavaScriptExecutor.

What Is The Command To Reset The HTML Text Box In


Selenium Webdriver?
Selenium provides the clear() function to reset the value inside the text
element.

What Is The Command To Get The Value Of A Text Box In


Selenium Webdriver?
Selenium provides the getText() function to read the value inside the text
element.

What Is The Command To Click On A Hyperlink In Selenium


Webdriver?
Selenium provides the click() function to click on a HTML link.

Is It Mandatory To Prefix The URL With HTTP Or HTTPS While


Calling The Web Driver’s Get() Method?
Yes, if the URL doesn’t contain the HTTP prefix, then the program will throw an
exception.

Hence, it is mandatory to pass the HTTP or HTTPS protocol while calling the web
driver’s get() method.

What Is The Other Method Which Gives The Same Effect As We


Get From The Web Driver’s Get()?
Selenium provides the “navigate.to(link)” method. It does the same thing as we achieve
from the get() call.

How Can I Move Back And Forth In A Browser Using Selenium?


Selenium provides the following methods for moving back and forth in a browser.

1) navigate().forward() – to move to the next web page as per the browser’s history
2) navigate().back() – to move back to the previous page as per the browser’s history
3) navigate().refresh() – to reload the current page
4) navigate().to(“URL”) – to start a new browser window and opening up the specified
link

What Is The Selenium Command To Fetch The Current Page


URL?
To retrieve the current page URL, we can call the getCurrentURL() function.

webdriver.getCurrentUrl();

What Is The Selenium Command To Set The Browser


Maximized?
We can maximize the browser window by calling Selenium’s maximize() method.

It sets the current window in the maximized state.

webdriver.manage().window().maximize();

What Is The Selenium Command To Delete Session Cookies?


To delete session cookies, we can invoke the deleteAllCookies() method.

webdriver.manage().deleteAllCookies();

You might also like