Join us
@dridhone ・ Jul 18,2022 ・ 7 min read ・ 4731 views
1) What are the four parameter you have to pass in Selenium?
Four parameters that you have to pass in Selenium are
Host
Port Number
Browser
URL
2) What's the difference between the procedures setSpeed() and sleep()?
Both will slow down the execution process.
Thread. sleep () stops the current (java) thread for the amount of time supplied. It's only done once.
It only accepts a single integer argument.
Thread.sleep(2000), for example, will wait for 2 seconds.
It simply waits once for the order supplied during sleep.
Set Speed (): This command will pause the execution of all selenium commands for a specified amount of time.
It only accepts a single integer argument.
For example, selenium.setSpeed("2000") will wait 2 seconds.
After each command has been set, it is executed.
Delay the speed by the number of milliseconds specified in the set Speed parameter.
3) What is the policy of "same origin"? How do you get around the same origin policy?
The "Same Origin Policy" was implemented for security reasons, and it ensures that scripts from other sites will never be able to access anything on your site. According to the policy, any code loaded into the browser can only work within the domain of that website.
In proxy injection mode, the Selenium Server operates as a client-configured HTTP proxy, which sits between the browser and the application under test and then hides the AUT under a fictional URL to circumvent "Same Origin Policy."
4) What are browsers with heightened privileges?
Similar to Proxy Injection, the goal of heightened privileges is to allow websites to accomplish things that aren't normally permitted. The main distinction is that the browsers start in a specific mode known as heightened privileges. Selenium core can open the AUT directly and read/write its content using these browser modes instead of transmitting the entire AUT through the Selenium RC server.
5) How can you use Selenium to "submit" a form?
To submit a form, use the "submit" method on the element.
() element.submit;
Alternatively, you can utilise the click technique on the element that submits the form.
6) What are the features of TestNG, and what are some of the features that make TestNG more effective?
TestNG is a JUnit and NUnit-based testing framework that simplifies a wide range of testing needs, from unit testing to integration testing. And the features that make it an effective testing framework are:
Annotations are supported.
Data-driven testing is encouraged.
Configure tests in a variety of ways
Re-execution of failed test cases is possible.
7) Explain the distinction between implicit and explicit waiting.
Sets a timeout for all subsequent Web Element searches implicitly. It will keep looking for the element for the specified amount of time before throwing a NoSuchElementException. It sits and waits for the elements to appear.
Explicit Delay: It's a one-timer that's only utilised for one search.
8) Which characteristic should you evaluate in frame for "if no frame Id and no frame name" throughout the script?
You may use.....driver.findElements(By.xpath("/iframe")) to find elements....
This will give you a list of frames to choose from.
You'll have to go over each frame and look for the locator we're looking for.
Then you must break the loop.
9) What is the difference between the find elements () and the find element () functions?
find () element:
Using the provided "locating technique," it locates the first element on the current page. It gives you a single WebElement as a result.
findElements (): Find all the elements on the current page using the supplied "locating mechanism." It gives you a list of web elements as a result.
10) What are the JUnits annotations and how do they relate to Selenium?
The Selenium-related JUnits annotations are
@Before public void method() – Before each test, it will run the method (), which can be used to prepare the test.
Annotations for @Test public void method() This function is identified as a test method environment by the @Test annotation.
@After public void method()- To run a method before using this annotation, the test method must begin with test.
@Before 26) What is the difference between a data-driven framework and a keyword-driven framework?
Framework based on data: The test data is separated and kept outside the Test Scripts in this architecture, while the Test Case logic is kept inside the Test Scripts. External files (Excel files) with test data are read and loaded into variables within the Test Script. Variables are employed.
both in terms of input and verification values
Keyword-driven framework: Independent of test automation, keyword-driven frameworks necessitate the creation of data tables and keywords. The functionality of the application under test is documented in a table, together with step-by-step instructions for each test, in a keyword driven test.
11) Describe how you can log into any website if a password and username authentication window appears.
Use the url to pass the login and password.
http://username:password@url, for example, http://creyate:tom@gmail.com
12) Explain how to use Selenium 2.0 to assert the text of a webpage.
driver.findElement(By.id("ElementID")) WebElement el = driver.findElement(By.id("ElementID")) WebElement el = driver.findElement(B
/gets the test from the element and saves it in the text variable
el.getText(); text = el.getText();
/assert the expected text
Assert.assertEquals("Element Text", text); Assert.assertEquals("Element Text", text);
13) What is an Object Repository, and how does it work?
An object repository is a critical component of any UI automation since it allows a tester to keep all of the objects that will be utilised in the scripts in one or more centralised locations rather than scattering them throughout the test scripts.
14) What is the Selenium Grid and how does it work?
The tests were delivered to the hub by Selenium Grid. These tests have been rerouted. to Selenium Webdriver, which runs the test by launching the browser. It is possible to run tests in parallel using the whole test suite.
15) Is Selenium grid suitable for performance testing?
Yes. However, it does not perform as well as a specialised Performance Testing tool such as Loadrunner.
16) What are the benefits of using Webdriver instead of Selenium Server?
You don't require the Selenium Server if you're using Selenium-WebDriver because it uses a different technology.
Selenium Server has Selenium RC capabilities, which is needed for backwards compatibility with Selenium 1.0.
Selenium Web driver provides direct calls to browsers, taking advantage of each browser's inherent automation functionality, whereas Selenium RC relies on the selenium server injecting Javascript into the browser.
17) What capabilities does Selenium WebDriver or Selenium 2.0 have?
When you need better support for something, WebDriver is the way to go.
Multiple frames, pop-ups, browser windows, and notifications to manage
Drag and drop on the page Ajax-based UI elements can be drag-and-dropped.
Multi-browser testing, including improved capability for browsers that Selenium 1.0 does not support effectively.
17) What is the limitation that can be encountered while inserting capabilities in webdriver to execute tests on a browser that is not supported by a webdriver?
The "findElement" command may not perform as expected, which is a major limitation of injecting capabilities.
18) How can you use the Selenium Web driver to discover damaged images on a page?
The Selenium web driver can be used to find broken images on a page.
Get XPath and use tag name to get all the links on the page.
Click on each and every link on the page.
19) Look for the words 404/500 in the title of the destination page. How do you handle colours in a web driver?
You can use the web driver to handle colours.
To acquire the CSS value, use the getCssValue(arg0) method. colours by passing the string 'colour' as a parameter
20) How do you store a value in a text box using web driver?
You can use the web driver to store a value in a text box by using the following command.
findElement(By.id("your Textbox")); driver.findElement(By.id("your Textbox")); driver.findElement(By.
sendKeys("your keyword"); sendKeys("your keyword"); sendKeys("your keyword
21) Can you explain how you can change frames?
The [driver.switchTo().frame()] method in webdrivers takes one of three arguments to switch between frames.
a figure: It chooses a number based on its (zero-based) index.
A name or identification number: Choose a frame based on its name or ID.
WebElement: a previously discovered WebElement: a previously discovered WebElement: Select a frame using the WebElement that was previously located.
22) Mention What were the 5 different Selenium web driver exceptions you encountered?
You had five separate exceptions with Selenium web drivers.
WebDriverException
NoAlertPresentException
NoSuchWindowException
NoSuchElementException
TimeoutException
23) Explain using Webdriver how you can perform double click ?
Using the mouse, you can do a double click.
Act = new Actions (driver); act.doubleClick(webelement);
24) Syntax- Actions act = new Actions (driver); act.doubleClick(webelement); How will you upload a file with Selenium?
You can enter in a file input box of an upload file using the "type" command. Then, to make file upload work, you must use JAVA's "Robot" class.
25) Which implementation of a web driver is the quickest?
HTMLUnitDriver's implementation is the quickest; HTMLUnitDriver does not run tests in the browser but instead sends a plain http request, which is far faster than opening a browser and running tests.
Join other developers and claim your FAUN account now!
Founder, www.dridhon.com
@dridhoneInfluence
Total Hits
Posts
Only registered users can post comments. Please, login or signup.