TESTEVERYTHING

Monday 22 September 2014

INSTALL IDEVICEINSTALLER ON MAC MACHINE

ideviceinstaller

ideviceinstaller is a tool to interact with the installation_proxy of an iOS device allowing to install, upgrade, uninstall, archive, restore, and enumerate installed or archived apps.

1     Software Requirement
1. Homebrew
Refer the previous post for installation of homebrew
http://testeverythingqtp.blogspot.in/2014/09/mobile-webapplication-automation.html
1.1 Install HomeBrew 1. Homebrew, “the missing package manager for OS X,” allows you to easily install hundreds of open-source tools. The full instructions are available on the Homebrew Wiki, but you should only need to run the command that’s listed at the bottom of the Homebrew site:
       $ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
2.       Once the installation is successful, run the following command:
$ brew doctor

Install ideviceinstaller

Open the terminal and type following commands
       $ brew uninstall ideviceinstaller     
      $ brew install --HEAD ideviceinstaller

MOBILE WEB/APPLICATION AUTOMATION INSTALLATION GUIDE FOR IOS

1      Software Requirement

1.       Xcode 5.0 + (Mandatory for iOS 7)
2.       rvm
3.       Ruby 2.0.0
4.       Homebrew
5.       Java
6.       Maven
7.       Ant
8.       Cocoapods
Note: In mac machine, you must have admin rights.

1.1            Install Xcode

Download the latest Xcode from apple developer site

1.2            Install RVM

                           1. Open the terminal window on mac

                          $ \curl -sSL https://get.rvm.io | bash -s stable
                         
                           refer the below url for more info
                                http://rvm.io/rvm/install

1.3            Install RUBY

1.   Ruby is installed by default on Mac, just make sure it is using the version 2.0.0, ruby version can be checked using command;
                                          $ ruby -v
2.   To install ruby version 1.9.2 type below command in terminal
                                          $ rvm install 1.9.2

3.   Once the installation has completed, we need to tell RVM which version of Ruby we currently want to use:
       $ rvm use 1.9.2


                         4.    Make 1.9.2 the Default If you restart Terminal, and type ruby -v again, you'll likely find that it has defaulted back to the system version of Ruby: 1.8.7. That's no good! Let's be sure to make 1.9.2 the default.

rvm --default use 1.9.2

1.4            Install HomeBrew

1.        Homebrew, “the missing package manager for OS X,” allows you to easily install hundreds of open-source tools. The full instructions are available on the Homebrew Wiki, but you should only need to run the command that’s listed at the bottom of the Homebrew site:




                              2.       Once the installation is successful, run the following command:

$ brew doctor

1.5            Install Java, Maven & Ant

1.    Download java .dmg file from http://www.java.com/en/download/
2.    Double click .dmg file and install java
3.    Now download maven from http://www.interior-dsgn.com/apache/maven/maven-3/3.2.1/binaries/apache-maven-3.2.1-bin.tar.gz
4.    Extract maven to any directory
5.    Now to set the environment variables, in the terminal type
$ nano ~/.bash_profile
For Java enter;
      export JAVA_HOME= <path to your java directory >
For Maven enter;
      export M2_HOME= <path to your extracted maven directory>
      export M2=$M2_HOME/bin



Once done press ctrl+O and press enter, now press ctrl+x
6.    In the same terminal enter command
$ source ~/.bash_profile
7.    To install Ant use command
 $ brew install ant
8.    To verify the Maven installation, in terminal, issue the command mvn -version.

$ mvn -version

Apache Maven 3.0.3 (r1075438; 2011-03-01 01:31:09+0800)
Maven home: /usr/share/maven
Java version: 1.6.0_33, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.7.4", arch: "x86_64", family: "mac"
9.    To verify java installation, in terminal, issue the command mvn -version.


$ java -version

How to handle login pop up window using Selenium WebDriver?

Hi All,

Some times while using webdriver we have to face login popup handle.  When we passing the url using webdriver.get or webdriver.navigate.to("URL") at this time browser asks for login credentials.
For handle this situation we have to do following things.

1. HTTP Basic Authentication with Selenium WebDriver

the authentication prompt is not available from the Selenium WebDriver. One of the way to handle this limitation is to pass user and password in the url like like below:


         http://username:password@the-site.com
So just to make it more clear. The username is username password is password and the rest is usual URL of your test web

        WebDriver driver = getDriver();
        String URL = "http://" + username + ":" + password + "@" + "link";
        driver.get(URL);
but sometimes it does not work for IE browser
 we can use robot  method


import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.KeyEvent;

import org.openqa.selenium.Alert;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;


public class FillAuthAlert {
 private static final String MY_URL = "https://myurl.com";
 private static final String USERNAME= "myuser";
 private static final String PASSWORD= "mypass";
 
 public static void main(String[] args) throws Exception {

  WebDriver driver = new FirefoxDriver();
  driver.get(MY_URL);
  Alert alert = driver.switchTo().alert();
  Robot robot = new Robot();
  Thread.sleep(1000);
  type(robot, USERNAME);
  robot.keyPress(KeyEvent.VK_TAB);
  robot.keyRelease(KeyEvent.VK_TAB);
  Thread.sleep(1000);
  type(robot, PASSWORD);
  alert.accept();
 }
 
 public static void type(Robot robot, String characters) {
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        StringSelection stringSelection = new StringSelection( characters );
        clipboard.setContents(stringSelection, null);

        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_V);
        robot.keyRelease(KeyEvent.VK_V);
        robot.keyRelease(KeyEvent.VK_CONTROL);
    }
}

Which one is right ?

Translate







Tweet