Wednesday, 10 August 2016

Executing the webdriver script using webdriver 3.0.0-beta2 version

Below steps guides you for executing the java webdriver script with webdriver version '3.0.0-beta2'.

Prerequisite:
- To work with webdriver version '3.0.0-beta2', requires java 1.8 version installed and java path is set to java 1.8.
For installing java 1.8 and path setting, refer link http://automation-home.blogspot.com/2016/08/java-8-installation-and-path-setting.html
- Eclipse IDE is already installed.

Download java webdriver client libraries:
Download java webdriver libraries from http://www.seleniumhq.org/download
  Click 'Download' button for 'java' to download the selenium webdriver java client libraries.
  
Extract the downloaded zip file:
Extract the downloaded 'selenium-java-3.0.0-beta2.zip' file.

 

Open the Eclipse IDE:
Right click on the project and select 'Properties'.

set the path for jar files present in the extracted zip file 'selenium-java-3.0.0-beta2.zip'.

Sample Program:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class WSTest {
    public static void main(String[] args) throws InterruptedException {
        WebDriver driver = new FirefoxDriver();
        // driver.manage().window().maximize();
        driver.get("http://www.google.com");

        Thread.sleep(3000);
        driver.close();
        driver.quit();
    }
}

Execute the script.
        Thread.sleep() is added for demo, in real time projects its not recommended to use Thread.sleep().


'UnsupportedClassVersionError' is occurred while executing the script, 
even after java 1.8 is installed and path setting is done in environment variables.

Verify Eclipse IDE is mapping to Java 1.8.

 If java version is not 1.8, then update java version to 1.8



If eclipse ide is mapping to older version of java, then update it to java 1.8 



Re Execute the script: 
 
Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases
.......
........
will be displayed.

Re-execute the script: 
Re-execute the script after performing below steps


Extract the downloaded 'geckodriver-v0.10.0-win64.zip' file and copy the 'geckodriver.exe' in your webdriver project.

Add below one line code in your webdriver automation script.
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "\\geckodriver.exe");

Sample Program:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class WSTest {
    public static void main(String[] args) throws InterruptedException {
        System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "\\geckodriver.exe");

        WebDriver driver = new FirefoxDriver();
        // driver.manage().window().maximize();
        driver.get("http://www.google.com");

        Thread.sleep(3000);
        driver.close();
        driver.quit();
    }
}

Re-execute the script now. 
You can observe the 'JavaScript warning' in console, but the script is executed successfully.

JavaScript warning: https://normandy.cdn.mozilla.net/static/bundles/selfrepair-72948156b77d6ce320e0.1e946d807ad4.js, line 11001: mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create

Check the Firefox version

Update the Firefox version.

Re-execute the script again, after updating the Firefox version
Observe there is no 'JavaScript warning' in console and script is executed successfully(i.e. launching 
the firefox browser, access url http://www.google.com and close browser). 

By default firefox browser is maximized with out using the statement 'driver.manage().window().maximize();'.

Summary: To work with latest version of webdriver 3.0.0-beta2, it requires.
- Install Java 1.8.
- Open eclipse ide and update the JDK compiler compliance level to java 1.8.
- Download webdriver java(3.0.0-beta2) client libraries and set it in java build path.
- Download the geckodriver.exe and set it System.setProperty using 'webdriver.gecko.driver'.
- Upgrade the Firefox version to latest version.
- By default firefox browser is maximized(i.e no need to use statement driver.manage().window().maximize();)

Java 8 installation and path setting



Install Java 8 from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
 Click 'jdk-8u101-windows-x64.exe' to install java 8 (64 bit) for Windows OS.


Click 'Save File'
Click downloaded 'jdk-8u101-windows-x64.exe' file to install.

Click 'Next' button.

Click 'Next' button.


Click 'Next' button.


Click 'Close' button.

Open the command prompt and type command 'java -version' and
verify java 8 path is set.
Note: In my machine java 7 is already installed and java 7 path is already set.

After executing the command 'java -version', if you can't view the 
java version as 1.8 that means java 8 path is not set.

 You can set the java 8 path in environment path.
Note: Above screenshot is captured from Windows 8 OS.

Click 'Advanced' tab.
Click 'Environment Variables' button.

Update the java path to java 8(if java path is set for older version of java). 
If you are setting the java path for first time, then you can create a new variable 'JAVA_HOME' and
 enter variable value referring the '<<Path of java 8 jdk>>'


Open the command prompt, if command prompt is already opened then close 
the command prompt and open the new command prompt.
After command prompt is opened, execute the command 'java -version'.
If java version 1.8 is displayed, that means java path is set to java 8.

Saturday, 28 May 2016

Negative scenarios for google search page

Access the url: www.google.com

1. Enter negative numbers and click search button.
    ex: '-12'

2. Special Characters
    ex: '#@$'

3. Lengthy Characters
   ex: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


Search by voice:
Prerequisite: Microphone already connected to system.

4. Click mic button and don't speak anything.


5. Blow air in the microphone, when 'Speak now' message is displayed.


Below are some of the negative scenarios, related to other functionalities.

Negative Scenarios for 'Lift':
1. Enter more than the specified person.
2. press stop before the destination.
3. press opposite button from the source. 
   ex: if on ground floor press down button and vice versa.
4. Bring obstacle when lift doors are about to close.
5. Power off when lift moving downwards.
    ex: 5th floor to 4th floor

Negative Scenarios for 'Glass of water':
- Check by filling the water greater than the capacity, it overflows or not ?
- Place the glass inverted and to fill the glass, water splits outside or not  ?

Wednesday, 18 May 2016

Eclipse IDE - Python Interpreter in Eclipse IDE Console

By following the below procedure you can use the 'Python Interpreter' in eclipse console(i.e. we can run the python commands directly in eclipse console).

Prerequisites:

1. Launch Eclipse IDE
    Open 'Windows' --> 'Show View' --> 'Console' to access the console.

2. Console is opened.
    Note: No need of creating any python project, for executing the python commands in Eclipse IDE console.

3. From 'Console' options select 'PyDev Console'.





Now you can see the Python Interpreter in Eclipse IDE console.

Type the commands in console to execute the python commands.

You can even maximize the console for better visibility.

Tuesday, 16 February 2016

wsdlbrowser for online WebServices testing

Access the url http://wsdlbrowser.com/

Enter WSDL url and click on 'Browse' button
ex: wsdl url "http://soaptest.parasoft.com/calculator.wsdl"

Select the WSDL function to perform
ex: 'multiply' function.


Request XML is displayed.


Enter 'x' and 'y' values and click 'Call function' button.


Result XML is displayed with the multiplication of 'x' and 'y' values.


Related Links:
Firefox 'SOA Client' plugin for web services testing
http://automation-home.blogspot.com/2016/02/firefox-soa-client-plugin-for-web-services-testing.html

Chrome browser 'Wizdler' extension to test Web Services.
http://automation-home.blogspot.com/2016/02/chrome-browser-wizdler-extension-to-test-webservices.html