Emailing Selenium Interview Questions-1
Emailing Selenium Interview Questions-1
6. What is a Framework?
If you are a beginner: You can say “No, I didn’t get a chance to
create framework from the scratch. I have used the framework
which is already available. My contribution is mostly in creating test
cases by using the existing framework.”
Firefox Browser
Firefox Driver
Java
C#
Python
Ruby
Perl
PHP
Windows
Linux
Apple
JUnit
TestNG
1. ID
2. Class Name
3. Name
4. Tag Name
5. LinkText
6. PartialLinkText
7. XPath
8. CSS Selector
Absolute XPath starts from the root node and ends with desired
descendant element’s node. It starts with top HTML node and
ends with input node. It starts with a single forward slash(/)
Relative XPath starts from any node in between the HTML page to
the current element’s node(last node of the element). It starts
with a double forward slash(//)
Eg: //input[@id='email']
Soft Assert collects errors during @Test Soft Assert does not throw
an exception when an assert fails and would continue with the next
step after the assert statement.
Hard Assert:
SearchContext.
1. ElementNotVisibleException
2. StaleElementReferenceException
WebDriverException
IllegalStateException
TimeoutException
NoAlertPresentException
NoSuchWindowException
NoSuchElementException
http://username:password@urlhttp://myUserName:myPassword@s
oftwaretestingmaterial.com
Implicit Waits
Explicit Waits
Fluent Waits
2 driver.get("https://www.gmail.com");
1 // To initialize js object
2 JavascriptExecutor JS = (JavascriptExecutor)webdriver;
3 // To enter username
4 JS.executeScript("document.getElementById('User').value='SoftwareTestingMaterial.com'");
5 // To enter password
6 JS.executeScript("document.getElementById('Pass').value='tester'");
46. How to clear the text in the text box using Selenium
WebDriver?
By using getAttribute(value);
Alternatively, you can use click method on the element which does
form submission
driver.get(): To open an URL and it will wait till the whole page gets
loaded
driver.navigate.to(): To navigate to an URL and It will
not wait till the whole page gets loaded
WebElement textbox =
driver.findElement(By.id(“textBoxLocator”));
Syntax of findElements()-
List <WebElement> elements =
element.findElements(By.id(“value”));
1. isDisplayed()
2. isSelected()
3. isEnabled()
i. Application issues
ii. Assertion Failure
iii. Difficulty to find Webelements on the web page
iv. Timeout to find Webelements on the web page
73. How can you find Broken Links in a page using Selenium
WebDriver?
74. How to find more than one web element in the list?
By using JavascriptExecutor
Test data can efficiently be read from excel using JXL or POI API.
POI API has many advantages than JXL.
Click here to see a practical example of using Apache POI.
AJAX stands for Asynchronous JavaScript and XML. AJAX allows the
web page to retrieve small amounts of data from the server without
reloading the entire page. AJAX sends HTTP requests from the client
to server and then process the server’s response without reloading
the entire page. To handle AJAX controls, wait commands may not
work. It’s just because the actual page is not going to refresh.
There are two cases which are majorly used to upload a file
in Selenium WebDriver such as using SendKeys Method and
using AutoIT Script.
driver.switchTo().frame();
@BeforeTest
@AfterTest
2 Import org.testng.annotations.*;
4 @Test(priority=0)
7 }
8 @Test(priority=1)
11 }
12 }
Parameterized tests allow developers to run the same test over and
over again using different values.
with testng.xml
with Data Providers
Groups are specified in your testng.xml file and can be found either
under the <test> or <suite> tag. Groups specified in the <suite> tag
apply to all the <test> tags .
1 @Test (groups = { "smokeTest", "functionalTest" })
3 System.out.println("Logged in successfully");
4}