Selenium Java Interview Questions and Answers Part-7
Selenium Java Interview Questions and Answers Part-7
5) In Selenium IDE, what are the element locators that can be used to locate the elements on web
page?
– ID
– Name
– Link Text
– CSS Selector
– DOM
– XPATH
6) How can you convert any Selenium IDE tests from Selenese to other other language?
Script can be exported to other programming languages. To change the script format, open “Options”
menu, select “Format” command, and then choose one of these programming languages from the
menu.
7) Using Selenium IDE, is it possible to get data from a particular HTML table cell?
Verifytext can be used to verify text exist within the table.
9) In which format does the source view show the script in Selenium IDE?
Script is displayed in HTML format
10) Explain, how you can insert a start point in Selenium IDE?
We can insert a start point in the following ways:
– Right click on the command where the start point has to be set and select ‘Set/Clear Start Point’.
– Select the particular command and press ‘s’ or ‘S’ (shortcut key) for the same.
11) What are regular expressions and how you can use them in Selenium IDE?
A regular expression is a sequence of characters that define a search pattern. Usually such patterns are
used by string searching algorithms for “find” or “find and replace” operations on strings, or for input
validation.
Regular expressions can be used to match different content types on a web page – Links, elements and
text.
– Action: It commands Selenium IDE to perform an action i.e. accessing UI (User Interface) on the web
page.
– Assertion: It defines the verifications to be done on the data received from UI after running some
commands.
– Location Strategy: It defines a strategy to locate a web element on the Web Page. It could be by name,
ID, CSS, tag, XPath, etc.
13) How you will handle switching between multiple windows in Selenium IDE?
The selectWindow | tab=x and selectWindow | title=y commands switch between browser tabs. You can
use it with title=(title of tab to be selected) or, often easier, use tab= with number of the tab (e. g 0,1,2,
…).
selectWindow | TAB=OPEN | https://newwebsiteURL.com – this opens a new tab and loads the website
with the given URL.
14) How you will verify the specific position of an Web Element in Selenium IDE?
Selenium IDE indicates the position of an element by measuring (in pixels) how far it is from the left or
top edge of the browser window using the below commands:
verifyElementPositionLeft – verifies if the specified number of pixels match the distance of the element
from the left edge of the page.
verifyElementPositionTop – verifies if the specified number of pixels match the distance of the element
from the top edge of the page.
15) How you will retrieve the message in an Alert box in Selenium IDE?
We can use the storeAlert command to retrieve the alert message and store it in a variable.
25) How to set a global base URL for every test case of one test suite file in Selenium IDE?
Set an Environment variable to store the base URL and use it in every test case.