Showing posts with label selenium. Show all posts
Showing posts with label selenium. Show all posts

Brief Introduction to Selenium-HTML Scripting With IDE

If you don't have selenium IDE, Go here.
Two major features of Selenium IDE are record and play. Selenium starts recording if the red button on the right hand corner is on. Script is divided into three different parts: Command, Target and Value. Selenium has three types of commands; Actions, Accessors and Assertions. Actions are the actions such as click or type. Accessors test the state of the applications and store the results in variables. Assertions are used to compare the actual result with the expected result. They have 'verify' 'assert' and 'waitFor' prefix. During recording user can simply right click and add these assertion for verification purpose or can be added later on.'waitFor' command waits until some condition is true. They do not wait if targeted condition is met but wait for some time if something is in progress.
Common Selenium  commands recorded by IDE are: open, type, click, click.., select, ...AndWait suffix eg clickAndWait, addSelection and etc.

What is the difference between verify and assert? when to use what?
When assert fails, current test script stops running and test in progress jumps to another test script. When verify fails, it logs the error but same script keeps running.  So when to use what is your choice. But you can always borrow some idea from best practice.
If you are verifying many elements is present in a  page, you can 'assert' the title of the page to make sure you are in the right page. If you are in the wrong page, its OK even script stops running right?
Assert is best used for critical part of the application, such as log-in verification. Once you are  logged in with an username you can assert that particular used name is there.
Selenium IDE is widely used to record the script  and export into other programming languages such as Java, C#,  Python and Ruby. You export script to your desired environment/framework such as Junit, TestNG and run your test from there. If you wish to run with TestRunner, you can save your script as a .html file and run it. Please go here to learn more about it.


Selenium Interview Queations-Answers



For more interview question go to new blog - here


What is Selenium?
Selenium is a widely used automation tool for web based testing. It is easy to learn and use.

What is Selenium 2.x?
The NEXT GEN selenium. It is the Selenium Server-Webdriver replacing Selenium RC

What is required?
Basic knowledge of HTML, web based testing and web technologies is required. No other software development language is required. JAVA Script is nice to have.

From where to download?
Go to Selenium’s official site for all the information about it. You can download different version and mirror from its official site. which is -http://seleniumhq.org/

Getting started with selenium.
Selenium is a very good tool for Acceptance and Cross-Browser testing. It is also very useful for Functional testing. About how - Selenium has different components. Lets download selenium IDE’s latest version. Selenium IDE is a Firefox add-on, version 2+. Once it is download, you can record and play scripts in Firefox. I will talk in detail about how to use it in different section. for now lets download IDE, play around it and get familiar with most commonly used selenium commands. Selenium script is convertible in different development languages such and JAVA, C#, Pearl. With the help of Selenium-RC, user can run it different browsers and language environment.

How to use selenium IDE?
 For now please go to http://seleniumhq.org

What is the selenium's recording language?
HTML

What are the steps to run automation using selenium?
The very basic steps are:
1.  Record the test steps using selenium-IDE
2. Modify the script according to the testing needs. Add validation points, Java Scripts, Time-out etc.
3. Run the test
4. View the result after test run complete analyze.

Automation steps using Selenium C# language
1.Record the Test Steps using selenium-IDE. Test will be recorded in HTML language
2. Modify the script
3. Convert the scripts into c# using selenium IDE
4. Open the Visual Studio and create the test project there. Add a c# file
5. Copy your c# script from Seleniun-IDE and paste into c# file you have created earlier. You can modify your script here as well such as adding if-else. This is the advantage of using other language.Call the Reporting file from here to store the result.
6. Compile the code and debug if error occurs.
7. Add the Compiles DLLs in NUNIT
8. Run the test.
9. Analyze the test result.

What is Selenium Test Suite? how to develop it?
Grouping test cases together as test suite is one of the major concept of software testing. In selenium, it is a HTML file that contains links of test cases. Test Runner is a Selenium IDE plug-in to run the test suite.


What is SIDE?
Selenium IDE


How to run test case recorded using Selenium IDE in other browsers?
With the help of Selenium -Remote Control


What are three major parts, components of IDE?
Command, Target, and Value


How do you edit the recorded command in IDE?
By selecting them and choosing the desired value from drop-down.

What is the command to run selenium server from command prompt?
Open the command prompt, CD to the folder (CD Command) having selenium server and run    command : java -jar selenium-server.jar

What is the Selenium server default port number?
 4444

How to run Selenium server, other than the default port 4444?
 java -jar selenium-server.jar -port