Sunday 11 December 2016

Memories from Conference of the year


Another happy day:-) Got the opportunity to meet & chat with the amazing people around the globe. The brilliant minds behind the invention of Selenium, Webdriver & Appium + the most energetic community behind the consistent support of the new features... all these memories, all the way from London & India are here just scroll away
Gallery:
scroll over the pics to view all
Recording of my talk:

Saturday 25 June 2016

Summary from my Talk @Selenium Conference 2016

Slide deck from the talk on various Automation challenges, effective ways to debug & work around to make almost impossible looking problem possible at

Key Points:

1. RSA for  generating dashboard of tests jobs's status and quick links to checkout everything in 1 go 
2. Automating everything on top of open-source tools like Selenium, Appium, jenkins etc.
3. Pain points, debugging root cause & finding work around specially for Mobile App Test Automation

Preview of the Talk:   https://confengine.com/selenium-conf-2016/proposal/2438/can-we-have-it-all-selenium-for-web-mobile-and-everything-what-a-product-needs

 

Slides



Friday 3 April 2015

Example code for running test on Safari browser - Appium/iPhone

This Piece of code tested on -
  • Appium -1.3.4 IOS -6 (8.1)
  •  Mac: Mavericks [10.9.5] 
  • Java -1.7 & 8 
  • TestNg 
  • WebDriver- 2.45
package com.sma8learning.mobile.browser;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import io.appium.java_client.ios.IOSDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;

/**
 A test to demonstrate the automation on Safari browser using Appium [the open source tool]
*/
public class TestGoogleSearch_SafariBrowser {
 WebDriver wd;

 @BeforeTest
 public void beforeTest() throws MalformedURLException { //set capabilities required
  DesiredCapabilities capabilities = new DesiredCapabilities();
  capabilities.setCapability("deviceName", "iPhone 6");
  capabilities.setCapability("platformName", "iOS");
  capabilities.setCapability("platformVersion", "8.1");
  capabilities.setCapability(CapabilityType.BROWSER_NAME, "safari");
  wd = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);//instantiate driver
  wd.manage().timeouts().implicitlyWait( 30,TimeUnit.SECONDS);
 }

 @Test
 public void testSearchPage() throws InterruptedException {
  wd.get("https://www.google.co.in");
  WebElement serachField = wd.findElement(By.name("q"));
  serachField.sendKeys("Pooja Shah Selenium youtube");
  serachField.sendKeys(Keys.ENTER);
  System.out.println(wd.getCurrentUrl());
 }

 @AfterTest
 public void afterTest() {
  //wd.close();
 }
}

Problems with solutions

1. That URL did not map to a valid JSONWP resource
Solution:
the url is wrong, it should be well formed path "http://127.0.0.1:4723/wd/hub"

2.error: Failed to start an Appium session, err was: Error: Could not navigate to webview; there aren't any!
Hack:
set the platformversion capability properly-
ex. capabilities.setCapability("platformVersion", "8.1");

3. “fruitstrap quit unexpectedly” or unable to install SafariLauncher.app 
  Possible solution: it works perfectly on ios simulator on mavericks but running on real device on Yosemite there are issues <br/>
Remember!
with real device you need to separately add a udid in capabilities and SafariLauncher.app and use a proxy called ios-webkit-debug-proxy
group-discussion for details
appium-dicussion for details

4 Could not get the iOS SDK version because the Xcode version could not be determined
it generally happens when appium somehow can't find xcode or you don't have any ios simulator created so if first one is the problem then hit
"xcode-select --switch /Applications/Xcode.app/Contents/Developer" from commandline
or if second is the problem then just create one.
or if all well then shut down appium, simulator and the script &  restart appium  -> script





Note : Now the visual is also available for the same on youtube: 

click on- Automate Safari browser on mobile 


Saturday 16 August 2014

Let's try Mobile Automation Setup [ Appium ]


Can something be more painful than setting up Appium in your specific OS [ Windows, Ubuntu, MAC ]? Agreed! then this blog it for you. Yes, I had been setting it up, couple of times on different OS but surprisingly each time, a new issue appears and sometimes set of issues, sigh!

Hold on! now you don't need to, because this will help you out
So start with basic necessities for all OS [http://appium.io/]

1. Install JAVA (jdk 6 or more)

2. Set java in the class path, its weird but strictly follow this:
For Windows 7: my computer ->right click--> properties--> advanced system settings-->environment variable--> create a new variable under system variable [not user variable], name it 'JAVA_HOME' and give path till java's directory
example: C:\Program Files\Java\jdk1.6.0_27
now open 'path' variable and add @ end of it ';%JAVA_HOME%\bin'
Test it : go to cmd and type 'java' or 'jvm', it should echo some message but not 'command not found'

3. Download android sdk for Android [ will post for IOS soon]
Adt: http://developer.android.com/sdk/index.html 4. Set the adb path in class path,
For Windows : like java, create a new variable under system variable, name it "ANDROID_HOME" and give path till adb
example: D:\Software\Android\android-sdk\
now open 'path' variable and add @ end of it ';%ANDROID_HOME%\platform-tools'
Test it : go to cmd and type 'adb', it should echo some message but not 'command not found'

5. Download Appium
For windows: AppiumForWindows-1.2.0.1.zip from https://bitbucket.org/appium/appium.app/downloads/

For linux: strictly follow this to save your time by not getting into unwanted issues
install via brew, if you don't have one, get homebrew
> brew install node # get node.js
> npm install -g appium # get appium
> npm install wd # get appium client
> appium & # start appium
> node your-appium-test.js

For MAC: download dmg file from https://bitbucket.org/appium/appium.app/downloads/

6. If using eclipse open it and add adt plugin
Top menu--> Help--> install new software --> add with name 'ADT' and site 'http://dl-ssl.google.com/android/eclipse/'
and set the sdk path in eclipse in preferences-->Android [ which we had downloaded ]




7. Create a emulator or connect a device with debugging on [ enable developer options in phone by tapping 7 times on 'model no']
7.1 For emulator: open SDK manager [check the android download icon in this image and install any android version as per need which is more than API level 16, better to communicate with dev team]

7.2 create a respective emulator on click of device icon shown in the image

8. Now your environment is ready
Let's do a smoke test of the system
Command prompt
java -version
appium -v
adb -v
for linux & MAC systems its easy - Appium comes with Appium doctor if you run it, it does the job

9. Windows & MAC :
Open appium, give package name (ask developers)
give IP address: 127.0.0.1 , port : 4723
if want to open inspector without running the test then set App path too

Linux: doesn't have ui version of Appium so run via 'Appium &' with respective run config to set path etc.

10. Now 1 by one
start emulator /plugin device with debug on
start appium server
start your test script, it shall listen & start the test in your emulator/device

Common Issues :

1. Linux:
1.1 brew not command
follow-https://github.com/Homebrew/linuxbrew or https://www.digitalocean.com/community/articles/how-to-install-and-use-linuxbrew-on-a-linux-vps 1.2 adb not recognised error solution: classpath setting is missing, set Android_home to be set in ~./bashrc

2. MAC
adb not recognized
solution: set Android_home in ~./bash_profile

3.Eclipse ERROR: transport error 202: bind failed: Address already in use ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized
Solution: Kill running java process from task manager or from command line

4.While installing apk
if error: Failure [INSTALL_FAILED_ALREADY_EXISTS]
Solution: adb install -r D:\Android\pathTillApk\MyApp.apk

5. [INSTALL_FAILED_UID_CHANGED]:When there is no app installed and while installing it throws error
"A new session could not be created. (Original error: Remote install failed: pkg: [INSTALL_FAILED_UID_CHANGED])", solution: from command line go to adbpath and hit this commands [it removes the existing data and makes enable to reinstall app without any issue]
- adb shell
- rm -rf /data/data/you_apk_pacakge_name 


6. [INSTALL_FAILED_CPU_ABI_INCOMPATIBLE]: 
Solution : check you apk's architecture, if it supports 86 then having an ARM architecture build won't work. So get help from dev and get a build which supports all architectures or at least its the same what your simulator/device requires.


Going to add more issues and solutions in some time, keep reading :-)

Important commands to deal with emulator


  • Create avd -->android create avd -n nameOfEmulatorWannaGive -t 1
  • Start emulator-->emulator -avd nameOfEmulatorWannaGive
  • Check if there is any emulator or device running-> adb devices
  • To deploy/install app : adb install D:\Android\app\nameOfYourApk.apk
  • To Start adb: ./adb start-server [in windows & MAC 'adb is fine but on linux machines './adb' works for executable]
  • To Stop adb: ./adb kill-server


  • Note: This guide can answer many of your problems: http://appium.io/slate/en/master/?ruby#setup

    Sunday 20 July 2014

    QA girl is hungry!!!

    I wanted to eat Salad, I went to McDonald's site and I didn’t find anything relevant on the screen for my need directly, I had to go to FOOD section and viola :-) I can see my ‘Salads’ under submenu
    So, its not a normal action which can be performed directly with any webdriver command we have learnt yet, (when I hover over FOOD, another sub menu opens and then I have to choose Salads )
    so its mouseHover /mouseOver on FOOD -> move to Salads and click on it.
    Ok….... I get it, but how I do I do that!!!
    Its simple : just moveToIt→ action → build it or perform it


    Yeppie!! I can order my favorite salad now
    You must also try cheese sandwich, its so good ;-)


    My Mistake: I Had this script ready for test booking of any eatable from McD. But the day, when I wanted to show it to my colleague it didn't work and put me in embarrassment.

    What did I learn From it:
    Actions class action may not work on every browser version. This test works fine with FF17, FF27 and I didn't disable my browser's auto upgrade an the day I was showing it and it got updated to FF 24 and bang!!! So make sure, you don't upgrade your browser mistakenly which you are using for test automation because with the latest browser the webdriver library may or may not be compatible. --> You can disable auto updation of a browser by un-checking Automating install updates option under browser's tools/preferences-->Advance tab
    Note:With some of the browsers it happens that once mouse hover action is performed, the menu list disappears with in a fraction of second, even before Selenium identifies the next submenu item. In that situation it is better to use ‘perform()’ action on the main menu to hold the menu list till the time Selenium identifies the sub menu item.

    Also, it is suggested to create your own profile and use the same for your selenium tests instead of letting the webdriver to create any profile for you. We will come to Profiling in Selenium in the next blog.
    Hope this post served your purpose, let me know if I can customize it for making it more valuable for your need, please do drop your comments
    Happy Learning :-)

    Saturday 5 July 2014

    About Me!


    Hi,
    I’m a girl next door with passion to enhance the way QA is!
    I’m writing this blog to keep track of my failures, my learning from them and then manifesting the way I did solve them. The motive of doing is… that I might end up saving your time by not repeating the same mistake.
    Soon I will be publishing 999 ways which doesn’t work the way we assume ;-)
    Don't forget to share your bad experiences as well ;-) Happy Learning :-)


    Acknowledgement

    All my blogs heavily stands on top of the shoulders of other blogs, books, articles and real time work. I owe it to lot of people and my sincere thank you to all. Some of them are listed below
    • seleniumhq.org
    • https://github.com/appium/
    • Linkedin selenium group
    • Stack Overflow
    • SUN/Oracle
    • My work place Goibibo + Jenesys
    • seleniumsimplified.com
    • itelearn.com
    • Of course, google ;-)



    Catch me on  View Pooja Shah's profile on LinkedIn

    Like my work!!!
    Thanks for reading! If this piece connected you, I'd really appreciate you sharing it out to your contacts.

    Memories from Conference of the year

    Another happy day:-) Got the opportunity to meet & chat with the amazing people around the globe. The brilliant minds behind the inven...