Selenium Testing Interview Questions And Answers Pdf

1. however do I launch the browser victimization WebDriver?

Answer: the subsequent syntax are often accustomed launch the Browser:

WebDriver driver = new FirefoxDriver();
WebDriver driver = new ChromeDriver();
WebDriver driver = new InternetExplorerDriver();

2. what’s the distinction between dish and jxl jar?

Answer:
JXL supports the “.xls” format i.e. binary-based format. JXL doesn’t support stand out 2007 and “.xlsx” format i.e. XML based mostly on the format
The JXL documentation isn’t as comprehensive as that of dish
JXL API doesn’t support wealthy text format
JXL API is quicker than dish API

POI jar supports all of those formats
POI is frequently updated and discharged
POI contains a well ready and extremely comprehensive documentation
POI API supports wealthy text format
POI API is slower than JXL API

3. a way to assert the title of the online page?

Answer: //verify the title of the online page

assertTrue(“The title of the window is wrong.”,driver.getTitle().equals(“Title of the page”));

4. what’s a data-driven framework?

Answer: The Data-Driven check style framework follows a style paradigm wherever check logic is fastened however varies the check information. the info itself is often in numerous repositories sort of a straightforward .csv file, .json file or .xls sheet, or information, and might add the checks just change those external files or decibel (instead of putting in test code itself).

5. what’s an Object Repository? however, will we tend to produce Associate in Nursing Object Repository in Selenium?

Answer: Object Repository could be a term accustomed discuss with the gathering of internet components happiness to Application underneath check (AUT) in conjunction with their surveyor values. Thus, whenever the part is needed at intervals the script, the surveyor worth are often inhabited from the article Repository. Object Repository is employed to store locators in a very centralized location rather than arduous committal to writing them at intervals the scripts.
In chemical elements, objects are often held on in Associate in Nursing stand-out sheet that may be inhabited within the script whenever needed.
That’s all for currently.
Hope during this article you’ll realize answers to the foremost commonly asked chemical element and WebDriver Interview queries. The answers provided here are useful for understanding the chemical element basics and advanced WebDriver topics.
Do you have any chemical element Interview queries that aren’t answered here? Please allow us to apprehend within the comments below and that we can try and answer all.

6. however a text written in a very text field may be cleared?

Answer: A text written in a very text field may be deleted by victimization the clear() technique.

7. will WebDriver check Mobile applications?

Answer: WebDriver cannot check Mobile applications. WebDriver could be a web-based testing tool, so applications on mobile browsers are often tested.

8. what’s the FirefoxDriver, class, or interface? And that interface will it implement?

Answer: FirefoxDriver could be a Java category. It implements all the strategies on the market within the interface.

9. make a case for, however, you’ll be able to capture server-side log chemical element Server?

Answer: To capture server-side log in chemical element Server, you’ll be able to use the command: java –jar .jar –log chemical element.log

10. a way to verify if the checkbox/radio is checked or not?

Answer: is Selected() technique is employed to verify if the checkbox/radio is checked or not.

11. what’s the distinction between realizeElement () and find components ()?

Answer: each of them lets the user realize components within the current website matching the desired surveyor worth. however if you utilize realize Element(), solely the primary matching part would be fetched. 

12. will we tend to use atomic number 34 RC for tests driving on 2 totally different browsers on one software while not atomic number 34 Grid?

Answer: we will couple if the JAVA testing framework isn’t used. If we tend to use the Java consumer driver of atomic number 34, rather than employing a Java testing framework, TestNG permits the United States to not use atomic number 34 Grid.

13. what’s IntelliJ?

Answer: IntelliJ is an associate degree IDE that helps users to write down code for atomic number 34 higher and quicker. It might be used as an associate degree choice for Java bean and Eclipse.

14. however am I able to browse take a look at knowledge from excels?

Answer: take a look at the knowledge that will with efficiency be browsed from surpassing victimization JXL or dish API. See the elaborated tutorial here.

15. however, will we tend to handle Web-based pop-ups?

Answer: There square measure four ways of effective Web-based pop-up handling:
string getText() methodology returns the text displayed on the alert box (Company)
void accept() methodology clicks on the “Ok” button as before long because the pop-up window seems
void dismiss() methodology clicks on the “Cancel” button as before long because the pop-up window seems
void sendKeys(String stringToSend) methodology enters the desired string pattern into the alert box.

16. that net driver implementation is that the fastest?

Answer: The quickest net Driver is HTML Unit Driver. Differing from different drivers (Firefox Driver, Chrome Driver, etc), it’s non-GUI, whereas running no browser gets launched.

17. however, would you take a look at your component locator?

Answer: “Find Button” of atomic number 34 IDE is employed to check the surveyor. Clicking on this button, you’ll see on-screen if your component surveyor is correct or wrong.
Also, you’ll use the “FirePath” plugin in Firefox. 

18. the way to set legal action priority in TestNG?

Answer: TestNG “Priority” is employed to schedule the take a look at cases. to realize this, we’d like to feature associate degree annotation as @Test(priority=??). The default price is zero for priority. If you do not mention the priority, it’ll take all the take a look at cases as “priority=0” and execute. ( oracle apex training online )
The example below shows the usage of the priority for taking a look at cases.
As we’ve got not outlined the priority for the legal action “Registration”, it’ll get dead 1st and so the opposite take a look at cases supported priority.

19. however does one send ENTER/TAB keys in WebDriver?

Answer: use click() or submit() ways square measure used for entering. But, don’t forget that the submit() methodology is employed on the condition that type=’ submit’.
You can use Actions nonpareil.sendKeys(Keys. ENTER) for TAB.

20. however, may mythical being controls be handled in WebDriver?

Answer: mythical being permits the online page to retrieve little amounts of information from the server while not reloading the complete page.
The different wait ways ought to be applied for testing the mythical being application:

  • Thread Sleep
  • Implicit Wait
  • Explicit Wait
  • WebdriverWait
  • Fluent Wait

21. may you justify the road of code Webdriver driver = new FirefoxDriver()?

Answer: ‘WebDriver’ is an associate degree interface and that we square measure making associate degree object of kind WebDriver instantiating associate degree object of FirefoxDriver category.

22. what’re the alternate thanks to click on the login button?

Answer: submit() methodology might be used because the alternate thanks to click on the login button, however on condition that attributes type=submit. ( tableau online training  )

23. what’s the testng.xml file used for?

Answer: testng.xml file is employed to put together the total check suite. Here we will produce a check suite, produce check teams, mark tests for parallel execution, add listeners and pass parameters to check scripts. They are often used for the additional check suite triggering. 

24. what’s the Associate in Nursing Exception?

Answer: Exceptions area unit events because that java program end suddenly while not giving expected output. Java provides a framework wherever a user will handle exceptions.

The process of handling Exceptions is termed Exception Handling.
Exceptions have to be compelled to be handled as a result of they break the conventional flow of execution of a program.

One of the necessary intentions of exception handling is to stop this break and continue program execution. Sometimes, you would possibly need to perform some series of actions on occurring of an exact exception.
When Associate in Nursing exception happens, Associate in Nursing exception object is formed that is technically cited as ‘Throwing Associate in Nursing Exception’ and that we add Try/Catch blocks like,
try that may throw Associate in Nursing exception is value-added within the strive block.
once no exception is thrown, the strive statement is dead and not the catch statement.
For example: once the element script fails because of the incorrect surveyor, then the developer ought to be ready to perceive the explanation for failure and this may be achieved simply if the exception is handled properly within the program.
In my expertise, it’s best to undertake to avoid WebDriver exceptions whenever attainable and catch actually exceptional cases. Use try/catch to handle things that get it wrong and area unit outside my management. ( Hadoop online training)

25. does one recognize how to refresh the browser by mistreatment Selenium?
Answer:

navigate().refresh()

getCurrentUrl()

navigate().to(driver.getCurrentUrl())

sendKeys(Keys.F5)

26. What area unit the constraints of Selenium?
Answer:

Following area unit the constraints of Selenium:

Selenium supports testing of solely web-based applications

Mobile applications can not be tested mistreatment element

Captcha and Barcode readers can not be tested mistreatment element

Reports will solely be generated mistreatment third-party tools like TestNG or JUnit.

As element could be a free tool, therefore there’s no prepared vendor support

the user will realize various serving to communities.

The user is predicted to possess previous artificial language information.

27. however, can you employ an element to transfer a file?
Answer:
File uploading action might be performed by mistreatment parts.sendKeys(“path of file”) on the net part of input tag and kind file: < name=”fileUpload” type=”file” 

28. What strategies of the golem category does one know?
Answer: Some usually and popularly used strategies of golem category throughout net automation

29. what’s the aim of deselecting all() method?
Answer: it’s wont to deselect all the choices that are chosen from the drop-down list.

30. what’s the distinction between @Factory and @Data supplier annotation?
Answer: @DataProvider cares about individual check strategies and runs the precise strategies for several times. @Factory technique creates check category instances and runs all the check strategies therein category with completely different information. sets.

31. what’s the aim of the getOptions()method?
Answer: getOptions() is employed to induce the chosen choice from the drop-down list.

32. what’s golem API?
Answer: golem API is employed to regulate keyboard or mouse to move with OS windows like transfer pop-up, Alerts, Print Pop-ups, etc., or native software system applications like a pad of paper, Skype, Calculator, etc.

33. a way to login to any website if it’s showing any authentication popup for
username and password?
Answer: you must pass the username and secret with URL:

34. once AutoIT is used?
Answer: machines wont to handle window GUI and non-HTML popups within the application.

35. justify why to settle on Python over Java in Selenium?
Answer: Here area unit some points that favor Python over Java to use with Selenium:
Python is easier and a lot of compact compared to Java
Java uses ancient braces to start out and ends blocks, whereas Python uses indentation
Java employs static writing, whereas Python is dynamically typewritten

36. however are you able to handle network latency mistreatment Selenium?
Answer:
You can use driver.manage().timeouts().pageLoadTimeout(); for network latency.

37. what’s the distinction between drivers. close() and driver. quit command?
Answer: Object repository is an important entity in any UI automation that permits a checker to store all objects that may be utilized in the scripts in one or a lot of centralized locations instead of scattered everywhere the test scripts.

38. What are the most benefits of Selenium?
Answer: Se is a free and ASCII text file. you do not have to be compelled to pay any licensing price to use it.
Cross Browser compatibility (Firefox, Chrome, web mortal, Safari, etc.)

39. however, will we discover the worth of various attributes like name, class, the worth of AN element?
Answer: exploitation getAttribute(“”) methodology we will notice the worth of various attrbutes of a part e.g.-
String valueAttribute =
driver.findElement(By.id(“elementLocator”)).getAttribute(“value”);

40. a way to delete cookies in selenium?
Answer: exploitation deleteAllCookies() method-
driver.manage().deleteAllCookies();

41. what’s AN implicit wait in selenium?
Answer: AN implicit wait could be a style of wait that waits for a given time whereas locating a part before throwing NoSuchElementException. As by default Se tries to search out parts now once needed with none wait. So, it’s sensible to use implicit wait. This wait is applied to any or all the weather of the present driver instance. ( data science online training )

42. what’s a precise wait in selenium?
Answer: a precise wait could be a style of wait that’s applied to a selected internet component till the expected condition given is met.

WebDriverWait wait = new WebDriverWait(driver, 10);

WebElement component = wait.until(ExpectedConditions.elementToBeClickable(By.id(“elementId”);

43. What are some expected conditions which will be employed in express waits?
Answer: a number of the ordinarily used expected conditions of a part which will be used with expicit waits are-
elementToBeClickable(WebElement component or By locator)
stalenessOf(WebElement element)
visibilityOf(WebElement element)
visibilityOfElementLocated(By locator)
invisibilityOfElementLocated(By locator)
attributeContains(WebElement component, String attribute, String value)
alertIsPresent()
titleContains(String title)
titleIs(String title)
textToBePresentInElementLocated(By, String)

44. what’s fluent wait in selenium?
Answer: A fluent wait could be a style of wait that|during which|within which} we {will|we can} additionally specify polling interval(intervals when which driver will attempt to notify the element) in conjunction with the most timeout worth.
Wait wait = new FluentWait(driver)
.withTimeout(20, SECONDS)
.pollingEvery(5, SECONDS)
.ignoring(NoSuchElementException.class);
WebElement textBox = wait.until(new Function() {
public WebElement apply(WebDriver driver) {
return driver.findElement(By.id(“textBoxId”));

45. a way to mouse hover a part in selenium?
Answer: Code to mouse hover over a part in selenium-
Actions action = new Actions(driver);
Web component element=driver. notice Element(By.id(“element Id”));
action. move To Element(element).perform();

46. What are DesiredCapabilities in Se internet driver?
Answer: Desired capabilities are a group of key-value pairs that are used for storing or configuring browser-specific properties like its version, platform, etc within the browser instances. 

47. What are some ordinarily encountered exceptions in selenium?
Answer: a number of the ordinarily seen exceptions in Se are-
NoSuchElementException – once no component may be set from the surveyor provided.
ElementNotVisibleException – once a part is a gift within the dom, however, isn’t visible.
NoAlertPresentException – once we {try to|attempt to|try ANd} switch to an alert however the targetted alert isn’t a gift.
NoSuchFrameException – once we attempt to switch to a frame however the targetted frame isn’t a gift.
NoSuchWindowException – once we attempt to switch to a window however the targetted window isn’t a gift.
UnexpectedAlertPresentException – once AN sudden alert blocks the traditional interaction of the driving force.
TimeoutException – once a command execution gets a timeout.
InvalidElementStateException – once the state of a part isn’t applicable for the specified action.
NoSuchAttributeException – once we are attempting to fetch AN attribute’s worth however the attribute isn’t correct
WebDriverException – once there’s some issue with driver instance preventing it from obtaining launched.

48. a way to check that choice within the dropdown is selected?
Answer: exploitation the isSelected() methodology we will check the state of a dropdown’s choice.
Select countriesDropDown = new choose(driver.findElement(By.id(“countries”)));
dropdown.selectByVisibleText(“India”);
//returns true or false worth
System.out.println(driver.findElement(By.id(“India”)).isSelected());

49. a way to find link exploitation its text in selenium?
Answer:
Using link text() and partial link text() we will find a link. The distinction between the 2 is link text matches the entire string passed as a parameter to the link texts. Whereas partial link text matches the string parameter part with the link texts.
WebElement link1 = driver.findElement(By.linkText(“artOfTesting”));
WebElement link2 = driver.findElement(By.partialLinkText(“artOf”));

50. What are the advantages of Automation Testing?
Answer: 

Benefits of Automation testing are:

  • Supports execution of recurrent take a look at cases
  • Aids in taking a look at an oversized test matrix
  • Enables parallel execution
  • Encourages unattended execution
  • Improves accuracy thereby reducing human-generated errors
  • Saves time and cash

Leave a Comment

Scroll to Top