Thursday, April 14, 2016

How To Create A “Hello World” WatchKit App

WatchKit is officially out!!!! Here is how to get started:

Download XCode 6.2 Beta

Just head over to the XCode Downloads page, and get the latest Beta of XCode!

Create New Project

Got to your new XCode-Beta, and select Create a new Xcode project. As usual, select Single View Application, and go through the process of saving the project as normal:
WatchKit New Application

Create a Watch App Target

Now here comes the fun part! From the XCode menu, select New -> Target:
New Target XCode
Now, go to the Apple Watch Section, and select Watch App:
Watch App Target
Click Next, and de-select the Notification and Glance Scene optionsto make life simpler to start with:
Screen Shot 2014-11-18 at 3.20.26 PM
Click Finish, and you’re almost there!

Add Label

Go to the Interface.storyboard in your Watch App Target:
Storyboard
Now, drag a label onto your Interface Controller, and add the Hello, World! text. Make sure to Center your label!
Label
Yes, that’s right. No AutoLayout here!

Run the App!

This is where things get tricky. Make sure to select the Watch App Target to run. Just choose any iPhone Simulator.
Target
Finally, select the Apple Watch as an External Device from your iOS Simulator Hardware Menu option:
Hardware
Re-run the app, and you’ll see the watch app!
Hello World Watch

Monday, January 4, 2016

Selenium script to login Facebook

In the following post I will go step by step and explain how to write script using Selenium Webdriver for auto facebook login  and execute it .
1. Right click on the src folder ->New -> Package.
2. Provide package name something like com.stm.test and click “Finish”.
3. Right click on the newly created package – > New -> Class.
4. Provide class name as “RegistrationTest” and click Finish.
5. Write the code given below for your first test.

The code for the first test is as follows:

package com.stm.test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.Test;
public class RegistrationTest
{
@Test 
public void testRegister()
{
WebDriver driver = new FirefoxDriver();
driver.get(“http://www.facebook.com/”);
driver.findElement(By.name(“email”)).sendKeys(“User1”);
driver.findElement(By.name(“pass”)).sendKeys(“Surname1”);

driver.findElement(By.Xpath(“//*[@id="u_0_v"]”)).click();
driver.close();
driver.quit();
}
}

6. After finishing the test right click on the test and click on RunAs – >TestNG Test
7. After executing the test select the project and press F5 to refresh the project. A new folder “test-results” will get created which will show you the results for the execution. Right click on index.html->open with->web browser to see the execution report.