SELENIUM QUESION

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

How you can use "submit" a form using Selenium ?

You can use "submit" method on element to submit form- element.submit () ; Alternatively you can use click method on the element which does form submission

How will you use Selenium to upload a file ?

You can use "type"command to type in a file input box of upload file. Then, you have to use "Robot" class in JAVA to make file upload work.

Using web driver how you can store a value which is text box?

You can use following command to store a value which is text box using web driver driver.findElement(By.id("your Textbox")).sendKeys("your keyword");

How you can convert any Selenium IDE tests from Selenese to another language?

You can use the format option of Selenium IDE to convert tests into another programming language

How can you retrive the message in an alert box ?

You can use the storeAlert command which will fetch the message of the alert pop up and store it in a variable.

How will you verify the specific position of an web element

You can use verifyElementPositionLeft & verifyElementPositionTop. It does a pixel comparison of the position of the element from the Left and Top of page respectively

Which attribute you should consider throughout the script in frame for "if no frame Id as well as no frame name"?

You can use.....driver.findElements(By.xpath("//iframe")).... This will return list of frames. You will need to switch to each and every frame and search for locator which we want. Then break the loop

Explain what can cause a Selenium IDE test to fail?

1. When a locator has changed and Selenium IDE cannot locate the element 2. When element Selenium IDE waiting to access did not appear on the web page and the operation timed out 3. When element Selenium IDE was trying to access was not created

For Database Testing in Selenium Webdriver what API is required?

For Database Testing in Selenium Webdriver, you need JDBC (Java Database Connectivity) API. It allows you to execute SQL statements.

Explain how you can use recovery scenario with Selenium?

Recovery scenarios depend upon the programming language you use. If you are using Java then you can use exception handling to overcome the same. By using "Try Catch Block" within your Selenium WebDriver Java tests

Explain how Selenium Grid works?

Selenium Grid sent the tests to the hub. These tests are redirected to Selenium Webdriver, which launch the browser and run the test. With entire test suite, it allows for running tests in parallel.

Explain what are the limitations of Selenium IDE?

The limitations of Selenium IDE 1. Exceptional handling is not present 2. Selenium IDE uses only HTML languages 3. External databases reading is not possible with IDE 4. Reading from the external files like .txt, .xls is not possible 5. Conditional or branching statements execution like if,else, select statements is not possible

Explain what is the main difference between web-driver and RC ?

The main difference between Selenium RC and Webdriver is that, selenium RC injects javascript function into browsers when the page is loaded. On the other hand, Selenium Webdriver drives the browser using browsers built in support

Using Selenium how can you handle network latency ?

To handle network latency you can use driver.manage.pageloadingtime for network latency

What is Selenium 2.0 ?

Web Testing tools Selenium RC and WebDriver are consolidated in single tool in Selenium 2.0.

In Selenium what are Breakpoints and Startpoints?

1. Breakpoints: When you implement a breakpoint in your code, the execution will stop right there. This helps you to verify that your code is working as expected. 2. Startpoint: indicates the point from where the execution should begin. Startpoint can be used when you want to run the testscript from the middle of the code or a breakpoint.

What are the advantages of RC?

1. Can read or write data from/ to .xls, .txt, etc 2. It can handle dynamic objects and Ajax based UI elements 3. Loops and conditions can be used for better performance and flexibility 4. Support many Programming languages and Operating Systems 5. For any JAVA script enabled browser Selenium RC can be used

Explain what is Datadriven framework and Keyword driven?

1. Datadriven framework: In this framework, the test data is separated and kept outside the Test Scripts, while Test Case logic resides in Test Scripts. Test data is read from the external files ( Excel Files) and are loaded into the variables inside the Test Script. Variables are used for both for input values and for verification values. 2. Keyword framework: The keyword driven frameworks requires the development of data tables and keywords, independent of the test automation. In a keyword driven test, the functionality of the application under test is documented in a table as well as step by step instructions for each test.

Explain how you can debug the tests in Selenium IDE ?

1. Insert a breakpoint from the location where you want to execute step by step 2. Run the test case 3. At the given breakpoint execution will be paused 4. To continues with the next step click on the Blue button 5. To run commands at a time click on the run button

Why testers should opt for Selenium and not QTP?

1. Selenium is open-source whereas QTP is a commercial tool 2. Selenium is used specially for testing web-based applications while QTP can be used for the testing client-server application also 3. Selenium supports Firefox, IE, Opera, Safari on operating systems like Windows, Mac, Linux, etc. however QTP is limited to Internet Explorer on Windows. 4. Selenium supports many programming languages like Ruby, Perl, Python whereas QTP supports only VB script

List out different types of locators?

Different types of locators are By.id() By.name() By.tagName() By.className() By.linkText() By.partialLinkText() By.xpath By.cssSelector()

How will you find an element using Selenium?

In Selenium every object or control in a web page is referred as an elements, there are different ways to find an element in a web page they are 1. ID 2. Name 3. Tag 4. Attribute 5. CSS 6. Linktext 7. PartialLink Text 8. Xpath

Explain how you can capture server side log in Selenium Server?

To capture server-side log in Selenium Server, you can use the command java -jar .jar -log selenium.log

While using click command can you use screen coordinate?

To click on specific part of element, you would need to use clickAT command. ClickAt command accepts element locator and x, y co-ordinates as arguments- clickAt (locator, cordString)

What is the difference between type keys and type commands ?

TypeKeys() will trigger JavaScript event in most of the cases whereas .type() won't. Type key populates the value attribute using JavaScript whereas .type command emulates like actual user typing

Can we use Selenium grid for performance testing?

Yes. But not as effectively as a dedicated Performance Testing tool like Loadrunner.

Explain how you can handle frames using Selenium 2.0 ?

To bring control on HTML frame you can use "SwitchTo" frame method- driver.switchTo().frame("frameName"); To specify a frame you can use index number driver.switchTo().frame("parentFrame.4.frameName"); This would bring control on frame named- "frameName" of the 4th sub frame names "parentFrame"

To generate pdf reports mention what Java API is required?

To generate pdf reports, you need Java API IText.

Explain what is the difference between find elements () and find element () ?

find element (): It finds the first element within the current page using the given "locating mechanism". It returns a single WebElement findElements () : Using the given "locating mechanism" find all the elements within the current page. It returns a list of web elements.

List out the technical challenges with Selenium?

1. Selenium supports only web-based applications 2. It does not support the Bitmap comparison 3. For any reporting related capabilities have to depend on third-party tools 4. No vendor support for tool compared to commercial tools like HP UFT 5. As there is no object repository concept in Selenium, maintainability of objects becomes difficult

What are the technical limitations while using Selenium RC?

Apart from the "same-origin policy" restriction from js, Selenium is also restricted from exercising anything that is an outside the browser.

What is the difference between verify and assert commands?

Assert: Assert allows to check whether an element is on the page or not. The test will stop on the step failed, if the asserted element is not available. In other words, the test will terminated at the point where check fails. Verify: Verify command will check whether the element is on the page, if it is not then the test will carry on executing. In verification, all the commands are going to run guaranteed even if any of test fails.

How Selenium grid hub keeps in touch with RC slave machine?

At predefined time selenium grid hub keeps polling all RC slaves to make sure it is available for testing. The deciding parameter is called "remoteControlPollingIntervalSeconds" and is defined in the "grid_configuration.yml" file

What is the difference between setSpeed() and sleep() methods?

Both will delay the speed of execution. Thread.sleep () : It will stop the current (java) thread for the specified period of time. Its done only once It takes a single argument in integer format Ex: thread.sleep(2000)- It will wait for 2 seconds It waits only once at the command given at sleep SetSpeed () : For specific amount of time it will stop the execution for every selenium command. It takes a single argument in integer format Ex: selenium.setSpeed("2000")- It will wait for 2 seconds Runs each command after setSpeed delay by the number of milliseconds mentioned in set Speed This command is useful for demonstration purpose or if you are using a slow web application

What are the two modes of views in Selenium IDE ?

Either Selenium IDE can be opened as a pop up window or in side bar

List out the test types that are supported by Selenium?

For web based application testing selenium can be used The test types can be supported are a) Functional, Learn More about Functional Testing. b) Regression For post release validation with continuous integration automation tool could be used a) Jenkins b) Hudson c) Quick Build d) CruiseCont

What are the four parameter you have to pass in Selenium?

Four parameters that you have to pass in Selenium are 1. Host 2. Port Number 3. Browser 4. URL

From Selenium IDE how you can execute a single line?

From Selenium IDE single line command can be executed in two ways 1. Select "Execute this command" by right clicking on the command in Selenium IDE 2. Press "X" key on the keyboard after selecting the command in Selenium IDE

Which web driver implementation is fastest?

HTMLUnit Driver implementation is fastest, HTMLUnitDriver does not execute tests on browser but plain http request, which is far quick than launching a browser and executing tests

What is the command that is used in order to display the values of a variable into the output console or log?

In order to display a constant string, command can be used is echo <constant string> If order to display the value of a variable you can use command like echo ${variable name>> Above is using PHP. If you are using Java, replace echo with System.out.println

In selenium IDE what are the element locators that can be used to locate elements on web page?

In selenium there are mainly 4 locators that are used X-path locators Css locators Html id Html name

Explain how you can insert a start point in Selenium IDE?

In two ways selenium IDE can be set Press "S" key on the keyboard and select the command in Selenium IDE In Seleniun IDE right click on the command and the select "Set / Clear Start Point"

Mention what is IntelliJ?

Intellij is an IDE that helps you to write better and faster code for Selenium. Intellij can be used in the option to Java bean and Eclipse.

While injecting capabilities in webdriver to perform tests on a browser which is not supported by a webdriver what is the limitation that one can come across?

Major limitation of injecting capabilities is that "findElement" command may not work as expected.

Explain how you can login into any site if it's showing any authentication popup for password and username?

Pass the username and password with URL 1. Syntax-http://username:password@url 2. ex- http://creyate:[email protected]

What is Selenese and what are the types of Selenese ?

Selenese is a selenium set of command which are used for running the test There are three types of Selenese Actions: It is used for performing the operations and interactions with the target elements Assertions: It is used as a check points Accessors: It is used for storing the values in a variable

Mention what is Selenium 3.0?

Selenium 3.0 is the latest version of Selenium. It has released 2 beta versions of selenium 3.0 with few of the below changes: Here are few new features added to Selenium 3.0 Beta 1 updates 1. Minimum Java version is now 8+ 2. It will support for Firefox Via Mozilla's geckodriver 3. It will support for Firefox Via Mozilla's geckodriver 4. Support for Edge is provided by MS 5. It now supports Safari on macOS via Apple's own Safari driver Beta 2 updates (Only for Java) 1. System property webdriver.gecko.driver now forces the server in marionette or legacy firefox driver mode, ignoring any related Desired Capability 2. Grid fixes NPE's on registration when -browser not specified 3. Update GeckoDriver -port argument in all bindings

Why Selenium RC is used?

Selenium IDE does not directly support many functions like condition statements, Iteration, logging and reporting of test results, unexpected error handling and so on as IDE supports only HTML language. To handle such issues Selenium RC is used it supports the language like Perl, Ruby, Python, PHP using these languages we can write the program to achieve the IDE issues.

What is selenium RC (Remote Control)?

Selenium IDE have limitations in terms of browser support and language support. By using Selenium RC limitation can be diminished. 1. On different platforms and different web browser for automating web application selenium RC is used with languages like Java, C#, Perl, Python 2. Selenium RC is a java based and using any language it can interact with the web application 3. Using server you can bypass the restriction and run your automation script running against any web application

What is Selenium and what is composed of?

Selenium is a suite of tools for automated web testing. It is composed of 1. Selenium IDE (Integrated Development Environment) : It is a tool for recording and playing back. It is a firefox plugin 2. WebDriver and RC: It provide the APIs for a variety of languages like Java, .NET, PHP, etc. With most of the browsers Webdriver and RC works. 3. Grid: With the help of Grid you can distribute tests on multiple machines so that test can be run parallel which helps in cutting down the time required for running in browser test suites

Mention when to use AutoIT?

Selenium is designed to automate web-based applications on different browsers. But to handle window GUI and non-HTML popups in the application you need AutoIT. know more about How to use AutoIT with Selenium

Explain the difference between single and double slash in X-path?

Single slash '/ ' Single slash ( / ) start selection from the document node It allows you to create 'absolute' path expressions Double Slash '// ' Double slash ( // ) start selection matching anywhere in the document It enables to create of 'relative' path expressions

Explain what are the JUnits annotation linked with Selenium?

The JUnits annotation linked with Selenium are 1. @Before public void method() - It will perform the method () before each test, this method can prepare the test 2. @Test public void method() - Annotations @Test identifies that this method is a test method environment 3. @After public void method()- To execute a method before this annotation is used, test method must start with test@Before

Mention what is desired capability? How is it useful in terms of Selenium?

The desired capability is a series of key/value pairs that stores the browser properties like browser name, browser version, the path of the browser driver in the system, etc. to determine the behavior of the browser at run time. For Selenium, 1. It can be used to configure the driver instance of Selenium WebDriver. 2. When you want to run the test cases on a different browser with different operating systems and versions.

Mention what are the types of Listeners in TestNG?

The types of Listeners in TestNG are, 1. IAnnotationTransformer 2. IAnnotationTransformer2 3. IConfigurable 4. IConfigurationListener 5. IExecutionListener 6. IHookable 7. IInvokedMethodListener 8. IInvokedMethodListener2 9. IMethodInterceptor 10. IReporter 11. ISuiteListener 12. ITestListener

From your test script how you can create HTML test report?

To create an HTML test report there are three ways TestNG: Using inbuilt default.html to get the HTML report. Also, XSLT reports from ANT, Selenium, TestNG combination JUnit: With the help of ANT Using our own customized reports using XSL jar for converting XML content to HTML

To enter values onto text boxes what is the command that can be used?

To enter values onto text boxes we can use command sendkeys()

Explain how you can find broken images in a page using Selenium Web driver ?

To find the broken images in a page using Selenium web driver is 1. Get XPath and get all the links in the page using tag name 2. In the page click on each and every link 3. Look for 404/500 in the target page title

Explain how you can handle colors in web driver?

To handle colors in web driver you can use Use getCssValue(arg0) function to get the colors by sending 'color' string as an argument

How can we handle pop-ups in RC ?

To handle pop-ups in RC , using selectWindow method, pop-up window will be selected and windowFocus method will let the control from current window to pop-up windows and perform actions according to script.

How do you identify an object using selenium?

To identify an object using Selenium you can use isElementPresent(String locator) isElementPresent takes a locator as the argument and if found returns a Boolean

Explain how you can switch back from a frame?

To switch back from a frame use method defaultContent() Syntax-driver.switchTo().defaultContent();

What if you have written your own element locator and how would you test it?

To test the locator one can use "Find Button" of Selenium IDE, as you click on it, you would see on screen an element being highlighted provided your element locator is right or or else an error message will be displayed

Explain how to assert text of webpage using selenium 2.0 ?

WebElement el = driver.findElement(By.id("ElementID")) //get test from element and stored in text variable String text = el.getText(); //assert text from expected Assert.assertEquals("Element Text", text);

Mention what is the use of X-path?

X-Path is used to find the WebElement in web pages. It is also useful in identifying the dynamic elements.

What are the features of TestNG and list some of the functionality in TestNG which makes it more effective?

TestNG is a testing framework based on JUnit and NUnit to simplify a broad range of testing needs, from Unit Testing to Integration Testing. And the functionality which makes it an efficient testing framework are 1. Support for annotations 2. Support for data-driven testing 3. Flexible test configuration 4. Ability to re-execute failed test cases

Explain what is framework and what are the frameworks available in RC?

A collection of libraries and classes is known as Framework and they are helpful when testers has to automate test cases. NUnit, JUnit, TestNG, Bromine, RSpec, unittest are some of the frameworks available in RC .

What are regular expressions? How you can use regular expressions in Selenium?

A regular expression is a special text string used for describing a search pattern. In Selenium IDE regular expression can be used with the keyword- regexp: as a prefix to the value and patterns needs to be included for the expected values.

What is Object Repository ?

An object repository is an essential entity in any UI automations which allows a tester to store all object that will be used in the scripts in one or more centralized locations rather than scattered all over the test scripts.

Explain what is assertion in Selenium and what are the types of assertion?

Assertion is used as a verification point. It verifies that the state of the application conforms to what is expected. The types of assertion are "assert" , "verify" and "waitFor".

Mention why to choose Python over Java in Selenium?

Few points that favor Python over Java to use with Selenium is, 1. Java programs tend to run slower compared to Python programs. 2. Java uses traditional braces to start and ends blocks, while Python uses indentation. 3. Java employs static typing, while Python is dynamically typed. 4. Python is simpler and more compact compared to Java.

List the advantages of Webdriver over Selenium Server?

If you are using Selenium-WebDriver, you don't need the Selenium Server as it is using totally different technology Selenium Server provides Selenium RC functionality which is used for Selenium 1.0 backwards compatibility Selenium Web driver makes direct calls to browser using each browsers native support for automation, while Selenium RC requires selenium server to inject Javascript into the browser

Why to use TestNG with Selenium RC ?

If you want full automation against different server and client platforms, You need a way to invoke the tests from a command line process, reports that tells you what happened and flexibility in how you create your test suites. TestNG gives that flexibility.

What are core extension ?

If you want to "extend" the defualt functionality provided by Selenium Function Library , you can create a Core Extension. They are also called "User Extension". You can even download ready-made Core Extension created by other Selenium supporter

Mention what is the difference between Implicit wait and Explicit wait?

Implicit Wait: Sets a timeout for all successive Web Element searches. For the specified amount of time it will try looking for element again and again before throwing a NoSuchElementException. It waits for elements to show up. Explicit Wait : It is a one-timer, used for a particular search.

How will you handle working with multiple windows in Selenium ?

We can use the command selectWindow to switch between windows. This command uses the title of Windows to identify which window to switch to.

What is JUnit Annotations and what are different types of annotations which are useful ?

In JAVA a special form of syntactic meta-data can be added to Java source code, this is know as Annotations. Variables, parameters, packages, methods and classes are annotated some of the Junit annotations which can be useful are 1. Test 2. Before 3. After 4. Ignore 5. BeforeClass 6. AfterClass 7. RunWith

In which format does source view shows your script in Selenium IDE ?

In Selenium IDE source view shows your script in XML format

Explain how you can insert a break point in Selenium IDE ?

In Selenium IDE to insert a breakpoint 1. Select "Toggle breakpoint" by right click on the command in Selenium IDE 2. Press "B" on the keyboard and select the command in Selenium IDE 3. Multiple breakpoints can be set in Selenium IDE

In Selenium IDE how you can generate random numbers and dates for test data ?

In Selenium IDE you can generate random numbers by using Java Script type css=input#s javascript{Math.random()} And for type css=input#s javascript{new Date()}

Mention what is Listeners in Selenium WebDriver?

In Selenium WebDriver, Listeners "listen" to the event defined in the selenium script and behave accordingly. It allows customizing TestNG reports or logs. There are two main listeners i.e. WebDriver Listeners and TestNG Listeners

What are the advantages of Selenium?

It supports C#, PHP, Java, Perl, Phython It supports different OS like Windows, Linux and Mac OS It has got powerful methods to locate elements (Xpath, DOM , CSS) It has highly developer community supported by Google

Explain what is the difference between Borland Silk and Selenium?

Silk Test Tool 1. Borland Silk test is not a free testing tool 2. Silk test supports only Internet Explorer and Firefox 3. Silk test uses a test scripting language 4. Silk test can be used for client-server applications Selenium Test Tool 1. Selenium is a completely free test automation tool 2. Selenium supports many browsers like Internet Explorer, Firefox, Safari, Opera, and so on 3. Selenium suite has the flexibility to use many languages like Java, Ruby, Perl, and so on 4. Selenium can be used for only web application

Mention 5 different exceptions you had in Selenium web driver?

The 5 different exceptions you had in Selenium web drivers are 1. WebDriverException 2. NoAlertPresentException 3. NoSuchWindowException 4. NoSuchElementException 5. TimeoutException

Mention what are the advantages of Using Git Hub For Selenium?

The advantages of Using Git Hub for Selenium are 1. Multiple people when they work on the same project they can update project details and inform other team members simultaneously. 2. Jenkins can help you to build the project from the remote repository regularly. This helps you to keep track of failed builds.

How can you prepare customized html report using TestNG in hybrid framework ?

There are three ways Junit: With the help of ANT TestNG: Using inbuilt default.html to get the HTML report. Also XST reports from ANT, Selenium, Testng combinations Using our own customized reports using XSL jar for converting XML content to HTML

Explain how to iterate through options in test script?

To iterate through options in test script you can loop features of the programming language, for example to type different test data in a text box you can use "for" loop in Java // test data collection in an array String[ ] testData = { "test1" , "test2" , "test3" } ; // iterate through each test data For (string s: test data) { selenium.type ( "elementLocator", testData) ; }

Explain how you can switch between frames?

To switch between frames web drivers [ driver.switchTo().frame() ] method takes one of the three possible arguments 1. A number: It selects the number by its (zero-based) index 2. A name or ID: Select a frame by its name or ID 3. Previously found WebElement: Using its previously located WebElement select a frame

Mention why do you need Session Handling while working with Selenium?

While working with Selenium, you need Session Handling. This is because, during test execution, the Selenium WebDriver has to interact with the browser all the time to execute given commands. At the time of execution, it is also possible that, before current execution completes, someone else starts execution of another script, in the same machine and in the same type of browser. So to avoid such situation you need Session Handling.

Can we use Selenium RC to drive tests on two different browsers on one operating system without Selenium Grid?

Yes, it is possible when you are not using JAVA testing framework. Instead of using Java testing framework if you are using java client driver of selenium then TestNG allows you to do this. By using "parallel=test" attribute you can set tests to be executed in parallel and can define two different tests, each using different browser.

Mention in what ways you can customize TestNG report?

You can customize TestNG report in two ways, 1. Using ITestListener Interface 2. Using IReporter Interface

Explain using Webdriver how you can perform double click ?

You can perform double click by using Syntax- Actions act = new Actions (driver); act.doubleClick(webelement);

Other than the default port 4444 how you can run Selenium Server?

You can run Selenium server on java-jar selenium-server.jar-port other than its default port

What is the difference between getWindowhandles() and getwindowhandle() ?

getwindowhandles(): It is used to get the address of all the open browser and its return type is Set<String> getwindowhandle(): It is used to get the address of the current browser where the control is and return type is string


Ensembles d'études connexes

Question (Answer with Yes or No) Send me a screenshot of your getting a 100% then go to BIG QUESTION quizlet

View Set

United States Government Branches (For Business Class)

View Set

Chapter 2: Network Infrastructure and Documentation

View Set