Selenium:
[Link] is selenium?
This is an Automation tool.
[Link] selenium components?
1. Selenium IDE(Integrated Development Environment)
It is used only for firefox
It can be used only for simple test cases.
2. Selenium RC(Remote control)1.0 version
Installation will be complicated by the server
3. Selenium WebDriver--> Automation Framework Tool
It supports all programming language for developing test script
It is programattic an interface
It can be easily integrated with eclipse
4. Selenium Grid
It is used for exceuting test cases across different system or machines
We can perform parallel execution so that the execution time can be reduced.
Used for Hub- node concepts
We can run in one machine (Hub)& execute in different machines.
RC + Webdriver-->2.0(advanced version 3.0)
selenium server-standalone 3.141.59
3. Explain about WebDriver?
Its a collection of open source API (Application programming Interface)
These are used to automate the web applications
It supports many browsers like Chrome,IE,Firefox,Safari etc...
Browser Driver name .exe Class name
Chrome [Link] [Link] chromedriver()
InternetExplorerDriver()
InternetExplorer [Link] [Link]
Firefox [Link] [Link] FirefoxDriver();
[Link] of Driver methods:
[Link]().to()
[Link]().back()
[Link]().forward()
[Link]().refresh()
[Link]()-->to get the current url of the webpage
[Link]()---> to get the current page title
[Link]()---> to close the current window
[Link]()---> to terminate the browsersession
[Link] DOM?
Document Object Model
<html
<head>...</head>
<body>...</body>
</html>
[Link] is Locators and types
Each and every context or text is an element in a web page.
We can find or locate the elements using Locators.
8 types:
1. id
2. name
3. xpath
4. classname
5. tagname
6. CSS Selector
7. Link Text
8. partialLink text
Pink= tagname
Orange= attributename
blue= attributevalue
black=text
[Link] XPath?
1. Absolute xpath--->from the beginning of the html. It starts with /slash
2. Relative xpath---> It starts from the middle of the DOM structure. //slash
1. //tagname[@attributeName='attributeValue']
ex: //input[@type='text']
2. (//tagname[@attributeName='attributeValue'])[index value]
ex. (//input[@type='text'])[2]
3. //tagname[contains(@attributeName,'partial_attributeValue')]
ex: (//input[contains(@class,'inputtext ')])[3]
4. //tagname[text()='textValue']
ex: //div[text()='Create a new account']
5. //tagname[contains(text(),'partialtextValue')]
ex: //span[contains(text(),'Create ')]
3. Dynamic xpath---> It will be dynamically changing
[Link] WebElement Methods?
[Link]()--> to pass the value in a textBox
[Link]()-->we can clear the text we pass inside the element.
[Link]()--> to click an element
[Link]()--> ("value")we get the value passed in the element
[Link]()--> ("attributeName")we get the value of the attribute name in DOM
structure
[Link]()--->to get the hidden text of the element
[Link]()-->whether the element is visbile or not in the application
[Link]()--> whether the element is clickable or editable in the application
[Link]()--> to check whether the element is already selected or not.
[Link] is Webtable in selenium?
A Web Table in Selenium is a WebElement used for the tabular representation of data or
information.
[Link] is the use of Webtable?
Web tables or data tables are often used in scenarios where you need to display the information
in a tabular format.
[Link] do I find the XPath of a Webtable?
Let's select an element in the web table and find its XPath. For Chrome, right-click and inspect
the given element to find its XPath.
[Link] do you find the no of rows and columns in a Webtable using selenium?
List<WebElement> alldata = [Link]([Link](___));
for (WebElement data : alldata) {
[Link]([Link]());
[Link] do I scroll to an element in Selenium?
In Selenium we need to take the help of a JavaScript executor to scroll to an element or scroll the
page: [Link]("arguments[0].scrollIntoView(true);", element)
WebElement scrolling =[Link]([Link](___)); JavascriptExecutor jd
= (JavascriptExecutor) driver;
[Link]("arguments[0].scrollIntoView()", scrolling);
[Link] is Selenium alert?
An Alert in Selenium is a small message box which appears on screen to give the user some
information or notification.
[Link] are the three types of alerts in Selenium?
In Selenium, there are three types of Alerts as follows:
Simple Alert. This alert is used to notify a simple warning message with an 'OK' button as
shown in the below snapshot.
[Link]().alert().accept();
Prompt Alert. This alert will ask the user to input the required information to complete the task.
[Link]().alert().accept() or dismiss();
Confirmation Alert:
[Link]().alert().sendkeys();
[Link]().alert().accept() or dismiss();
[Link] is frame in selenium?
iFrame in Selenium Webdriver is a web page or an inline frame which is embedded in another
web page or an HTML document embedded inside another HTML document.
[Link]().frame(0);
[Link] is the screenshot in Selenium?
To capture a screenshot in Selenium, we can make use of an interface, called TakesScreenshot.
This method indicates the driver, that it can capture a screenshot and store it in different ways.
TakesScreenshot tk=(TakesScreenshot) driver;
File source= [Link]([Link]);
File des=new File("F:/[Link]");
[Link](source,des );
[Link] is mouse hover in Selenium?
Hovering is a fundamental digital action that involves placing the mouse cursor on the target link
or button
[Link] is mouse over action?
In computing, a mouseover , mouse hover or hover box is a graphical control element that is
activated when the user moves or hovers the pointer over a trigger area.
Actions a=new Actions (driver);
[Link] Select in Selenium WebDriver?
WebElement testDropDown = [Link]([Link]("testingDropdown"));
Select dropdown = new Select(testDropDown);
[Link] is a Robot class in Selenium?
A Robot class in Selenium is used to generate native system input events for test automation,
self-running demos, and other applications where you need control over the mouse and
keyboard.
[Link](KeyEvent.VK_CONTROL);
[Link](KeyEvent.VK_V);
[Link](3000);
[Link] is window handles in selenium?
The window handle is a unique identifier that stores the values of windows opened on a webpage
and helps in window handling in Selenium. getWindowHandles( ) and getWindowHandles( )
handle windows in Selenium. The user has to switch from the parent window to the child
window to work on them using switchTo( ) method.
[Link] WebDriver provides three commands to implement waits in tests.
Implicit Wait.
Explicit Wait.
Fluent Wait.