Featured Post Today
print this page
Latest Post

using siblings in xpath, selenium ,webdriver

using siblings in xpath  to get the child / parent elements of the current element , can be used in relative xpath

xpath description
ancestor get all parent elements of current node
ancestor-or-self get all parent elements of current node and it self also
attribute get all attributes of the current node
child get all child elements of current node
descendant get all child elements and its child elements(grandchild) of current node
descendant-or-self get all child elements and its child elements(grandchild) of current node and it self
following get all elements in the html after this node
following-sibling get all siblings of the current node
parent get the parent of the current node

Example : the below code will get all the links in "Google" after searching for selenium in google.

List lst=driver.findElements(By.xpath("//*[@class='srg']/child::*"));
for(WebElement x : lst)


List lst=driver.findElements(By.xpath("//*[@class='srg']/descendant::h3"));
for(WebElement x : lst)



difference jxl and poi excel

Difference between JXL and POI

1. jxl supports for Microsoft Excel
    it supports for office 97-2003 (xls) format
    supports either read / write only one at a time

2. POI --Apache
      HSSF (Horrible SpreadSheet Format) – reads and writes Microsoft Excel (XLS) format files.
      XSSF (XML SpreadSheet Format) – reads and writes Office Open XML (XLSX) format file
      supports both read and write at a time in excel file
      supports for xlsx formats(office 97 and also for 2007)

webdriver, window size, dimension

The below code will get the current size (height, width ) of the window (browser) , if we need to change the size , we can use the Demension class and set the width and height.

FirefoxDriver driver=new FirefoxDriver();

Dimension d=driver.manage().window().getSize();
System.out.println("initial height :"+d.height);
System.out.println("initial width :"+d.width);

driver.manage().window().setSize(new Dimension(800,600));

xpath, selenium, starts-with, contains, text

In xpath we can use functions, when we are familiar with the details of element.
The element details we can find in the inspector tools like firebug..etc


1. suppose there is an element in the html like
then in xpath
         here . refer to the text in the element

2. suppose there is an element in the html like
software testing help for sample

to recognize the above element, in xpath

3. for the same above example we can also use
       driver.findElement(By.xpath("//div[contains(@id,'testing') or contains(@name,'sample')]"));

TestNG, Junit Difference, Advantage of TestNG over Junit Framework, Selenium Framework

Advantage of TestNG over JUnit Framework--Selenium

. TestNG has default index.html results report created and we can also customise the report using listeners
. TestNG has more annotations like @BeforeTest,@AfterTest, @BeforeSuite, @AfterSuite,@BeforeGroup,@AfterGroup...etc

. TestNG has DataProvider annotation to specify the testdata and parameterize
. TestNG has a features to configure dependency tests.
. TestNG has annotations for creating Groups for methods
. TestNG has .xml file to integrate multiple tests and run also parameterise the browser  to run the script
. TestNG the methods can be set priority

Difference btween QTP and Selenium

sno HP UFT (QTP)                           Selenium Better
1 Licensed Tool (costly) Open Source Tool ( no cost) Selenium
2 Supports for Desktop(windows) based (like java, .net, SAP, Oracle ERP…etc) and Web based applications only for web based applications QTP
3 easy to develop the scripts as it provides built in objects, methods..etc little complex to integrate third party tools and write programming from scratch QTP
4 scripts are developed only in QTP Window scripts are developed in different  IDEs like Visual Studio, Eclipse, Netbeans Selenium
5 Scripts are developed only using VBScript Scripts are developed using JAVA, C#,  Ruby, Perl, Phython,Groovy..etc Selenium
6 provides object repository so that it is easy to add objects and store the properties to recognize objects there is no object repository, all properties are written in the code only QTP
7 Tool can be integrated with HP QC for test management and defect reporting There are no tools to integrate QTP
8 Very good support as we buy the license Has to depend on forums, groups for help QTP
9 very good help documents to learn and explore no good help provided by the tool with examples and should explore from diff sources QTP
10 dedicated system needed to run the scripts, cannot interrup in middle the system used to run the script, we can perform other work and scripts are running in background Selenium
11 supports mainly for IE browser and also supports for firefox and chrome supports for all the browsers IE, FireFox, Chrome, Safari, Opera Selenium
12 supports only on windows OS supports on windows, Linux, Mac OS Selenium



1. How  do you  run QTP Scripts from QC

2. How do you Export Test Cases from Ms-Excel to Quality Center

3. What is the meaning of Fuzz Testing

4. What is Story board Testing

5. What is the meaning of defect Triaze, defect density,defect clustering
Support :
Copyright © 2013. Software QA Testing - All Rights Reserved