Thursday, 16 July 2015

Upload a File using Selenium WebDriver


  • Find  web element with tag input and type='file'  using below xpath
//input[@type='file']
  • Make it visible in case of style.visibility='hidden' using javascript
    document.getElementById("myImg").style.visibility = "visible"; 
  •  Send keys on above input element with absolute filepath
   driver.findElement(By.xpath("//input[@type='file']")).sendKeys("/absolute/filepath.jpeg");


Leave comments in case of any queries :)






Monday, 27 October 2014

java was started but returned exit code=13 solution

Add
-vm
C:\Program Files\Java\jdk1.7.0_17\bin\javaw.exe
in eclipse.ini

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
-vm
C:\Program Files\Java\jdk1.7.0_17\bin\javaw.exe
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-144807
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-Xms40m
-Xmx512m

Friday, 17 October 2014

Mobile Web Application Automation using Appium on Windows

Required files:


  • Appium from here (http://appium.io/)
  • Appium Java client library from here(https://github.com/appium/java-client)
  • Android SDK from here(http://developer.android.com/sdk/index.html)

Setup Configurations:


  • Set ANDROID_HOME to your android SDK folder.
  • Add % ANDROID_HOME %\tools and % ANDROID_HOME %\platform-tools to your path variable.
  •  Set JAVA_HOME to your JDK folder (parent folder of bin)
  • Add % JAVA_HOME %\bin to your path variable.

Steps to Run Sample Test:


  • Create a new java project in eclipse and add Appium Java client jar.
  • Start android emulator or attach real device.
  • Give device name as browser name in AppiumTest.java.
  • Start Appium server.
  • Run AppiumTest.java. as java application.

AppiumTest.java

download from here 
https://drive.google.com/file/d/0B_O5Qw2k7ap9aDZHajEyVmo2N29qa0J3bmRrYjNCSWppaERR/view?usp=sharing