Selenium interview questions

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What's is same origin policy? How is it handled?

A feature for security purposes. Webpages can access scripts from other webpages if the have the same origin (url)

How to handle multiple windows in Selenium?

A window handle is unique identifier that holds the address of all the windows. This is basically a pointer to a window, which returns the string value Set Switch Action get.windowhandle

How to handle mouse, keyboard ,mouse actions ?

Action class. Drag and drop

What are "Exceptions" in Selenium

An exception is an event or a problem that arises durning the execution stage of a program Example: WebdriverException NoalertPresentException NosuchWindowException NosuchFrameException NosuchElementException

What are assert and verify commands?

Assertion: compare the actual result of an application with the expected result Verify: there won't be any halt in the test execution even though the verify condition is true or false

What is selenium used for?

Automation testing suite. Helps in automating web applications across various browsers.

Difference between Selenium and QTP

Browser compatibility Distribution Application under test Repository Language support Vendor support End of the video

What's selenium framework?

Code structure for making code simple and readable Breaking code into smaller pieces

What is a robot class?

Controls the mouse and keyboard

Explain Selenium Grid?

Cross browsing and test execution Grid was designed to distribute commands to different machines at the same time. You can executes tests on different browsers/different operating systems.

Different frameworks?

Data driven Keyword driver Hybrid

What are the challenges of selenium web driver

Difficult to test image base application Can't perform tests on soap or rest Dependent on Jenkins for a report generation activity Can't test mobile apps Can't handle pop-ups Can't handle dynamic content Limited reporting

How can switch between the Frames

Driver.switchTo.frame Number Name or an ID Location of previous element

Why do you need session handling

Durning test execution stage you must interact with the browser for proper execution

Why do you prefer selenium?

Free and open source Large user base and helping community Cross browsing capability Platform compatibility Support for different programming languages such as Java python and C sharp

What are the webdriver API available?

HTMLunit. Fastest browser Firefox Chrome Opera

Mention the capabilities of selenium web driver

Handling multiple frames Handling pop ups Handling browser windows Alerts Helps page navigation Drag and drop Ui application

What are different types of selenium ide locators

ID Name LinkText Partial LinkText CSS Selector XPath

Explain WAIT statement?

Implicit wait: a statement that tells Selenium to wait for a certain amount of time before throwing a "no such element" exception driver.manage().timeouts.implicitlyWait(TimeOut,TimeUnit.SECONDS); explicit wait U

What are regular expressions?

Improves selenium webdriver tests

What is JavaScriptExecutor ?

Is an interface that helps to execute JavaScript through Selenium WebDriver "executescript" "executeAsyncScript" It's used when selenium webdriver fails to click on any element. Use x and y axis to scroll

FindElements and FindElements in selenium

Used to find the one or multiple elements used with the webpage

How can you capture server-side log in Selenium?

In order to get the server side login you would open the command prompt and type Java-jar.jar-log selenium.log

How can you debug test cases in selenium ide ?

Insert a break point from the location where you want to execute. Click debug and run

What is the Page Object Model (POM)?

It is a design pattern to create an Object Repository for web UI elements. There exists one page class for each web page in the application.

Explain the selenium rc? (remote control)

It is a server that allows users to write application tests in different programming languages. The commands from the test script are accepted by this server and are sent to the browser as selenium core Java script commands.

What is page factory?

It's a built in page object model pattern used to intialize web elements which are defined in page objects

Explain selenium grid

It's a part of selenium suite that specializes in running multiple test cases across different browsers

What are listeners in selenium ?

It's defined as an interface that modified the behavior of the system. Listeners allow customization of reports and logs

Mention why to choose Python over Java in selenium

Java tends to be slower Java uses traditional braces Java is static code

Mention the types of web locators

Locator is a command that tells selenium ide which GUI elements it's wants to operate on. Locators specify the area of action. ( textbox, buttons, check boxes) Locator by ID: it takes a parameter of string which is a value of id attribute and it returns the object to findElement method (driver.findElement(By.id("user")); Locator by link: your targeted element is link text then you can use link text element locator to locate that element driver.findElement(By.LinkText("Today's deals)).click(); Locator by partial link: target link can be located using a portion of text in a link text element driver.findElement(By.linkText("Service")).click(); Locator by Name: the first element with the name attribute value matching the location will be returned driver.findElement(By.name("books").click()); Locator by Tag Name: locates all the elements with the matching tag name driver.findElement(By.tagName("button").click()); Locator by class name: this finds elements based on the value of the class attribute. driver.findElement(By.className("inputtext)); Locator by css selector: faster than xpath. locates elements based on the drivers underlying css selector engine driver.findElement(By.cssSelector("input#email")).sendKeys("[email protected]");

What are locators in the Selenium IDE? Where can you change their order?

Locators are ways to tell Selenium IDE which GUI element a Selenese command should act upon.

Advantages of page object model?

Makes automation framework friendly. More durable and comprehensive. Keeps the tests and element locators separate Repository is independent of automation test Reuse object methods Best for apps with multiple pages Easy to write bc it uses business domain language

Can selenium handle window pop ups?

No Void dismiss Void accept String get Text Void send Keys (StringstringToScan)

What is action class?

Perform user requested actions with valid data. Special key board and mouse using advanced user interaction api

What is Selenese?

Selenese is the language which is used to write test scripts in Selenium IDE. Selenium commands: assertion (checkpoints verify state of app), accessors ( used for storing a value in a variable) , actions (used for performing operations. Ex:double click)

What's the difference between selenium 2.0 and 3.0

Selenium 2 used for backwards compatibility it does not have sel rc Selenium 3 more bug fixes and increased stability

Different components of selenium?

Selenium IDE Selenium RC Selenium Webdriver Selenium grid

How can you achieve database testing using selenium ?

Selenium does not support database testing It can be partially done using JDBC and ODBC and sql

Limits on selenium rc (remote control)

Server connection is needed before exciting test case/test script API are less object oriented Rc is slower when using Java script program

Explain selenium ide?

Simplest tool on the selenium suite. It is a Firefox/Chrome plug in that's was developed to speed up the creation of automation scripts. It records the user actions on the web browser and exports them as a reusable script.

How to build the object repository

Storage location for all objects

How to take a screen shot in selenium

TakeScreenShot interface by which we can getScreenshotAs method which will help in capturing the entire screenshot in the form of file then using FileUtils we can copy screenshots from one location to another location

What are the limitations of selenium

There is no reliable tech support Test only web applications not mobile apps Limited support for image testing No building reporting facility Limited test management You need to know basic knowledge of programming language

How do you achieve synchronization in Webdriver ?

Unconditional And conditional

What are the features of TestNg?

Unit testing and intergration testing?

How to work with Excel files in selenium

Use JXL (Java Excel) and Apache POI

What testing is supported by selenium

Use Jenkins Supports regression testing: full/ partial selection of already executed test cases which are re-executed to ensure existing features work fine (steps: retest, regression test selection,prioritize the test cases) Supports functional testing: verification of every function of the application ( identify test input, compute test outcome, execute test, compare the test outcome with the actual outcome )

How can you prepare a customized HTML report in TestNg using hybrid framework?

Use Junit with help of Ant TestNg using inbuild default file Also use XSL file

How can you handle network latency in selenium

Use the command driver.manage.pageLoadingTime() Gives you the time load for the page

Explain selenium webdriver?

Webdriver is a programming interface that helps create and run test cases. Communicate directly with the browser You don't need rc to use this.

What is XPath?

XPath is a query language for selecting elements within an XML document. Locators by xpath: takes parameter of string which is a xpathexpression and it returns an object to findElemnt method driver.findElement(By.xpath("//span[contains(text(),'an account')]")).getText();

Can I navigate back and forth the webpage in selenium?

Yes you can navigate the browser Driver.navigate.forward Driver.navigate.back Driver.navigate.refresh Driver.navigate.to("url")

What is JavaScript?

an object-oriented computer programming language commonly used to create interactive effects within web browsers.


संबंधित स्टडी सेट्स

902 A+ Chapter 10 - File Systems and RAID

View Set

Biology 1306 Chapter 4 Nucleic Acids and the RNA World

View Set

3700 Intro to Intelligence (Ohio State)

View Set

Social psychology Final questions

View Set