Tuesday, February 14, 2017

How to set default SIM selection for dual SIM Android Phone


 Now most of the android smartphones comes with Dual SIM support, We can set the default SIM selection according to our preference for Call and Message in the settings. To do that follow the steps.

Steps 1. Go to the phone settings.
Step 2. Tap SIM Card settings.


Step 3. In the new page tap on Message or Call settings

Step 4. In the Popup 3 options will be available, always use SIM 1, Always use SIM 2 and Ask every time,


Set your preference accordingly, if choose 1st option, each time when you send message or make a call, it will ask you which SIM card to be used. Do the same steps for Call settings also.


Wednesday, December 31, 2014

Introduction to Selenium IDE

Brief Introduction Selenium IDE
Selenium IDE is the simplest of the tools in the Selenium suite, and the quickest way to get started with creating scripts; however it only supports record and playback within Firefox. For automating other browsers you’ll need to use one of the more advanced Selenium tools, such as Selenium RC or Selenium 2 (or Selenium Grid if you want to run your tests in parallel), but let’s not get ahead of ourselves! 


Selenium Integrated Development Environment (IDE) is the simplest framework in the Selenium suite and is the easiest one to learn. It is a Firefox plugin that you can install as easily as you can with other plugins. However, because of its simplicity, Selenium IDE should only be used as a prototyping tool. If you want to create more advanced test cases, you will need to use either Selenium RC or WebDriver.


First, let’s install Selenium IDE, which is really just an add-on for Firefox.


The Selenium-IDE (Integrated Development Environment) is an easy-to-use Firefox plug-in to develop Selenium test cases. It provides a Graphical User Interface for recording user actions using Firefox which is used to learn and use Selenium, but it can only be used with Firefox browser as other browsers are not supported.
However, the recorded scripts can be converted into various programming languages supported by Selenium and the scripts can be executed on other browsers as well.
The following table lists the sections that we are going to cover in this chapter.
TitleDescription
This section deals with how to download and configure Selenium IDE.
This section deals with the features available in Selenium IDE.
This section deals with how to create IDE tests using recording feature.
This section deals with debugging the Selenium IDE script.
This section describes how to insert verification points in Selenium IDE.
This section deals with how to work with regular expressions using IDE.
The Java script that allows users to customize or add new functionality.
This section deals with how to execute Selenium IDE scripts on different browsers.

Selenium IDE - Different Browser

Selenium scripts can run tests only against Firefox as the tool IDE itself is a plugin of Firefox. Tests developed using Selenium IDE can be executed against other browsers by saving it as Selenium WebDriver or Selenium Remote Control Script.
Step 1 : Open any saved Test in Selenium IDE.
Step 2 : Navigate to "File" menu and select "Export Test Suite As" and the options would be listed.
Selenium IDE 28
Step 3 : Now let us export the script to "WebDriver" and save it with a name.
Step 4 : The saved WebDriver file is displayed as shown below.
Selenium IDE 29

Selenium - User Extensions

It is easy to extend Selenium IDE by adding customized actions, assertions, and locator-strategies. It is done with the help of JavaScript by adding methods to the Selenium object prototype. On startup, Selenium will automatically look through the methods on these prototypes, using name patterns to recognize which ones are actions, assertions, and locators.
Let us add a 'while' Loop in Selenium IDE with the help of JavaScript.
Step 1 : To add the js file, first navigate to https://github.com/darrenderidder/sideflow/blob/master/sideflow.js and copy the script and place save it as 'sideflow.js' in your local folder as shown below.
Selenium IDE 24
Step 2 : Now launch 'Selenium IDE' and navigate to "Options" >> "Options" as shown below.
Selenium IDE 25
Step 3 : Click the 'Browse' button under 'Selenium Core Extensions' area and point to the js file that we have saved in Step 1.
Selenium IDE 26
Step 4 : Restart Selenium IDE.
Step 5 : Now you will have access to a few more commands such as "Label", "While" etc.
Step 6 : Now we will be able to create a While loop within Selenium IDE and it will execute as shown below.
Selenium IDE 27


Selenium - IDE Pattern Matching

Like locators, patterns are a type of parameter frequently used by Selenium. It allows users to describe patterns with the help of special characters. Many a time, the text that we would like to verify are dynamic; in that case, pattern matching is very useful.
Pattern matching is used with all the verification point commands - verifyTextPresent, verifyTitle, verifyAlert, assertConfirmation, verifyText, and verifyPrompt.
There are three ways to define a pattern:
  • globbing
  • regular expressions, and
  • exact patterns.

Globbing

Most techies who have used file matching patterns in Linux or Windows while searching for a certain file type like *.doc or *.jpg. would be familiar with term "globbing"
Globbing in Selenium supports only three special characters: *, ?, and [ ].
  • * - matches any number of characters.
  • ? - matches a single character.
  • [ ] - called a character class, lets you match any single character found within the brackets. [0-9] matches any digit.
To specify a glob in a Selenium command, prefix the pattern with the keyword 'glob:'. For example, if you would like to search for the texts "tax year 2013" or "tax year 2014", then you can use the golb "tax year *" as shown below.
However the usage of "glob:" is optional while specifying a text pattern because globbing patterns are the default in Selenium.
CommandTargetValue
clickAndWaitlink=search
verifyTextPresentglob: tax year *

Exact Patterns

Patterns with the prefix 'exact:' will match the given text as it is. Let us say, the user wants an exact match with the value string, i.e., without the glob operator doing its work, one can use the 'exact' pattern as shown below. In this example the operator '*' will work as a normal character rather than a pattern-matching wildcard character.
CommandTargetValue
clickAndWaitlink=search
verifyValueexact: *.doc

Regular Expressions

Regular expressions are the most useful among the pattern matching techniques available. Selenium supports the complete set of regular expression patterns that Javascript supports. Hence the users are no longer limited by *, ? and [] globbing patterns.
To use RegEx patterns, we need to prefix with either "regexp:" or "regexpi:". The prefix "regexpi" is case-insensitive. The glob: and the exact: patterns are the subsets of the Regular Expression patterns. Everything that is done with glob: or exact: can be accomplished with the help of RegExp.

Example

For example, the following will test if an input field with the id 'name' contains the string 'tax year', 'Tax Year', or 'tax Year'.
CommandTargetValue
clickAndWaitlink=search
verifyValueid=nameregexp:[Tt]ax ([Yy]ear)

Selenium - IDE Verification Points

The test cases that we develop also need to check the properties of a web page. It requires assert and verify commands. There are two ways to insert verification points into the script.
To insert a verification point in recording mode, "Right click" on the element and choose "Show all Available Commands" as shown below.
selenium ide 21
We can also insert a command by performing a "Right-Click" and choosing "Insert New Command".
selenium ide 22
After inserting a new command, click 'Command' dropdown and select appropriate verification point from the available list of commands as shown below.
selenium ide 23
Given below are the mostly used verification commands that help us check if a particular step has passed or failed.
  • verifyElementPresent
  • assertElementPresent
  • verifyElementNotPresent
  • assertElementNotPresent
  • verifyText
  • assertText
  • verifyAttribute
  • assertAttribute
  • verifyChecked
  • assertChecked
  • verifyAlert
  • assertAlert
  • verifyTitle
  • assertTitle

Synchronization Points

During script execution, the application might respond based on server load, hence it is required for the application and script to be in sync. Given below are few a commands that we can use to ensure that the script and application are in sync.
  • waitForAlertNotPresent
  • waitForAlertPresent
  • waitForElementPresent
  • waitForElementNotPresent
  • waitForTextPresent
  • waitForTextNotPresent
  • waitForPageToLoad
  • waitForFrameToLoad

Selenium - IDE Debugging

Debugging is the process of finding and fixing errors in the test script. It is a common step in any script development. To make the process more robust, we can make use a plugin "Power Debugger" for Selenium IDE.
Step 1 : To install Power Debugger for Selenium IDE, navigate to https://addons.mozilla.org/en-US/firefox/addon/power-debugger-selenium-ide/ and click "Add to Firefox" as shown below.
Selenium IDE 16
Step 2 : Now launch 'Selenium IDE' and you will notice a new icon, "Pause on Fail" on recording toolbar as shown below. Click it to turn it ON. Upon clicking again, it would be turned "OFF".
Selenium IDE 17
Step 3 : Users can turn "pause on fail" on or off any time even when the test is running.
Step 4 : Once the test case pauses due to a failed step, you can use the resume/step buttons to continue the test execution. The execution will NOT be paused if the failure is on the last command of any test case.
Step 5 : We can also use breakpoints to understand what exactly happens during the step. To insert a breakpoint on a particular step, "Right Click" and select "Toggle Breakpoint" from the context-sensitive menu.
Selenium IDE 18
Step 6 : Upon inserting the breakpoint, the particular step is displayed with a pause icon as shown below.
Selenium IDE 19
Step 7 : When we execute the script, the script execution is paused where the breakpoint is inserted. This will help the user to evaluate the value/presence of an element when the execution is in progress.
Selenium IDE 20