Amazon Selenium Interview Questions
Here is the list of Selenium Interview Questions which are recently asked in Amazon company. These questions are included for both Freshers and Experienced professionals. Our Selenium Training has Answered all the below Questions.
1. Test case enumeration for Credit card authorization system.
- Verify card number
- Verify expiry date and year
- Verify CVC
- Check with an invalid number
- Check card field accepts characters
- Verify payment gateway
- During the payment check error message
- Etc.,
2. Write code to remove duplicates from a string. Eg. Input: Call taxi. Output: Cal taxi.
//Import packages
import java.util.*;
//Creating RemoveDuplicatesExample1 class
class RemoveDuplicatesExample1
{
//Creating removeDuplicates() method to remove duplicates from array
static void removeDuplicate(char str[], int length)
{
//Creating index variable to use it as index in the modified string
int index = 0;
// Traversing character array
for (int i = 0; i < length; i++)
{
// Check whether str[i] is present before or not
int j;
for (j = 0; j < i; j++)
{
if (str[i] == str[j])
{
break;
}
}
// If the character is not present before, add it to resulting string
if (j == i)
{
str[index++] = str[i];
}
}
System.out.println(String.valueOf(Arrays.copyOf(str, index)));
}
// main() method starts
public static void main(String[] args)
{
String info = "javaTpoint is the best learning website";
//Converting string to character array
char str[] = info.toCharArray();
//Calculating length of the character array
int len = str.length;
//Calling removeDuplicates() method to remove duplicate characters
removeDuplicate(str, len);
}
}
3. What are the annotations used in TestNG?
These are,- @BeforeSuite
- @BeforeTest
- @BeforeClass
- @BeforeMethod
- @Test
- @AfterMethod
- @AfterClass
- @AfterTest
- @AfterSuite
4. How do you verify if the checkbox/radio is checked or not?
Use below code for verify if the checkbox/radio is checked or not,
String str = driver.findElement(By.id("26110162")).getAttribute("checked");
if (str.equalsIgnoreCase("true"))
{
System.out.println("Checkbox selected");
}
5. Give the example for method overload in WebDriver.
Example of method overloading:
class Adder{
static int add(int a,int b){return a+b;}
static int add(int a,int b,int c){return a+b+c;}
}
class TestOverloading1{
public static void main(String[] args){
System.out.println(Adder.add(2,2));
System.out.println(Adder.add(2,2,2));
}}
Output:
4
6
6. How do you achieve synchronization in WebDriver
Synchronization in selenium in achieved by using waits.
Static Wait - Thread.sleep()
- PageLoadTimeout
- ImplicitWait
- WebdriverWait (Explicit Wait)
- Fluent Wait
7. What are the advantages of selenium WebDriver?
- Speed and Performance
- Alerts, dropdowns, checkboxes, uploading files, etc., - Handling Dynamic Web elements.
- Works on differenet OS and different Browsers
- Easy commands
- Huge community
- Supports mobile testing
- Free and Open source
Free PDF : Get our updated Selenium Course Content pdf
8. Write code to find largest sum from contiguous sub array.
The syntax of an find largest sum from contiguous sub array is maxSum(array, n)
#include
using namespace std;
int maxSum( int arr[], int n) {
int tempMax = arr[0];
int currentMax = tempMax;
for (int i = 1; i < n; i++ ) { //find the max value
currentMax = max(arr[i], currentMax+arr[i]);
tempMax = max(tempMax, currentMax);
}
return tempMax;
}
int main() {
int arr[] = {-2, -3, 4, -1, -2, 1, 5, -3};
int n = 8;
cout << "Maximum Sum of the Sub-array is: "<< maxSum( arr, n );
}
9. Generate test data for time difference function.
You can add a time to a date or time in ISO 8601 (UTC) format, or subtracts it, if you use a negative number.Also, Converts a date string from the standard ISO 8601 (UTC) format to a custom format.
10. Debugging scenario for YouTube video not playing
- Verifying URL
- Verifying video upload functions
- Verifying video play button and mute, Unmute button
- Issues like Forward, Fullscreen, Video quality, buffering,etc.,
11. How do u get the attribute of the web element?
getAttribute() method – Is used to get the attribute of the web element.
getAttributeNode() method – Is use to get the attribute as an Attr object.
12. How to hover the mouse on an element?
Below are the methods Actions class for hover the mouse on an element.
moveToElement(WebElement target)
moveToElement(WebElement target, int xOffset, int yOffset)
13.Can Selenium handle windows based pop up?
Yes. Selenium handle the window based popup.
14. How to check if an element is visible on the web page?
isDisplayed() method is used to check the element is visible on the web page. It gives true value, the element is visible on the web page.
15. How to check the checkbox or radio button is selected?
isSelected() method is used to verify the button is selected for checkbox or radio button. It returns true value, element is selected also it returns false means not selected.
Book a Free Mock Interviews and Test your Selenium skills with our Experts
TOP MNC's SELENIUM INTERVIEW QUESTIONS & ANSWERS
Here we listed all Selenium Interview Questions and Answers which are asked in Top MNCs. Periodically we update this page with recently asked Questions, please do visit our page often and be updated in Selenium.
Related Blogs
To become a Selenium Certified professional and join in your dream company, Enroll now for our Best Selenium Training. We help you to crack any levels of Selenium Interviews and We offering Selenium Training with Placement Assistance.