<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-4640108202668346727</atom:id><lastBuildDate>Fri, 10 Apr 2026 04:41:04 +0000</lastBuildDate><category>Selenium RC</category><category>Selenium IDE</category><category>Selenium</category><category>CSS and Selenium</category><category>xpath</category><category>Regular Expression in selenium</category><category>Selenium and AutoIT</category><category>TestNG and Selenium</category><category>WebDriver</category><category>Selenium and Junit</category><title>Automation testing</title><description></description><link>http://automationtricks.blogspot.com/</link><managingEditor>noreply@blogger.com (Niraj Kumar)</managingEditor><generator>Blogger</generator><openSearch:totalResults>47</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-4288509354861210566</guid><pubDate>Tue, 10 Feb 2015 07:27:00 +0000</pubDate><atom:updated>2015-02-09T23:27:59.321-08:00</atom:updated><title>what is Implicit, Explicit &amp; Fluent Wait in Selenium Web driver and their difference.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;background-color: rgba(255, 255, 255, 0.541176); box-sizing: border-box; clear: both; color: #373a41; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 27px; font-stretch: normal; font-weight: 300; line-height: 32px; margin: 0px 0px 10px; padding: 0px; text-shadow: none;&quot;&gt;
Implicit Wait&lt;/h2&gt;
&lt;div style=&quot;background-color: rgba(255, 255, 255, 0.541176); box-sizing: border-box; color: #38393a; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 10px; padding: 0px;&quot;&gt;
By using Implicit wait we can tell Selenium that we would like it to wait for a certain amount of time before throwing an&amp;nbsp;&lt;span style=&quot;box-sizing: border-box; font-weight: 700; margin: 0px; padding: 0px;&quot;&gt;exception&lt;/span&gt;&amp;nbsp;that it cannot find the element on the page. We should note that implicit waits will be in place for the entire time the browser is open. This means that any search for elements on the page could take the time the implicit wait is set for.&lt;/div&gt;
&lt;br /&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&lt;b&gt;
 WebDriver driver = new FirefoxDriver();
 driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
 driver.get(&quot;http://www.ebay.in/cat/mobiles/brand/Samsung&quot;);
 WebElement myDynamicElement = driver.findElement(By.id(&quot;myDynamicElement&quot;));&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;&lt;b&gt;
&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;/pre&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;&lt;h2 style=&quot;background-color: rgba(255, 255, 255, 0.541176); box-sizing: border-box; clear: both; color: #373a41; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 27px; font-stretch: normal; font-weight: 300; line-height: 32px; margin: 0px 0px 10px; padding: 0px; text-shadow: none; white-space: normal;&quot;&gt;
Explicit Wait&lt;/h2&gt;
&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.541176); color: #38393a; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 22px; white-space: normal;&quot;&gt;It is more extendible in the means that you can set it up to wait for any condition you might like. Usually, you can use some of the prebuilt&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.541176); box-sizing: border-box; color: #38393a; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 14px; font-weight: 700; line-height: 22px; margin: 0px; padding: 0px; white-space: normal;&quot;&gt;ExpectedConditions&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.541176); color: #38393a; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 22px; white-space: normal;&quot;&gt;&amp;nbsp;to wait for elements to become clickable, visible, invisible, etc.&lt;/span&gt;
&lt;h2 style=&quot;background-color: rgba(255, 255, 255, 0.541176); box-sizing: border-box; clear: both; color: #373a41; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 27px; font-stretch: normal; font-weight: 300; line-height: 32px; margin: 0px 0px 10px; padding: 0px; text-shadow: none; white-space: normal;&quot;&gt;
&lt;pre style=&quot;background-color: white; font-family: &#39;Courier New&#39;; font-size: 12pt;&quot;&gt;driver.manage().timeouts().implicitlyWait(&lt;span style=&quot;color: blue;&quot;&gt;0&lt;/span&gt;, TimeUnit.&lt;span style=&quot;color: #660e7a; font-style: italic;&quot;&gt;SECONDS&lt;/span&gt;); &lt;span style=&quot;color: grey; font-style: italic;&quot;&gt;//nullify implicitlyWait()&lt;/span&gt;&lt;span style=&quot;color: grey; font-style: italic;&quot;&gt;
&lt;/span&gt;WebDriverWait wait = &lt;span style=&quot;color: navy;&quot;&gt;new &lt;/span&gt;WebDriverWait(driver, timeOutInSeconds);
element = wait.until(ExpectedConditions.&lt;span style=&quot;font-style: italic;&quot;&gt;visibilityOfElementLocated&lt;/span&gt;(by));&lt;/pre&gt;
&lt;/h2&gt;
&lt;/code&gt;&lt;h2 style=&quot;background-color: rgba(255, 255, 255, 0.541176); box-sizing: border-box; clear: both; color: #373a41; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 27px; font-stretch: normal; font-weight: 300; line-height: 32px; margin: 0px 0px 10px; padding: 0px; text-shadow: none; white-space: normal;&quot;&gt;
&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.541176); color: #373a41; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 27px; font-weight: 300; line-height: 32px; white-space: normal;&quot;&gt;Fluent Wait&lt;/span&gt;&lt;/h2&gt;
&lt;h2 style=&quot;background-color: rgba(255, 255, 255, 0.541176); box-sizing: border-box; clear: both; color: #373a41; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 27px; font-stretch: normal; font-weight: 300; line-height: 32px; margin: 0px 0px 10px; padding: 0px; text-shadow: none; white-space: normal;&quot;&gt;
&lt;div style=&quot;background-color: rgba(255, 255, 255, 0.541176); box-sizing: border-box; color: #38393a; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 14px; font-weight: normal; line-height: 22px; margin-bottom: 10px; padding: 0px; white-space: normal;&quot;&gt;
&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.541176); color: #38393a; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 14px; font-weight: normal; line-height: 22px; white-space: normal;&quot;&gt;Each&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.541176); box-sizing: border-box; color: #38393a; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 22px; margin: 0px; padding: 0px; white-space: normal;&quot;&gt;FluentWait&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.541176); color: #38393a; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 14px; font-weight: normal; line-height: 22px; white-space: normal;&quot;&gt;&amp;nbsp;instance defines the maximum amount of time to wait for a condition, as well as the frequency with which to check the condition. Furthermore, the user may configure the wait to ignore specific types of exceptions whilst waiting, such as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.541176); box-sizing: border-box; color: #38393a; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 22px; margin: 0px; padding: 0px; white-space: normal;&quot;&gt;NoSuchElementExceptions&lt;/span&gt;&lt;span style=&quot;background-color: rgba(255, 255, 255, 0.541176); color: #38393a; font-family: &#39;Open Sans&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 14px; font-weight: normal; line-height: 22px; white-space: normal;&quot;&gt;&amp;nbsp;when searching for an element on the page.&lt;/span&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;/h2&gt;
&lt;code&gt;&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;&lt;b&gt;FluentWait  wait = new FluentWait(driver).withTimeout(timeOutInSeconds,TimeUnit.SECONDS).pollingEvery(200,TimeUnit.MILLISECONDS)
.ignoring(NoSuchElementException.class);
        element = (WebElement) wait.until(ExpectedConditions.visibilityOfElementLocated(by));&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;b&gt;
package PageFactory;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.FluentWait;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.util.NoSuchElementException;
import java.util.concurrent.TimeUnit;

/**
 * Created by Niraj on 2/10/2015.
 */
public class ConceptPage {
    WebDriver driver;
    @FindBy(xpath=&quot;//input[@type=&#39;submit&#39; and @title=&#39;See more&#39;]&quot;)
    WebElement btnSeeMore;
    @FindBy(xpath=&quot;//div[@class=&#39;itm&#39;][21]//div[@class=&#39;itemttl&#39;]&quot;)
    WebElement thelement;
    public static final int DEFAULT_WAIT_4_PAGE = 12;
    public static final int DEFAULT_WAIT_4_ELEMENT = 15;
    public ConceptPage(WebDriver driver){
        this.driver=driver;
        PageFactory.initElements(driver,this);
    }

    public void  verify21stElement(){
        WebElement webElement = &lt;span style=&quot;color: lime;&quot;&gt;waitforElementUsingFluent&lt;/span&gt;(driver, By.xpath(&quot;//div[@class=&#39;itm&#39;][21]//div[@class=&#39;itemttl&#39;]//a&quot;), 20);&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;&lt;b&gt; public void  verify21stElement(){
        WebElement webElement = &lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;waitForElement&lt;/span&gt;&lt;/b&gt;&lt;b&gt;
&lt;/b&gt;&lt;/code&gt;&lt;b&gt;(driver, By.xpath(&quot;//div[@class=&#39;itm&#39;][21]//div[@class=&#39;itemttl&#39;]//a&quot;), 20);&lt;/b&gt;&lt;/pre&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;&lt;b&gt;
&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;b&gt;
        System.out.println(&quot;Element present : &quot;+ webElement.getAttribute(&quot;href&quot;));
    }&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;&lt;b&gt;
&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;&lt;b&gt;
&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;&lt;b&gt;//Explicit wait function definition here...:&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;&lt;b&gt;
    public static WebElement &lt;span style=&quot;color: red;&quot;&gt;waitForElement&lt;/span&gt;(WebDriver driver, final By by, int timeOutInSeconds) {
        WebElement element;
        try{
            //To use WebDriverWait(), we would have to nullify implicitlyWait().
            //Because implicitlyWait time also set &quot;driver.findElement()&quot; wait time.
            //info from: https://groups.google.com/forum/?fromgroups=#!topic/selenium-users/6VO_7IXylgY
            driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS); //nullify implicitlyWait()

            WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds);
            element = wait.until(ExpectedConditions.visibilityOfElementLocated(by));

            driver.manage().timeouts().implicitlyWait(DEFAULT_WAIT_4_ELEMENT, TimeUnit.SECONDS); //reset implicitlyWait
            return element; //return the element
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
   &amp;nbsp;&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;&lt;b&gt;//Fluent wait function definition goes here...&amp;nbsp;&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;&lt;b&gt;
    public static WebElement &lt;span style=&quot;color: lime;&quot;&gt;waitforElementUsingFluent&lt;/span&gt;(WebDriver driver, By by, int timeOutInSeconds){
        
        WebElement element;
       FluentWait  wait = new FluentWait(driver).withTimeout(timeOutInSeconds,TimeUnit.SECONDS).pollingEvery(200,TimeUnit.MILLISECONDS).ignoring(NoSuchElementException.class);
        element = (WebElement) wait.until(ExpectedConditions.visibilityOfElementLocated(by));
        return element;


    }

public void clickOnSeeMore(){
    btnSeeMore.click();
}
}

&lt;/b&gt;
&lt;/code&gt;// Main test goes here...&lt;/pre&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: navy; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;package &lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;Selenium;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: navy; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;import &lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;PageFactory.ConceptPage;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: navy; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;import &lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;PageFactory.HomePage;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: navy; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;import &lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;org.openqa.selenium.WebDriver;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: navy; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;import &lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;org.openqa.selenium.firefox.FirefoxDriver;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: navy; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;import &lt;/span&gt;&lt;span style=&quot;color: olive; font-family: &#39;Courier New&#39;; font-size: 12pt;&quot;&gt;org.testng.annotations.BeforeTest&lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: navy; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;import &lt;/span&gt;&lt;span style=&quot;color: olive; font-family: &#39;Courier New&#39;; font-size: 12pt;&quot;&gt;org.testng.annotations.Test&lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: navy; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;import &lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;java.util.concurrent.TimeUnit;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;; font-size: 12pt; font-style: italic;&quot;&gt;/**&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;; font-size: 12pt; font-style: italic;&quot;&gt; * Created by Niraj on 2/5/2015.&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: &#39;Courier New&#39;; font-size: 12pt; font-style: italic;&quot;&gt; */&lt;/span&gt;&lt;span style=&quot;color: navy; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;public class &lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;LoginWithPageFactory {
    WebDriver &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #660e7a; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;driver&lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;;
    LoginPage &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #660e7a; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;loginPage&lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;;
    HomePage &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #660e7a; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;homePage&lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;;
    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: olive; font-family: &#39;Courier New&#39;; font-size: 12pt;&quot;&gt;@BeforeTest&lt;/span&gt;&lt;span style=&quot;color: olive; font-family: &#39;Courier New&#39;; font-size: 12pt;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: navy; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;public void &lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;setup(){
        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #660e7a; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;driver &lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;= &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: navy; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;new &lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;FirefoxDriver();
        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #660e7a; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;driver&lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;.manage().timeouts().implicitlyWait(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;; font-size: 12pt;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;, TimeUnit.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #660e7a; font-family: &#39;Courier New&#39;; font-size: 12pt; font-style: italic; font-weight: bold;&quot;&gt;SECONDS&lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;);
        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #660e7a; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;driver&lt;/span&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;.get(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; font-size: 16px;&quot;&gt;&lt;span style=&quot;color: green; font-family: Courier New;&quot;&gt;&lt;b&gt;http://www.ebay.in/cat/mobiles/brand/Samsung&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: &#39;Courier New&#39;; font-size: 12pt; font-weight: bold;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 12pt;&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; font-family: &#39;Courier New&#39;; font-size: 12pt;&quot;&gt;
    }
    &lt;span style=&quot;color: grey; font-style: italic;&quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: grey; font-style: italic;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: olive;&quot;&gt;@Test&lt;/span&gt;(priority = &lt;span style=&quot;color: blue;&quot;&gt;1&lt;/span&gt;)
    &lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;public void &lt;/span&gt;test_AJAX(){
        &lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;driver&lt;/span&gt;.get(&lt;span style=&quot;color: green; font-weight: bold;&quot;&gt;&quot;http://www.ebay.in/cat/mobiles/brand/Samsung&quot;&lt;/span&gt;);
        ConceptPage conceptPage = &lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;new &lt;/span&gt;ConceptPage(&lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;driver&lt;/span&gt;);
        conceptPage.clickOnSeeMore();
        conceptPage.verify21stElement();&lt;/pre&gt;
&lt;pre style=&quot;background-color: white; font-family: &#39;Courier New&#39;; font-size: 12pt;&quot;&gt;

    }
    &lt;span style=&quot;color: navy; font-weight: bold;&quot;&gt;public void &lt;/span&gt;teardown(){
        &lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;driver&lt;/span&gt;.close();
        &lt;span style=&quot;color: #660e7a; font-weight: bold;&quot;&gt;driver&lt;/span&gt;.quit();;

    }
}&lt;/pre&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;&lt;/div&gt;
</description><link>http://automationtricks.blogspot.com/2015/02/what-is-implicit-explicit-fluent-wait.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>211</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-5778705091158747649</guid><pubDate>Sun, 06 Jul 2014 16:07:00 +0000</pubDate><atom:updated>2014-07-06T09:57:50.314-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">CSS and Selenium</category><category domain="http://www.blogger.com/atom/ns#">xpath</category><title>How to use preceding-sibling and following-sibling in xpath to find sibling nodes</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;How to use preceding-sibling and following-sibling in xpath to find sibling nodes&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6Ej5zgIp1erzW5MEqDVPrFaTfuyrt6sLgqf6wU0F5POx0E00JXO4Mu1jmx0Wxc_jRHeQwhk-4vQhGick4FFj12EIF8KJPOKrzn1Xn2RpzQJIG0JDjugTkamCBIeUZNqLQPTkLj95Mh28/s1600/temp.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6Ej5zgIp1erzW5MEqDVPrFaTfuyrt6sLgqf6wU0F5POx0E00JXO4Mu1jmx0Wxc_jRHeQwhk-4vQhGick4FFj12EIF8KJPOKrzn1Xn2RpzQJIG0JDjugTkamCBIeUZNqLQPTkLj95Mh28/s1600/temp.png&quot; height=&quot;130&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;How to get all the preceding siblings of Apple&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b style=&quot;color: #0080ff; font-family: Consolas, &#39;Lucida Console&#39;, monospace; font-size: 12px; white-space: pre-wrap;&quot;&gt;Xpath:&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;background-color: white; color: #0080ff; font-family: Consolas, &#39;Lucida Console&#39;, monospace; font-size: 12px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&quot;//ul/li[contains(text(),&#39;Apple Mobiles&#39;)]/preceding-sibling::li&quot;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
This will give &quot;Samsung Mobiles&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;How to get all the following &amp;nbsp;siblings of Apple&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #0080ff; font-family: Consolas, &#39;Lucida Console&#39;, monospace; font-size: 12px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;Xpath:  &quot;//ul/li[contains(text(),&#39;Apple Mobiles&#39;)]/following-sibling::li&quot;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
This will give all the preceding siblings ( Nokia Mobiles, HTC Mobiles, Sony Mobiles, Micromax mobiles)&lt;br /&gt;
&lt;br /&gt;
There is trick to use preceding-sibling and following-sibling. Place matters when you use this at beginning it will give you reverse result&lt;br /&gt;
When you use preceding-sibling at beginning then it will give result &amp;nbsp;( Nokia Mobiles, HTC Mobiles, Sony Mobiles, Micromax mobiles) instead of Samsung mobiles.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #0080ff; font-family: Consolas, &#39;Lucida Console&#39;, monospace; font-size: 12px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;Xpath : &quot;//li[preceding-sibling::li=&#39;Apple Mobiles&#39;]&quot; &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #0080ff; font-family: Consolas, &#39;Lucida Console&#39;, monospace; font-size: 12px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
This will give Samsung mobiles.&lt;br /&gt;
when you use following-sibling at the beginning then it will give reverse result. Instead of giving all below nodes of Apple mobile this will give Samsung Mobiles.&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #0080ff; font-family: Consolas, &#39;Lucida Console&#39;, monospace; font-size: 12px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;Xpath:  &quot;//li[following-sibling::li=&#39;Apple Mobiles&#39;]&quot;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
Now the question is how to get all the nodes between Apple Mobiles and Sony Mobiles.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #0080ff; font-family: Consolas, &#39;Lucida Console&#39;, monospace; font-size: 12px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;Xpath :  &quot;//ul/li[preceding-sibling::li=&#39;Apple Mobiles&#39; and following-sibling::li=&#39;Sony Mobiles&#39;]&quot;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
This will return Nokia Mobiles and HTC Mobiles.&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #0080ff; font-family: Consolas, &#39;Lucida Console&#39;, monospace; font-size: 12px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;Xpath : &quot;//ul/li[preceding-sibling::li[.=&#39;Apple Mobiles&#39;] and following-sibling::li[.=&#39;Sony Mobiles&#39;]]&quot;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
Or You can use this in contains as well&lt;br /&gt;
&lt;b style=&quot;color: #0080ff; font-family: Consolas, &#39;Lucida Console&#39;, monospace; font-size: 12px; white-space: pre-wrap;&quot;&gt;Xpath:  &quot;//ul/li[preceding-sibling::li[contains(text(),&#39;Apple Mobiles&#39;)] and following-sibling::li[contains(text(),&#39;Sony Mobiles&#39;)]]&quot;&lt;/b&gt;&lt;/div&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;&lt;/div&gt;
</description><link>http://automationtricks.blogspot.com/2014/07/how-to-use-preceding-sibling-and.html</link><author>noreply@blogger.com (Niraj Kumar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6Ej5zgIp1erzW5MEqDVPrFaTfuyrt6sLgqf6wU0F5POx0E00JXO4Mu1jmx0Wxc_jRHeQwhk-4vQhGick4FFj12EIF8KJPOKrzn1Xn2RpzQJIG0JDjugTkamCBIeUZNqLQPTkLj95Mh28/s72-c/temp.png" height="72" width="72"/><thr:total>82</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-165555650243901968</guid><pubDate>Sun, 06 Jul 2014 13:43:00 +0000</pubDate><atom:updated>2014-07-06T09:58:56.130-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">xpath</category><title>How to find a sibling of a node</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;How to find a sibling of a node&lt;/b&gt;&lt;/div&gt;
There are many situation when we get difficulties to find the elements which do not have identification/attribute but their immediate siblings has some identification.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee; color: red; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 15px; line-height: 14.86400032043457px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcMq4Ma0NjQ1ofRNvVXw8ed1Z2BwmMnTWUbpIcY1xAaKhWueSj3Dcab0QBMr-FcxWWoWJgP8LzJisfdvzb-kLlBIfnGBHGIMTU95IG7M-1qx6rndbcBsMaAAwr7IJCA1UdhyphenhyphencEfdtCYFY/s1600/temp.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcMq4Ma0NjQ1ofRNvVXw8ed1Z2BwmMnTWUbpIcY1xAaKhWueSj3Dcab0QBMr-FcxWWoWJgP8LzJisfdvzb-kLlBIfnGBHGIMTU95IG7M-1qx6rndbcBsMaAAwr7IJCA1UdhyphenhyphencEfdtCYFY/s1600/temp.png&quot; height=&quot;81&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: #eeeeee; color: red; font-family: Consolas, &#39;Andale Mono&#39;, Monaco, Courier, &#39;Courier New&#39;, Verdana, sans-serif; font-size: 15px; line-height: 14.86400032043457px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
In above example if we want to get the text of H1 we can not use //h1 because there are more than one h1 on the page. If you see a and h1 both are siblings and children of div//[@class=&#39;title pad_btm15&#39;]&lt;br /&gt;
By using a sibling element&#39;s property we can find out his sibling. In above example we know id of a which is &quot;mainContent&quot; then we can get its sibling&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;u&gt;Xpath:&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #0080ff; font-family: Consolas, &#39;Lucida Console&#39;, monospace; font-size: 12px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; color: #0080ff; font-family: Consolas, &#39;Lucida Console&#39;, monospace; font-size: 12px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&quot;//a[@id=&#39;mainContent&#39;]/following-sibling::h1&quot;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you have more siblings with no attribute or no unique attribute like below.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMIjbXjPIfJQdGOcJu9d10qmZGVeCOBqqbAXfdc8ugGnVL9Hdpli3dzsk72V_fgoD0qJEQxzFOLjIHgcJuit34CrMEBaWS6hWy0UX4uQ06GqNYQ923NJNpqbeRbFUnYo3VQCHSDHIe7xY/s1600/temp.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMIjbXjPIfJQdGOcJu9d10qmZGVeCOBqqbAXfdc8ugGnVL9Hdpli3dzsk72V_fgoD0qJEQxzFOLjIHgcJuit34CrMEBaWS6hWy0UX4uQ06GqNYQ923NJNpqbeRbFUnYo3VQCHSDHIe7xY/s1600/temp.png&quot; height=&quot;136&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
then we can use the position us find out exact element using xpath:&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;u&gt;Xpath:&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
Samsung Android Mobile&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #0080ff; font-family: Consolas, &#39;Lucida Console&#39;, monospace; font-size: 12px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&quot;//a[@id=&#39;mainContent&#39;]/following-sibling::h1[1]&quot;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Nokia Android Mobile :&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #0080ff; font-family: Consolas, &#39;Lucida Console&#39;, monospace; font-size: 12px; white-space: pre-wrap;&quot;&gt;&lt;b&gt;&quot;//a[@id=&#39;mainContent&#39;]/following-sibling::h1[2]&quot;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
</description><link>http://automationtricks.blogspot.com/2014/07/how-to-find-sibling-of-parent-node.html</link><author>noreply@blogger.com (Niraj Kumar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcMq4Ma0NjQ1ofRNvVXw8ed1Z2BwmMnTWUbpIcY1xAaKhWueSj3Dcab0QBMr-FcxWWoWJgP8LzJisfdvzb-kLlBIfnGBHGIMTU95IG7M-1qx6rndbcBsMaAAwr7IJCA1UdhyphenhyphencEfdtCYFY/s72-c/temp.png" height="72" width="72"/><thr:total>29</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-8184163339959889238</guid><pubDate>Sun, 06 Jul 2014 09:07:00 +0000</pubDate><atom:updated>2014-07-06T02:23:16.160-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">CSS and Selenium</category><category domain="http://www.blogger.com/atom/ns#">xpath</category><title>Which is the best way to locate an element?</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
We choose the method based on which gives the element in fastest way in all the browsers. Finding elements by ID is usually going to be the fastest option, because at its root, it eventually calls down to document.getElementById(), which is optimized by many browsers.&lt;br /&gt;
Finding elements by XPath is useful for finding elements using very complex selectors, and is the most flexible selection strategy, but it has the potential to be very slow, particularly in IE. In IE 6, 7, or 8, finding by XPath can be an order of magnitude slower than doing the same in Firefox. IE provides no native XPath-over-HTML solution, so the project must use a JavaScript XPath implementation, and the JavaScript engine in legacy versions of IE really is that much slower.&lt;br /&gt;
If you have a need to find an element using a complex selector, I usually recommend using CSS Selectors, if possible. It&#39;s not quite as flexible as XPath, but will cover many of the same cases, without exhibiting the extreme performance penalty on IE that XPath can.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://automationtricks.blogspot.com/2014/07/which-is-best-way-to-locate-element.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>107</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-348680757843674857</guid><pubDate>Sun, 06 Jul 2014 08:31:00 +0000</pubDate><atom:updated>2014-07-06T02:25:11.229-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">xpath</category><title>How to use / and // in xpath</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;How to use / and // in xpath&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;Difference between / and // &lt;/b&gt;&amp;nbsp;&lt;/div&gt;
&lt;b&gt;/&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
When / is used at the beginning of a path:&lt;br /&gt;
&lt;br /&gt;
/div&lt;br /&gt;
it will define an absolute path to node &quot;a&quot; relative to the root. In this case, it will only find &quot;a&quot; nodes at the root of the XML tree.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;//&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
When // is used at the beginning of a path:&lt;br /&gt;
&lt;br /&gt;
//div&lt;br /&gt;
&lt;br /&gt;
It will define a path to node &quot;div&quot; anywhere within the XML document. In this case, it will find &quot;div&quot; nodes located at any depth within the XML tree.&lt;br /&gt;
&lt;br /&gt;
These XPath expressions can also be used in the middle of an XPath value to define ancestor-descendant relationships. When / is used in the middle of a path:&lt;br /&gt;
&lt;br /&gt;
/div/a&lt;br /&gt;
&lt;br /&gt;
Tt will define a path to node &quot;a&quot; that is a direct descendant (ie. a child) of node &quot;div&quot;.&lt;br /&gt;
&lt;br /&gt;
When // used in the middle of a path:&lt;br /&gt;
&lt;br /&gt;
/div//a&lt;br /&gt;
&lt;br /&gt;
It will define a path to node &quot;a&quot; that is any descendant (child node) &amp;nbsp;of node &quot;div&quot;.&lt;br /&gt;
&lt;br /&gt;
When we don&#39;t know the immediate parent of a child then we can use &quot;.&quot; dot&lt;br /&gt;
&lt;br /&gt;
will still find any node, &quot;div&quot;, located anywhere within the XML tree. But, the XPath:&lt;br /&gt;
&lt;br /&gt;
.//div&lt;br /&gt;
&lt;br /&gt;
will find any node, &quot;div&quot;, that is a descendant of the node . &quot; In other words, preceding the &quot;//&quot; expression with a &quot;.&quot; tells the XML search engine to execute the search relative to the current node reference.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;</description><link>http://automationtricks.blogspot.com/2014/07/how-to-use-and-in-xpath.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>13</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-399341452768816854</guid><pubDate>Sun, 06 Jul 2014 06:32:00 +0000</pubDate><atom:updated>2014-07-05T23:33:54.646-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Selenium RC</category><category domain="http://www.blogger.com/atom/ns#">WebDriver</category><title>Difference between Selenium RC and Selenium Web Driver</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;background: white; border-collapse: collapse; margin-left: 38.25pt; mso-padding-alt: 0in 0in 0in 0in; mso-yfti-tbllook: 1184;&quot;&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  &lt;td style=&quot;border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 219.0pt;&quot; valign=&quot;top&quot; width=&quot;292&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Selenium
  RC&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-left: none; border: solid windowtext 1.0pt; mso-border-left-alt: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 221.55pt;&quot; valign=&quot;top&quot; width=&quot;295&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Selenium
  Web driver&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 219.0pt;&quot; valign=&quot;top&quot; width=&quot;292&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;It is easy and small API&lt;/span&gt;.
  These API’s are less Object oriented&lt;br /&gt;
&lt;!--[if !supportLineBreakNewLine]--&gt;&lt;br /&gt;
&lt;!--[endif]--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 221.55pt;&quot; valign=&quot;top&quot; width=&quot;295&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;As compared to RC, it
  is bit complex and large API.&lt;/span&gt; API’s are entirely Object oriented&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 219.0pt;&quot; valign=&quot;top&quot; width=&quot;292&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Selenium RC is slower
  since it uses a JavaScript program called Selenium Core.&amp;nbsp;This Selenium
  Core is the one that directly controls the browser, not you.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 221.55pt;&quot; valign=&quot;top&quot; width=&quot;295&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Web Driver is faster
  than Selenium RC since it&amp;nbsp;speaks directly to the browser uses the
  browser’s own engine to control it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 219.0pt;&quot; valign=&quot;top&quot; width=&quot;292&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Selenium Core, just
  like other JavaScript codes,&amp;nbsp;can access disabled elements.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 221.55pt;&quot; valign=&quot;top&quot; width=&quot;295&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Web Driver interacts
  with page elements in a more realistic way. It interacts natively with
  browser application&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 219.0pt;&quot; valign=&quot;top&quot; width=&quot;292&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Required to start
  server before executing the test script.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 221.55pt;&quot; valign=&quot;top&quot; width=&quot;295&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Doesn’t required to
  start server before executing the test script.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 219.0pt;&quot; valign=&quot;top&quot; width=&quot;292&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;It is standalone java
  program which allow you to run Html test suites.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 221.55pt;&quot; valign=&quot;top&quot; width=&quot;295&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;It actual core API
  which has binding in a range of languages.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 219.0pt;&quot; valign=&quot;top&quot; width=&quot;292&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Selenium RC cannot
  support the headless HtmlUnit browser.&amp;nbsp;It needs a real, visible browser
  to operate on.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 221.55pt;&quot; valign=&quot;top&quot; width=&quot;295&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Web Driver can support
  the headless HtmlUnit browser.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 219.0pt;&quot; valign=&quot;top&quot; width=&quot;292&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;It doesn’t supports of
  moving mouse cursors.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 221.55pt;&quot; valign=&quot;top&quot; width=&quot;295&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;It supports of moving
  mouse cursors.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 219.0pt;&quot; valign=&quot;top&quot; width=&quot;292&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Selenium RC Has
  Built-In Test Result Generator. Selenium RC automatically generates an HTML
  file of test results.&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 221.55pt;&quot; valign=&quot;top&quot; width=&quot;295&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Web Driver has no
  built-in command that automatically generates a Test Results File.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 219.0pt;&quot; valign=&quot;top&quot; width=&quot;292&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;It does not supports
  listeners&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 221.55pt;&quot; valign=&quot;top&quot; width=&quot;295&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;It supports the
  implementation of listeners&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 219.0pt;&quot; valign=&quot;top&quot; width=&quot;292&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Selenium RC needs the
  help of the RC Server in order to do so.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 221.55pt;&quot; valign=&quot;top&quot; width=&quot;295&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;web Driver directly
  talks to the browser&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 219.0pt;&quot; valign=&quot;top&quot; width=&quot;292&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;It does not support to
  test iphone/Android applications&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 221.55pt;&quot; valign=&quot;top&quot; width=&quot;295&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;It support to test
  iphone/Android applications&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 219.0pt;&quot; valign=&quot;top&quot; width=&quot;292&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Selenium RC can support
  new browsers&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 221.55pt;&quot; valign=&quot;top&quot; width=&quot;295&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;span style=&quot;color: #444444; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;It&amp;nbsp;cannot readily
  support new browsers&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-top: none; border: solid windowtext 1.0pt; mso-border-top-alt: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt; width: 219.0pt;&quot; valign=&quot;top&quot; width=&quot;292&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0in 5.4pt 0in 5.4pt; width: 221.55pt;&quot; valign=&quot;top&quot; width=&quot;295&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 12.75pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;&lt;/div&gt;
</description><link>http://automationtricks.blogspot.com/2014/07/difference-between-selenium-rc-and.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>26</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-4075328673415556760</guid><pubDate>Tue, 13 Sep 2011 06:42:00 +0000</pubDate><atom:updated>2011-09-13T03:32:55.833-07:00</atom:updated><title>How to select value in drop down using Webdriver</title><description>How to select values in drop down using Webdriver&lt;br /&gt;
&lt;br /&gt;
This post will take you through the way you can select the value in a drop down. Webdriver does not have straight forward command &quot;SELECT&quot; which Selenium does.&lt;br /&gt;
In below example i will open home page of eBay India and search ipod in Consumer Electronic category. This page has a category drop down in which i will select &lt;br /&gt;
Consumer Electronics. &lt;br /&gt;
&lt;br /&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&lt;b&gt;
package com.web;
import java.io.File;
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;


public class DropDownSelection {
 private static WebDriver driver=null;
 @BeforeTest
 @org.testng.annotations.Parameters({&quot;BROWSER&quot;})
 public void setup(String BROWSER){
  if(BROWSER.equals(&quot;FF&quot;)){
   File profileDir = new File(&quot;C:\\nir&quot;);
     FirefoxProfile profile = new FirefoxProfile(profileDir);
     profile.setPreference(&quot;general.useragent.override&quot;, &quot;same user agent string as above&quot;);
     driver= new FirefoxDriver(profile);
   System.out.println(&quot;Broser Selected &quot; + BROWSER);  
  }else if(BROWSER.equals(&quot;IE&quot;)){
   System.out.println(&quot;Broser Selected &quot; + BROWSER);
   driver = new InternetExplorerDriver();
  }else if(BROWSER.equals(&quot;HU&quot;)){
   System.out.println(&quot;Broser Selected &quot; + BROWSER);
   driver =new HtmlUnitDriver();
   
  } else
  {
   System.out.println(&quot;Broser Selected &quot; + BROWSER);
   driver = new ChromeDriver();
  }

 }
 @Test
 public void testDropDownSelection() throws InterruptedException{
  
  driver.get(&quot;http://www.ebay.in&quot;);
  WebElement search = driver.findElement(By.name(&quot;_nkw&quot;));
  search.sendKeys(&quot;ipod&quot;);

   List&lt;webelement&gt; dd = driver.findElement(By.name(&quot;_sacat&quot;)).findElements(By.tagName(&quot;option&quot;));
   for (WebElement option : dd) {
    System.out.println(option.getText());
    if (&quot;Consumer Electronics&quot;.equalsIgnoreCase(option.getText())){
     option.click();
     break;
    }
   }
   driver.findElement(By.xpath(&quot;//input[@value=&#39;Search&#39;]&quot;)).submit();
   Thread.sleep(5000);
   driver.getPageSource().contains(&quot;results found&quot;);
  driver.quit();
 }

}

&lt;/b&gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
TestNG.xml &lt;br /&gt;
Using TestNG suite we will run the test case.&lt;br /&gt;
&lt;br /&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&lt;b&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;suite name=&quot;webDriver&quot; parallel=&quot;tests&quot;&amp;gt;
 &amp;lt;listeners&amp;gt;
  &amp;lt;listener class-name=&quot;org.uncommons.reportng.HTMLReporter&quot; /&amp;gt;
  &amp;lt;listener class-name=&quot;org.uncommons.reportng.JUnitXMLReporter&quot; /&amp;gt;
 &amp;lt;/listeners&amp;gt;
 &amp;lt;test name=&quot;WebDriverDemo Witn FF&quot; preserve-order=&quot;true&quot;&amp;gt;
  &amp;lt;parameter name=&quot;BROWSER&quot; value=&quot;FF&quot; /&amp;gt;
  &amp;lt;classes&amp;gt;
   &amp;lt;class name=&quot;com.web.DropDownSelection&quot; /&amp;gt;
  &amp;lt;/classes&amp;gt;
  &amp;lt;/test&amp;gt;

  &amp;lt;/b&amp;gt;
&amp;lt;/suite&amp;gt;
&lt;/b&gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
If above code does not work with you configuration just try another way given below.&lt;br /&gt;
&lt;br /&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&lt;b&gt;
 List &lt;WebElement&gt; options = driver.findElements(By.tagName(&quot;option&quot;));
  for (WebElement option : options) {
   if (&quot;Consumer Electronics&quot;.equalsIgnoreCase(option.getText())){
    option.click();
   }
      }
&lt;/b&gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;</description><link>http://automationtricks.blogspot.com/2011/09/how-to-select-value-in-drop-down-using.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>232</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-704409883313692157</guid><pubDate>Thu, 28 Jul 2011 13:30:00 +0000</pubDate><atom:updated>2011-07-29T00:20:23.405-07:00</atom:updated><title>Running test case in multiple browsers parallely in WebDriver</title><description>we can run test script in different browsers parallely using web driver. Write one test script and configure in testng xml to run that test case in IE, firefox and chrome parallely.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&lt;b&gt;

package com.web;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

public class ParallelRunning {

 private  WebDriver driver=null;
 @BeforeTest
 @Parameters ({&quot;BROWSER&quot;})
 public void setup(String BROWSER){
  System.out.println(&quot;Browser: &quot; + BROWSER);

  if (BROWSER.equals(&quot;FF&quot;)) {
   System.out.println(&quot;FF is selected&quot;);
   driver = new FirefoxDriver();
  } else if (BROWSER.equals(&quot;IE&quot;)) {
   System.out.println(&quot;IE is selected&quot;);
   driver = new InternetExplorerDriver();
  } else if (BROWSER.equals(&quot;HU&quot;)) {
   System.out.println(&quot;HU is selected&quot;);
   driver = new HtmlUnitDriver();
  } else if (BROWSER.equals(&quot;CH&quot;)){
   System.out.println(&quot;Google chrome is selected&quot;);
   driver = new ChromeDriver();
  }
 }
 
 @Test
 public  void testParallel()throws Exception{

  driver.get(&quot;http://www.google.com&quot;);
  Thread.sleep(5000);
  WebElement search = driver.findElement(By.name(&quot;q&quot;));
  search.sendKeys(&quot;automation blog by niraj&quot;);
  search.submit();
  Thread.sleep(5000);
  Assert.assertTrue(driver.getPageSource().contains(&quot;automationtricks.blogspot.com&quot;));
  driver.findElement(By.xpath(&quot;//a[contains(@href,&#39;automationtricks.blogspot.com&#39;)]&quot;)).click();
  Thread.sleep(15000);
  Assert.assertTrue(driver.getPageSource().contains(&quot;working as Associate Manager @CSC&quot;));
  driver.quit();

 }
}

&lt;/b&gt;
&lt;/code&gt;
&lt;/pre&gt;In the above sample program BROWSER is a variable which value would be passed from TestNG.xml and TestNG.xml will run the test multiple time each time BROWSER value would be set with different browser name and test will check the BROWSER value and decide which browser test will run.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
TestNG.xml&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&lt;b&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;suite name=&quot;webDriver&quot; parallel=&quot;tests&quot;&amp;gt;
  &amp;lt;test name=&quot;WebDriverDemo Witn FF&quot; preserve-order=&quot;true&quot;&amp;gt;
  &amp;lt;parameter name=&quot;BROWSER&quot; value=&quot;FF&quot; /&amp;gt;
  &amp;lt;classes&amp;gt;
   &amp;lt;class name=&quot;com.web.ParallelRunning&quot; /&amp;gt;
  &amp;lt;/classes&amp;gt;
 &amp;lt;/test&amp;gt;
  &amp;lt;test name=&quot;WebDriverDemo with IE&quot; preserve-order=&quot;ture&quot;&amp;gt;
  &amp;lt;parameter name=&quot;BROWSER&quot; value=&quot;IE&quot;&amp;gt;&amp;lt;/parameter&amp;gt;
  &amp;lt;classes&amp;gt;
   &amp;lt;class name=&quot;com.web.ParallelRunning&quot;&amp;gt;&amp;lt;/class&amp;gt;
  &amp;lt;/classes&amp;gt;
 &amp;lt;/test&amp;gt;
 
 &amp;lt;test name=&quot;WebDriverDemo with HTML unit&quot; preserve-order=&quot;true&quot;&amp;gt;
  &amp;lt;parameter name=&quot;BROWSER&quot; value=&quot;HU&quot;&amp;gt;&amp;lt;/parameter&amp;gt;
  &amp;lt;classes&amp;gt;
   &amp;lt;class name=&quot;com.web.ParallelRunning&quot;&amp;gt;&amp;lt;/class&amp;gt;
  &amp;lt;/classes&amp;gt;
 &amp;lt;/test&amp;gt;
 
  &amp;lt;test name=&quot;WebDriverDemo with HTML unit&quot; preserve-order=&quot;true&quot;&amp;gt;
  &amp;lt;parameter name=&quot;BROWSER&quot; value=&quot;CH&quot;&amp;gt;&amp;lt;/parameter&amp;gt;
  &amp;lt;classes&amp;gt;
   &amp;lt;class name=&quot;com.web.ParallelRunning&quot;&amp;gt;&amp;lt;/class&amp;gt;
  &amp;lt;/classes&amp;gt;
 &amp;lt;/test&amp;gt;
&amp;lt;/suite&amp;gt;


&lt;/b&gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;</description><link>http://automationtricks.blogspot.com/2011/07/running-test-case-in-multiple-browsers.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>12</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-4054424339691363077</guid><pubDate>Wed, 27 Jul 2011 14:32:00 +0000</pubDate><atom:updated>2011-07-27T07:34:09.218-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">WebDriver</category><title>Runing test script in multiple browsers using WebDriver</title><description>we can run test script in different browsers using web driver. Write one test script and configure in testng xml to run that test case in IE, firefox chrome.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&lt;b&gt;

package com.web;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.Assert;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
public class WebDriverDemo {
 

 private static WebDriver driver = null;
 
 @Test
 @Parameters( {&quot;BROWSER&quot;}) 
 public  void testread(String BROWSER)throws Exception{

  System.out.println(&quot;Browser: &quot; + BROWSER);

  if (BROWSER.equals(&quot;FF&quot;)) {
   System.out.println(&quot;FF is selected&quot;);
   driver = new FirefoxDriver();
  } else if (BROWSER.equals(&quot;IE&quot;)) {
   System.out.println(&quot;IE is selected&quot;);
   driver = new InternetExplorerDriver();
  } else if (BROWSER.equals(&quot;HU&quot;)) {
   System.out.println(&quot;HU is selected&quot;);
   driver = new HtmlUnitDriver();
  } else if (BROWSER.equals(&quot;CH&quot;)){
   System.out.println(&quot;Google chrome is selected&quot;);
   driver = new ChromeDriver();
  }
  driver.navigate().to(&quot;http://www.yahoo.com&quot;);
  Thread.sleep(10000);
  
  WebElement search= driver.findElement(By.name(&quot;p&quot;));
  search.sendKeys(&quot;automation blog by niraj&quot;);
  search.submit();
  
  Thread.sleep(5000);
  Assert.assertTrue(driver.getPageSource().contains(&quot;automationtricks.blogspot.com&quot;),&quot;Failed in &quot;+ BROWSER);
  driver.close();

 }
}
&lt;/b&gt;
&lt;/code&gt;
&lt;/pre&gt;In the above sample program BROWSER is a variable which value would be passed from TestNG.xml and TestNG.xml will run the test multiple time each time BROWSER value would be set with different browser name and test will check the BROWSER value and decide which browser test will run.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
TestNG.xml&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&lt;b&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;suite name=&quot;webDriver&quot;&amp;gt;
 &amp;lt;test name=&quot;WebDriverDemo Witn FF&quot; preserve-order=&quot;true&quot;&amp;gt;
  &amp;lt;parameter name=&quot;BROWSER&quot; value=&quot;FF&quot; /&amp;gt;
  &amp;lt;classes&amp;gt;
   &amp;lt;class name=&quot;com.web.WebDriverDemo&quot; /&amp;gt;
  &amp;lt;/classes&amp;gt;
 &amp;lt;/test&amp;gt;
  &amp;lt;test name=&quot;WebDriverDemo with IE&quot; preserve-order=&quot;ture&quot;&amp;gt;
  &amp;lt;parameter name=&quot;BROWSER&quot; value=&quot;IE&quot;&amp;gt;&amp;lt;/parameter&amp;gt;
  &amp;lt;classes&amp;gt;
   &amp;lt;class name=&quot;com.web.WebDriverDemo&quot;&amp;gt;&amp;lt;/class&amp;gt;
  &amp;lt;/classes&amp;gt;
 &amp;lt;/test&amp;gt;
 &amp;lt;test name=&quot;WebDriverDemo with HTML unit&quot; preserve-order=&quot;true&quot;&amp;gt;
  &amp;lt;parameter name=&quot;BROWSER&quot; value=&quot;HU&quot;&amp;gt;&amp;lt;/parameter&amp;gt;
  &amp;lt;classes&amp;gt;
   &amp;lt;class name=&quot;com.web.WebDriverDemo&quot;&amp;gt;&amp;lt;/class&amp;gt;
  &amp;lt;/classes&amp;gt;
 &amp;lt;/test&amp;gt;
 &amp;lt;test name=&quot;WebDriverDemo with chrome&quot; preserve-order=&quot;true&quot;&amp;gt;
  &amp;lt;parameter name=&quot;BROWSER&quot; value=&quot;CH&quot;&amp;gt;&amp;lt;/parameter&amp;gt;
  &amp;lt;classes&amp;gt;
   &amp;lt;class name=&quot;com.web.WebDriverDemo&quot;&amp;gt;&amp;lt;/class&amp;gt;
  &amp;lt;/classes&amp;gt;
 &amp;lt;/test&amp;gt;
&amp;lt;/suite&amp;gt;

&lt;/b&gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;</description><link>http://automationtricks.blogspot.com/2011/07/runing-test-script-in-multiple-browsers.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>19</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-7575071507732744589</guid><pubDate>Fri, 22 Jul 2011 10:31:00 +0000</pubDate><atom:updated>2011-07-22T04:33:33.351-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">WebDriver</category><title>Easy Way To Automate Using WebDriver</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;WebDriver is a clean, fast framework for Automation development of web-apps. WebDriver takes many advantages over selenium because selenium is written in java-script which causes a significant weakness: browsers impose a pretty strictly model , try to upload a file ,form control etc.&lt;br /&gt;
webDriver takes a different approach to solve the same problem as selenium. Rather than being running a java-script application within a browser, it uses whichever the mechanism is most appropriate to control the browser. Like for Firefox ,this means that webDriver is implemented as an extension.&lt;br /&gt;
&lt;div closure_uid_1tdi0g=&quot;130&quot;&gt;The real beauty which I like most is real time environment, which means we are more closely modeling how the user interacts with the browser, and that we can type into &quot;file&quot; input elements. WebDriver can make use of facilities offered by the Operating System.&lt;/div&gt;With the benefit of hindsight, we have developed a cleaner, Object-based API for WebDriver, rather than follow Selenium&#39;s dictionary-based approach.&lt;br /&gt;
&lt;br /&gt;
Please download the respective jar related to your language from google code selenium project &lt;a href=&quot;http://code.google.com/p/selenium/downloads/list&quot;&gt;Download&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
Now follow below steps:-&lt;br /&gt;
1:- Extract the download file into a folder name and include the jars file ion your ClassPath&lt;br /&gt;
2:- Sample coding in java&lt;br /&gt;
&lt;br /&gt;
&lt;pre closure_uid_d3im8e=&quot;123&quot; style=&quot;background-color: #eeeeee; border-bottom: rgb(153,153,153) 1px dashed; border-left: rgb(153,153,153) 1px dashed; border-right: rgb(153,153,153) 1px dashed; border-top: rgb(153,153,153) 1px dashed; color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&lt;b&gt;

&lt;div closure_uid_1tdi0g=&quot;154&quot;&gt;import junit.framework.TestCase;&lt;/div&gt;&lt;div closure_uid_1tdi0g=&quot;155&quot;&gt;import org.junit.Test;&lt;/div&gt;&lt;div closure_uid_1tdi0g=&quot;155&quot;&gt;import org.openqa.selenium.By;&lt;/div&gt;&lt;div closure_uid_1tdi0g=&quot;156&quot;&gt;import org.openqa.selenium.WebDriver;&lt;/div&gt;import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver; 
public class WebDriverTest extends TestCase{ 

&lt;div closure_uid_1tdi0g=&quot;151&quot;&gt;@Test&lt;/div&gt;&lt;div closure_uid_1tdi0g=&quot;149&quot;&gt;public void test_hellotest()throws Exception{&lt;/div&gt;
&lt;div closure_uid_1tdi0g=&quot;148&quot;&gt;WebDriver driver = new FirefoxDriver();&lt;/div&gt;
&lt;div closure_uid_1tdi0g=&quot;147&quot;&gt;// And now use this to visit Google&lt;/div&gt;
&lt;div closure_uid_1tdi0g=&quot;146&quot;&gt;driver.get(&lt;a href=&quot;http://www.google.com/webhp?complete=1&amp;amp;hl=en&quot;&gt;http://www.google.com/webhp?complete=1&amp;amp;hl=en&lt;/a&gt;);&lt;/div&gt;// Find the text input element by its name

WebElement element = driver.findElement(By.name(&quot;q&quot;));

&lt;div closure_uid_1tdi0g=&quot;134&quot;&gt;// Enter something to search for&lt;/div&gt;&lt;div closure_uid_1tdi0g=&quot;136&quot;&gt;element.sendKeys(&quot;Niraj Kumar&quot;);&lt;/div&gt;
&lt;div closure_uid_1tdi0g=&quot;137&quot;&gt;// Now submit the form. WebDriver will find the form for us from the element&lt;/div&gt;&lt;div closure_uid_1tdi0g=&quot;139&quot;&gt;element.submit();&lt;/div&gt;&lt;div closure_uid_1tdi0g=&quot;140&quot;&gt;// Check the title of the page&lt;/div&gt;
&lt;div closure_uid_1tdi0g=&quot;141&quot;&gt;System.out.println(&quot;Page title is: &quot; + driver.getTitle()); &lt;/div&gt;&lt;div closure_uid_1tdi0g=&quot;142&quot;&gt;
&lt;/div&gt;&lt;div closure_uid_1tdi0g=&quot;143&quot;&gt;driver.close(); &lt;/div&gt;
&lt;div closure_uid_1tdi0g=&quot;144&quot;&gt;}&lt;/div&gt;
}
&lt;/b&gt;

&lt;/code&gt;
&lt;/pre&gt;&lt;/div&gt;</description><link>http://automationtricks.blogspot.com/2011/07/hudson.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>13</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-8171442632635075349</guid><pubDate>Fri, 03 Dec 2010 09:30:00 +0000</pubDate><atom:updated>2011-07-22T04:33:18.858-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Selenium RC</category><title>How to automate onblur through selenium RC .</title><description>How to automate onblur through selenium RC .&lt;br /&gt;
How to automate lost focus through selenium.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I faced the problem while automating the form submit. All of the form fields are having some action on their lost focus. &lt;br /&gt;
The onblur event occurs when an object loses focus. &lt;br /&gt;
For example : I have two fields First Name and Last Name. When i enter first name and press tab then it loses its focus and onblur function gets called.&lt;br /&gt;
and its calls upperCase and it changes the first name in Upper case.&lt;br /&gt;
the same case with Last Name. When i enter last name and press tab it calls blur function lowerCase and changes the letters in lower case.&lt;br /&gt;
&lt;br /&gt;
But the problem in automation is i cant automate lost focus. when we type in first name and last name it simply types in first name and last name text box.&lt;br /&gt;
It does not call onblur function upper case and lower case and does not change the letter respectively.&lt;br /&gt;
&lt;br /&gt;
so, &lt;b&gt;fireEvent&lt;/b&gt; is a special command in selenium which helps in automating onblur function.&lt;br /&gt;
&lt;br /&gt;
this is html of the element and blur javascript functions &lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
&lt;b&gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
function upperCase()
{
var x=document.getElementById(&quot;fname&quot;).value;
document.getElementById(&quot;fname&quot;).value=x.toUpperCase();
}
function lowerCase()
{
var x=document.getElementById(&quot;lname&quot;).value;
document.getElementById(&quot;lname&quot;).value=x.toLowerCase();
}
&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
Enter your First Name: &amp;lt;input type=&quot;text&quot; id=&quot;fname&quot; onblur=&quot;upperCase()&quot; /&amp;gt;
&amp;lt;br /&amp;gt;
Enter your Last Nast: &amp;lt;input type=&quot;text&quot; id=&quot;lname&quot; onblur=&quot;lowerCase()&quot; /&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/b&gt;

&lt;/code&gt;
&lt;/pre&gt;when we write simple selenium RC code &lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;&lt;b&gt;
 selenium.type(&quot;fname&quot;, &quot;niraj&quot;);
 selenium.type(&quot;lname&quot;, &quot;KUMAR&quot;);&lt;/b&gt;
&lt;/code&gt; 
&lt;/pre&gt;it doest call blur functions to change cases of the first name and last name.&lt;br /&gt;
&lt;br /&gt;
But by using fireEvent fuction of selenium we can call blur function. &lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;&lt;b&gt;
 selenium.type(&quot;fname&quot;, &quot;niraj&quot;);
 selenium.fireEvent(&quot;fname&quot;, &quot;blur&quot;);
 selenium.type(&quot;lname&quot;, &quot;KUMAR&quot;);
 selenium.fireEvent(&quot;lname&quot;, &quot;blur&quot;);&lt;/b&gt;
&lt;/code&gt;
&lt;/pre&gt;How this works is :&lt;br /&gt;
 &lt;br /&gt;
First this will type &quot;niraj&quot; in First Name and then selenium.fireEvent(&quot;fname&quot;, &quot;blur&quot;); this will call the onblur fuction &quot;upperCase()&quot; which changes the First Name in upper case &quot;NIRAJ&quot;.&lt;br /&gt;
then it types in Last Name and then selenium.fireEvent(&quot;lname&quot;, &quot;blur&quot;); which means it will press tab and lost the function and on the lost focus it calls &lt;br /&gt;
blur function lowerCase which changes the Last Name in lower case.&lt;br /&gt;
&lt;br /&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;</description><link>http://automationtricks.blogspot.com/2010/12/how-to-automate-onblur-through-selenium.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>13</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-6665707503065744653</guid><pubDate>Thu, 21 Oct 2010 11:11:00 +0000</pubDate><atom:updated>2010-10-21T04:11:55.701-07:00</atom:updated><title>How to verify the text ignoring cases sensitivity in selenium ?</title><description>How to verify the text ignoring cases sensitivity in selenium ?&lt;br /&gt;
&lt;br /&gt;
Some times we need to verify the text on the webpage no matter is upper cases or lower cases or proper.&lt;br /&gt;
We just need to verify the text on the web page ignoring their cases sensitivity. &lt;br /&gt;
REGEXPI is used to avoid cases sensitive to verify the text on the page.&lt;br /&gt;
&lt;br /&gt;
Lets say i want to verify the text &lt;b&gt; &quot;Automationtricks is good blog for selenium&quot; &lt;/b&gt; No matter its in upper cases or lower case or proper case.&lt;br /&gt;
&lt;br /&gt;
Then use &lt;b&gt;REGEXPI&lt;/b&gt; in selenium command selenium.isTextPresent  or verifyTextPresent.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;tr&amp;gt;
    &amp;lt;td&amp;gt;verifyTextPresent&amp;lt;/td&amp;gt;
    &amp;lt;td&amp;gt;regexpi:AUTOMATIONTRICKS IS GOOD BLOG FOR SELENIUM&amp;lt;/td&amp;gt;
    &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;tr&amp;gt;
    &amp;lt;td&amp;gt;verifyTextPresent&amp;lt;/td&amp;gt;
    &amp;lt;td&amp;gt;regexpi:AUTOMATIONTRICKS is good blog for selenium&amp;lt;/td&amp;gt;
    &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;tr&amp;gt;
    &amp;lt;td&amp;gt;verifyTextPresent&amp;lt;/td&amp;gt;
    &amp;lt;td&amp;gt;regexpi:AUTOMAtionTRICKS Is GoOd Blog for SELENIUM&amp;lt;/td&amp;gt;
    &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;tr&amp;gt;
    &amp;lt;td&amp;gt;verifyTextPresent&amp;lt;/td&amp;gt;
    &amp;lt;td&amp;gt;regexpi:automationtricks is good blog for selenium&amp;lt;/td&amp;gt;
    &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
In Selenium RC &lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
verifyTrue(selenium.isTextPresent(&quot;regexpi:AUTOMATIONTRICKS IS GOOD BLOG FOR SELENIUM&quot;));

verifyTrue(selenium.isTextPresent(&quot;regexpi:AUTOMATIONTRICKS is good blog for selenium&quot;));

verifyTrue(selenium.isTextPresent(&quot;regexpi:AUTOMAtionTRICKS Is GoOd Blog for SELENIUM&quot;));

verifyTrue(selenium.isTextPresent(&quot;regexpi:automationtricks is good blog for selenium&quot;));
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;</description><link>http://automationtricks.blogspot.com/2010/10/how-to-verify-text-ignoring-cases.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>23</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-6914115969394984829</guid><pubDate>Wed, 06 Oct 2010 10:54:00 +0000</pubDate><atom:updated>2010-10-06T03:57:45.712-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">CSS and Selenium</category><category domain="http://www.blogger.com/atom/ns#">Regular Expression in selenium</category><category domain="http://www.blogger.com/atom/ns#">Selenium IDE</category><category domain="http://www.blogger.com/atom/ns#">xpath</category><title>How to verify value in drop down list.</title><description>How to verify value in drop down list.&lt;br /&gt;
We somehow manage to find the element on the page but its difficult to fund element with some specific attributes.&lt;br /&gt;
Take an example How to find some value is in drop down list or now? To find element drop down is easy but to find a drop down having some specific &lt;br /&gt;
value in their list is difficult.&lt;br /&gt;
&lt;br /&gt;
Go to&amp;nbsp;&lt;a href=&quot;http://www.ebay.in/&quot;&gt;www.ebay.in&lt;/a&gt;  you will see there is drop down along with search text box.&lt;br /&gt;
How to veify a specific value &quot;Collectibles&quot; is in drop down list.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Using Xpath:&lt;/b&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;verifyElementPresent&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;//select[@id=&#39;_sacat&#39;]/option[contains(text(),&#39;Collectibles&#39;)]&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

verifyTrue(selenium.isElementPresent(&quot;//select[@id=&#39;_sacat&#39;]/option[contains(text(),&#39;Collectibles&#39;)]&quot;));
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Using CSS:&lt;/b&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;verifyElementPresent&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;css=select#_sacat&amp;gt;option:contains(&quot;Fun&quot;)&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

verifyTrue(selenium.isElementPresent(&quot;css=select#_sacat&amp;gt;option:contains(\&quot;Fun\&quot;)&quot;));

&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;verifyElementPresent&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;css=select&amp;gt;option:contains(&quot;Fun&quot;)&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt; How to select the value in drop down using regular expression. &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
There are situation when we need to select the drop down value with some partial text .&lt;br /&gt;
With the help of regular expression we can select the drop down value &lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;select&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;_sacat&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;label=regexp:Fun*&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

selenium.select(&quot;_sacat&quot;, &quot;label=regexp:Fun*&quot;);
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;</description><link>http://automationtricks.blogspot.com/2010/10/how-to-verify-value-in-drop-down-list.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>84</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-8735262289103563620</guid><pubDate>Fri, 01 Oct 2010 21:21:00 +0000</pubDate><atom:updated>2011-06-07T09:25:56.573-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">CSS and Selenium</category><category domain="http://www.blogger.com/atom/ns#">xpath</category><title>How to use CSS in Selenium to locate an element</title><description>XPath locator is one of the most precise locator. But this has a disadvantage of its locator types thats is its slowness. &lt;br /&gt;
This disadvantage of xpath you can see when running the tests under IE while Firefox works with xpath pretty faster than IE. &lt;br /&gt;
The main thing is that tests which intensively use XPath work extremely slow under IE and this feature is the cause of huge variety of problems related to execution speed as well as quality of the tests itself especially during operations with dynamic content.&lt;br /&gt;
For this reason CSS locators can be good alternative of XPath. What can we do with CSS locators?&lt;br /&gt;
&lt;br /&gt;
CSS locator will give you clear picture of your element hierarchy &lt;br /&gt;
lets say your xpath of an element is like,&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt; xpath=//div//span/a &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
the same locatore can be identified by CSS is .&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;css=div * span &amp;gt; a &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
from the above example there are two symbol are being used to locate an element.&lt;br /&gt;
&lt;br /&gt;
1) &quot;/&quot; in xpath is just a next level of DOM element hierarchy and same used in CSS is &quot;&lt;b&gt;&amp;gt;&lt;/b&gt;&quot;&lt;br /&gt;
2) &quot;//&quot; in xpath is any DOM object hierarchy level under current object and same used in CSS is &quot;&lt;b&gt;*&lt;/b&gt;&quot;&lt;br /&gt;
&lt;br /&gt;
The way we use attributes in xpath we can use attributes in css as well. lets say your element&#39;s xpath is like this&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;//input[@name=&#39;continue&#39; and @type=&#39;button&#39;]&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
can be written in CSS&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;css=input[name=&#39;continue&#39;][type=&#39;button&#39;]&lt;/b&gt;&lt;br /&gt;
or &lt;br /&gt;
&lt;b&gt;css=input[name=continue][type=button]&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
in xpath we can check the partial attribute value matching but in CSS we can&#39;t. &lt;br /&gt;
&lt;br /&gt;
lets say your element is like this &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&amp;lt;div title=&quot;here is m multiword title&quot; /&amp;gt; &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
so the xpath to locate this element is .&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;xpath=//div[contains(@title,&quot;title&quot;)]&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
and same can be used in CSS like&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;css=div[title~=title]&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
But if your element is like this &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&amp;lt;div title=&quot;my_title&quot; /&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
then CSS locator &lt;b&gt;css=div[title~=title]&lt;/b&gt; wont work here .&lt;br /&gt;
&lt;br /&gt;
CSS provides us the easy way to specify the element.&lt;br /&gt;
lets say your element is like this,&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&amp;lt;input id=&quot;username&quot;&amp;gt;&amp;lt;/input&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
we can write in xpath like this&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;xpath=//input[@id=&quot;username&quot;]&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
and same can be specified in CSS&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;css=input#username&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
so whenever we want to identify any element with their id then we use &lt;b&gt; # &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
lets say your element is like this,&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&amp;lt;input class=&quot;password&quot;&amp;gt;&amp;lt;/input&amp;gt; &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
then xpath is &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;xpath=//input[@class=&quot;password&quot;]&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
and corresponding CSS is &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;css=input.password&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
so whenever we want to identify any element with their class then we use &lt;b&gt;.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
below are the element sturcture used in above examples.&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;html&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;form&amp;gt;
 &amp;lt;input id=&quot;username&quot;&amp;gt;&amp;lt;/input&amp;gt;
 &amp;lt;input class=&quot;password&quot;&amp;gt;&amp;lt;/input&amp;gt;
 &amp;lt;input name=&quot;continue&quot; type=&quot;button&quot;&amp;gt;&amp;lt;/input&amp;gt;
 &amp;lt;input name=&quot;cancel&quot; type=&quot;button&quot;&amp;gt;&amp;lt;/input&amp;gt;
 &amp;lt;input value=&quot;a86b504a-faff-4a18-92d8-68720331c798&quot; name=&quot;vid&quot; type=&quot;hidden&quot;&amp;gt;&amp;lt;input value=&quot;LF_c10cf6d6&quot; name=&quot;lf_cid&quot; type=&quot;hidden&quot;&amp;gt;&amp;lt;/form&amp;gt;
 &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt; An interesting feature of CSS in Selenium :Sub-String matches.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;table border=1&gt;&lt;tr&gt; &lt;td&gt;&lt;b&gt;^=  &lt;/b&gt;&lt;/td&gt;&lt;td&gt;Match a prefix&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;b&gt;$=  &lt;/b&gt;&lt;/td&gt;&lt;td&gt;Match a suffix&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;*=  &lt;/b&gt;&lt;/td&gt;&lt;td&gt;Match a substring&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;b&gt;1 css=a[id^=&#39;id_prefix_&#39;]&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A link with an “id” that starts with the text “id_prefix_”&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2 css=a[id$=&#39;_id_sufix&#39;]&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A link with an “id” that ends with the text “_id_sufix”&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3 css=a[id*=&#39;id_pattern&#39;]&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A link with an “id” that contains the text “id_pattern”&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt; Without specifying the type of element we can identify the element&lt;/b&gt;&lt;br /&gt;
to identify the google search button we can use Css like this&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;css=center &gt; #sbds &gt; #sblsbb &gt; input&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
these CSS features are awesome more details can be found on &lt;br /&gt;
&lt;a href=&quot;http://automationtricks.blogspot.com/search/label/CSS%20and%20Selenium&quot;&gt;How to use CSS in Selenium extensively&lt;/a&gt;&lt;br /&gt;
and if you want to know in depth then visit this page.&lt;br /&gt;
&lt;a href=&quot;http://www.w3.org/TR/css3-selectors/&quot;&gt;http://www.w3.org/TR/css3-selectors/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;</description><link>http://automationtricks.blogspot.com/2010/10/how-to-use-css-in-selenium-to-locate.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>14</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-4027711553811229843</guid><pubDate>Tue, 28 Sep 2010 08:30:00 +0000</pubDate><atom:updated>2010-09-28T11:11:48.023-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Selenium</category><category domain="http://www.blogger.com/atom/ns#">Selenium RC</category><category domain="http://www.blogger.com/atom/ns#">xpath</category><title>How to locate an element which have same name and same atrributes in selenium</title><description>Automation using selenium is a great experience. It provides many way to identif an object or element on the web page.&lt;br /&gt;
But sometime we face the problems of idenfying the objects on a page which have same attributes. When we get more than&lt;br /&gt;
one element which are same in attribute and name like multiple checkboxes with same name and same id. More than one button having &lt;br /&gt;
same name and ids. There are no way to distingues those element. In this case we have problem to instruct selenium to identify a perticular &lt;br /&gt;
object on a web page.&lt;br /&gt;
I am giving you a simple example . In the below html source there are 6 checkboxes are there having same type and same name.&lt;br /&gt;
It is really tough to select third or fifth. &lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;html&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;input type=&#39;checkbox&#39; name=&#39;chk&#39;&amp;gt;first
&amp;lt;br&amp;gt;&amp;lt;input type=&#39;checkbox&#39; name=&#39;chk&#39;&amp;gt;second
&amp;lt;br&amp;gt;&amp;lt;input type=&#39;checkbox&#39; name=&#39;chk&#39;&amp;gt;third
&amp;lt;br&amp;gt;&amp;lt;input type=&#39;checkbox&#39; name=&#39;chk&#39;&amp;gt;forth
&amp;lt;br&amp;gt;&amp;lt;input type=&#39;checkbox&#39; name=&#39;chk&#39;&amp;gt;fifth
&amp;lt;br&amp;gt;&amp;lt;input type=&#39;checkbox&#39; name=&#39;chk&#39;&amp;gt;sixth
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
Thare are some function we can use in Xpath to identify the abject in above cases.&lt;br /&gt;
An XPath expression can return one of four basic XPath data types:&lt;br /&gt;
&lt;br /&gt;
    * String&lt;br /&gt;
    * Number&lt;br /&gt;
    * Boolean&lt;br /&gt;
    * Node-set&lt;br /&gt;
 &lt;br /&gt;
&lt;b&gt;XPath Type : Functions&lt;/b&gt;&lt;br /&gt;
Node set  : last(), position(), count(), id(), local-name(), namespace-uri(), name()&lt;br /&gt;
String   : string(), concat(), starts-with(), contains(), substring-before(), substring-after(), substring(), string-length(), normalize-space(), translate()&lt;br /&gt;
Boolean   : boolean(), not(), true(), false(), lang()&lt;br /&gt;
Number   : number(), sum(), floor(), ceiling(), round()&lt;br /&gt;
&lt;br /&gt;
I will show you how we can use some of these above functions in xpath to identify the objects.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Node Set : last()&lt;/b&gt;&lt;br /&gt;
&lt;/br&gt;&lt;br /&gt;
In the above html file there are six checkboxes and all are having same attributes (same type and name)&lt;br /&gt;
How we can select the last checkbox based on the position. We can use last() function to indentify the last object among all similar objects.&lt;br /&gt;
Below code will check or uncheck the last checkbox.&lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
selenium.click(&quot;xpath=(//input[@type=&#39;checkbox&#39;])[last()]&quot;);
&lt;/code&gt;
&lt;/pre&gt;How we can select the second last checkbox and third last checkbox. We can use last()-  function to indentify the last object among all similar objects.&lt;br /&gt;
Below code will check or uncheck the second last checkbox and thrid last checkbox respectively.&lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
selenium.click(&quot;xpath=(//input[@type=&#39;submit&#39;])[last()-1]&quot;);
selenium.click(&quot;xpath=(//input[@type=&#39;submit&#39;])[last()-2]&quot;);
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Node Set : position() &lt;/b&gt;&lt;br/&gt;&lt;br /&gt;
If you want to select any object based on their position using xpath then you can use position() function in xpath.&lt;br /&gt;
You want to select second checkbox and forth checkbox then use below command &lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
selenium.click(&quot;xpath=(//input[@type=&#39;checkbox&#39;])[position()=2]&quot;);
selenium.click(&quot;xpath=(//input[@type=&#39;checkbox&#39;])[position()=4]&quot;);
&lt;/code&gt;
&lt;/pre&gt;above code will select second and forth checkbox respectively.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;String : starts-with() &lt;/b&gt;&lt;br/&gt;&lt;br /&gt;
Many web sites create dynamic element on their web pages  where Ids of the elements gets generated dynamically.&lt;br /&gt;
Each time id gets generated differently. So to handle this situation we use some JavaScript functions.&lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
XPath: //button[starts-with(@id, &#39;continue-&#39;)]  
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
Sometimes an element gets identfied by a value that could be surrounded by other text, then contains function can be used.&lt;br /&gt;
To demonstrate, the element &lt;input class=&quot;top suggest business&quot;&gt; can be located based on the ‘suggest’ class without having&lt;br /&gt;
 to couple it with the ‘top’ and ‘business’ classes using the following &lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
XPath: //input[contains(@class, &#39;suggest&#39;)].
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example: How to click on link on the page which has many links with same name and attributes.&lt;/b&gt;&lt;br /&gt;
Below is the example of your html which has 3 links with same name and same attributes&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;html&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;a href=&quot;http://www.google.com&quot; name=&quot;a1&quot;&amp;gt;Link&amp;lt;/a&amp;gt;
&amp;lt;a href=&quot;http://www.yahoo.com&quot; name=&quot;a1&quot;&amp;gt;Link&amp;lt;/a&amp;gt;
&amp;lt;a href=&quot;http://www.gmail.com&quot; name=&quot;a1&quot;&amp;gt;Link&amp;lt;/a&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
If you want to click on first link then use below command&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;clickAndWait&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;xpath=(//a[@name=&#39;a1&#39;])[position()=1]&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;If you want to click on second link then use below command&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;clickAndWait&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;xpath=(//a[@name=&#39;a1&#39;])[position()=2]&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;If you want to click on last link or third link then use below command&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;clickAndWait&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;xpath=(//a[@name=&#39;a1&#39;])[last()]&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

OR

&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;clickAndWait&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;xpath=(//a[@name=&#39;a1&#39;])[position()=3]&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;b&gt; Selenium RC. &lt;/b&gt;&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
Click on first link
selenium.click(&quot;xpath=(//a[@name=&#39;a1&#39;])[position()=1]&quot;);
selenium.waitForPageToLoad(&quot;80000&quot;);
Click on second link
selenium.click(&quot;xpath=(//a[@name=&#39;a1&#39;])[position()=2]&quot;);
selenium.waitForPageToLoad(&quot;80000&quot;);
Click on last link
selenium.click(&quot;xpath=(//a[@name=&#39;a1&#39;])[last()]&quot;);
selenium.waitForPageToLoad(&quot;80000&quot;);
Click on thrid link
selenium.click(&quot;xpath=(//a[@name=&#39;a1&#39;])[position()=3]&quot;);
selenium.waitForPageToLoad(&quot;80000&quot;);
&lt;/code&gt;
&lt;/pre&gt;For rest of the function please keep reading my blogs i will be posting very soon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;</description><link>http://automationtricks.blogspot.com/2010/09/how-to-locate-element-which-have-same.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>61</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-5434487885001429564</guid><pubDate>Mon, 27 Sep 2010 19:39:00 +0000</pubDate><atom:updated>2010-09-27T12:40:09.599-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">CSS and Selenium</category><category domain="http://www.blogger.com/atom/ns#">Selenium</category><category domain="http://www.blogger.com/atom/ns#">Selenium IDE</category><category domain="http://www.blogger.com/atom/ns#">Selenium RC</category><title>How to write in Iframe in selenium</title><description>Selenium is unable to type in iframe. But we can write in it by identifying the iframe using css. &lt;br /&gt;
When you write any mail in gmail you can see the body is a iframe we can write in it using below commands&lt;br /&gt;
&lt;b&gt;Selenium IDE&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;storeEval&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;var bodytext=&amp;quot; Writing text in iframe body with the help of http://automationtricks.blogspot.com &amp;quot;;&amp;nbsp;&amp;nbsp;var iframe_locator=&amp;quot;css=table:contains(&#39;Subject:&#39;) +*&amp;nbsp;&amp;nbsp;iframe&amp;quot;;&amp;nbsp;&amp;nbsp;&amp;nbsp;var iframe_body=selenium.browserbot.findElement(iframe_locator).contentWindow.document.body;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (browserVersion.isChrome){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;iframe_body.textContent=bodytext; }&amp;nbsp;&amp;nbsp;else if(browserVersion.isIE){ iframe_body.innerText=bodytext; }&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&lt;/code&gt;
&lt;/pre&gt;&lt;b&gt;Selenium RC.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
String  = selenium.getEval(&quot;var bodytext=\&quot; Writing text in iframe body with the help of http://automationtricks.blogspot.com \&quot;;  var iframe_locator=\&quot;css=table:contains(&#39;Subject:&#39;) +*  iframe\&quot;;   var iframe_body=selenium.browserbot.findElement(iframe_locator).contentWindow.document.body;   if (browserVersion.isChrome){    iframe_body.textContent=bodytext; }  else if(browserVersion.isIE){ iframe_body.innerText=bodytext; }&quot;);
&lt;/code&gt;
&lt;/pre&gt;&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;</description><link>http://automationtricks.blogspot.com/2010/09/how-to-write-in-iframe-in-selenium.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>7</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-4932844306122077700</guid><pubDate>Mon, 27 Sep 2010 18:36:00 +0000</pubDate><atom:updated>2010-09-27T11:37:20.204-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">CSS and Selenium</category><title>How to locate an element based on their label in selenium</title><description>How to locate an element based on their label.&lt;br /&gt;
Some time it difficult to locate an element usiing DOM, HTML and xpath. In that case we use to locate the element with the &lt;br /&gt;
help of their lables.&lt;br /&gt;
&lt;br /&gt;
For example : Go to yahoo login page&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
selenium.open(&quot;https://login.yahoo.com&quot;);

Based on the lable &quot;Yahoo ! ID&quot; we will read the text box and type in.

selenium.type(&quot;css=label:contains(\&quot;Yahoo! ID\&quot;)+input&quot;, &quot;niraj&quot;);

Based on the lable &quot;Password&quot; we will locate the text box for passowrd and type in.

selenium.type(&quot;css=label:contains(\&quot;Password\&quot;)+input&quot;, &quot;pass&quot;);
&lt;/code&gt;
&lt;/pre&gt;Go to yahoo registrantion page.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
selenium.open(&quot;https://edit.yahoo.com/registration?.intl=us&quot;);

Based on Name label we will type in First Name text box. 

selenium.type(&quot;css=label:contains(\&quot;Name\&quot;)+div&amp;gt;input&quot;, &quot;niraj&quot;);

Based on Name label we will  type in Last name text box.

selenium.type(&quot;css=label:contains(\&quot;Name\&quot;)+div&amp;gt;input+input&quot;, &quot;kumar&quot;);

Based on Gender lable we will select the gender from drop down.

selenium.select(&quot;css=label:contains(\&quot;Gender\&quot;)+div&amp;gt;select&quot;, &quot;label=Male&quot;);

Based on Birthday lable we will select the month from drop down.

selenium.select(&quot;css=label:contains(\&quot;Birthday\&quot;)+div&amp;gt;select&quot;, &quot;label=January&quot;);

Based on Birthday lable we will type the date in date text box.

selenium.type(&quot;css=label:contains(\&quot;Birthday\&quot;)+div&amp;gt;select+input&quot;, &quot;2&quot;);

Based on Birthday lable we will type the year in year text box.

selenium.type(&quot;css=label:contains(\&quot;Birthday\&quot;)+div&amp;gt;select+input+input&quot;, &quot;1982&quot;);

Based on country lable we will select India in country drop down box.

selenium.select(&quot;css=div&amp;gt;label:contains(\&quot;Country\&quot;)+div&amp;gt;select&quot;, 
&quot;label=India&quot;);
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;+ &lt;/b&gt; Is used to point the element on the same node in tree of css.&lt;br /&gt;
&amp;lt;label class=&quot;label&quot; for=&quot;name&quot;&amp;gt;Name&amp;lt;/label&amp;gt;&lt;br /&gt;
&amp;lt;div class=&quot;collection&quot; id=&quot;name&quot;&amp;gt;&lt;br /&gt;
               &amp;lt;input type=&quot;text&quot; title=&quot;First Name&quot; name=&quot;firstname&quot; id=&quot;firstname&quot; value=&quot;&quot; size=&quot;32&quot; maxlength=&quot;32&quot; class=&quot;&quot; autocomplete=&quot;off&quot;&amp;gt;&lt;br /&gt;
               &amp;lt;input type=&quot;text&quot; title=&quot;Last Name&quot; name=&quot;secondname&quot; id=&quot;secondname&quot; value=&quot;&quot; size=&quot;32&quot; maxlength=&quot;32&quot; class=&quot;&quot; autocomplete=&quot;off&quot;&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
to access firstname text box &lt;br /&gt;
selenium.type(&quot;css=label:contains(\&quot;Name\&quot;)+div&amp;gt;input&quot;, &quot;niraj&quot;);&lt;br /&gt;
to access secondname its the same label of div but on the second place &lt;br /&gt;
selenium.type(&quot;css=label:contains(\&quot;Name\&quot;)+div&amp;gt;input+input&quot;, &quot;kumar&quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&amp;gt;&lt;/b&gt; Is used to point the element one node down in the tree of css.&lt;br /&gt;
to access firstname text box &lt;br /&gt;
selenium.type(&quot;css=label:contains(\&quot;Name\&quot;)+div&amp;gt;input&quot;, &quot;niraj&quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;</description><link>http://automationtricks.blogspot.com/2010/09/how-to-locate-element-based-on-their.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>38</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-292179787428293042</guid><pubDate>Sun, 26 Sep 2010 13:59:00 +0000</pubDate><atom:updated>2010-10-04T02:26:33.565-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Selenium and AutoIT</category><category domain="http://www.blogger.com/atom/ns#">Selenium RC</category><title>How to upload a file in selenium</title><description>How to upload a file in selenium with the help of AutoIT&lt;br /&gt;
&lt;br /&gt;
Recently, I had the challenge of writing some automation for a workflow which included uploading a file because uloading a file works on windows component.&lt;br /&gt;
selenium is unable to access windows components and it will be handled through AutoIT.&lt;br /&gt;
Once you are able to click on browse button and a dialog box is open to choose the file then you just run a AutoIT script which will help to select the file from your local or remote drive and control will come to your web page to proceed with selenium.&lt;br /&gt;
&lt;br /&gt;
Step to choose a file from your local or remote drive&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Download the AutoIT and intall it.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.autoitscript.com/autoit3/downloads.shtml&quot;&gt;Download AutoIT&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;setp 2.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
write a AutoIT script to choose a file from your local or remote drive.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;

#include &amp;lt;IE.au3&amp;gt;
; Internet Explorer is partly integrated in shell.application
$oShell = ObjCreate(&quot;shell.application&quot;) ; Get the Windows Shell Object
$oShellWindows=$oShell.windows   ; Get the collection of open shell Windows
$MyIExplorer=&quot;&quot;
for $Window in $oShellWindows    ; Count all existing shell windows
  ; Note: Internet Explorer appends a slash to the URL in it&#39;s window name
  if StringInStr($Window.LocationURL,&quot;http://&quot;) then
      $MyIExplorer=$Window
      exitloop
  endif
next
$oForm = _IEGetObjByName ($MyIExplorer, &quot;UploadedFile&quot;)
_IEAction($oForm, &quot;click&quot;)
WinActivate(&quot;Choose file&quot;);
Local $file = &quot;C:\Documents and Settings\intelizen\Desktop\selenium.txt&quot;
ControlSetText(&quot;Choose file&quot;, &quot;&quot;, &quot;Edit1&quot;, $file )
ControlClick(&quot;Choose file&quot;, &quot;&quot;, &quot;Button2&quot;)


&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;setp 3.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Complie AutoIT script and make exe of that script.&lt;br /&gt;
&lt;br /&gt;
Right click on that saved script file and click on &quot;Compile script&quot; from context menu. This will make an exe file of that script.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIV0rMswIvsGRJSoEesZkFUaoEjz46PLuxGULKL2wNRxmcViM7FBfgZr9czFB4uD0tMifHnI8LKNyu-eRPuaQy5qc4jJYSfI6uOqt_xWFQacGrjojV-D6LRDvahfGrF8kn_ewweGxmCdw/s1600/uploadfile.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;209&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIV0rMswIvsGRJSoEesZkFUaoEjz46PLuxGULKL2wNRxmcViM7FBfgZr9czFB4uD0tMifHnI8LKNyu-eRPuaQy5qc4jJYSfI6uOqt_xWFQacGrjojV-D6LRDvahfGrF8kn_ewweGxmCdw/s320/uploadfile.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;setp 4.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Call that exe in selenium.&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
Process proc = Runtime.getRuntime().exec(&quot;C:\\niraj\\FileUpload.exe&quot;);
&lt;/code&gt;
&lt;/pre&gt;&lt;a href=&quot;https://docs.google.com/uc?id=0B0LJXE_W-vjXMmJkYzZiNWQtYTBiYS00OTY3LWJmMjctMWY3ZTRiNzkzYzRk&amp;export=download&quot;&gt;Download AutoIT script&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://docs.google.com/uc?id=0B0LJXE_W-vjXZjNlNzA4YmItZTBhZS00NGI1LTkyYzctNDI4NWE5N2Q5ZjIx&amp;export=download&quot;&gt;Download exe file of AutoIT script&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to test this script then just download the script exe file and click on browse button on web page and run this exe file. Just make sure you have your file in correct path by changing this line of script in the second step &lt;br /&gt;
Local $file = &quot;c:\yourpath\howtoupload.doc&quot;&lt;br /&gt;
in above line of script change your file path then make exe of your script then click on browse button on your web page then run this exe . I am sure this would work.&lt;br /&gt;
&lt;br /&gt;
If it still is nor working then change the script like &lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;

#include &amp;lt;IE.au3&amp;gt;
; Internet Explorer is partly integrated in shell.application
$oShell = ObjCreate(&quot;shell.application&quot;) ; Get the Windows Shell Object
$oShellWindows=$oShell.windows   ; Get the collection of open shell Windows
$MyIExplorer=&quot;&quot;
for $Window in $oShellWindows    ; Count all existing shell windows
  ; Note: Internet Explorer appends a slash to the URL in it&#39;s window name
  if StringInStr($Window.LocationURL,&quot;http://&quot;) then
      $MyIExplorer=$Window
      exitloop
  endif
next
$oForm = _IEGetObjByName ($MyIExplorer, &quot;UploadedFile&quot;)
_IEAction($oForm, &quot;click&quot;)

WinActivate(&quot;File Upload&quot;);
Local $file = &quot;c:\yourpath\howtoupload.doc&quot;
ControlSetText(&quot;File Upload&quot;, &quot;&quot;, &quot;Edit1&quot;, $file )
ControlClick(&quot;File Upload&quot;, &quot;&quot;, &quot;Button2&quot;)
&lt;/code&gt;
&lt;/pre&gt;In above script you might need to change your file path and browse button name and the title of you dialog box.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://docs.google.com/uc?id=0B0LJXE_W-vjXYmQyNGY1ODEtYjkxNy00YWZiLWIyYTctMDc5ODI4MmRlOWJm&amp;export=download&quot;&gt;Download the AutoIT script&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt; Example &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Below is an example in selenium RC for uploading your file which works on &lt;br /&gt;
&lt;a href=&quot;http://www.pdfonline.com/convert-pdf/&quot;&gt; &lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
First download the zip file and extact the files . There are 2 files in this one &quot;Browse.a3&quot; is for clicking on browse button and other one is &quot;upload.a3&quot; for selecting the path from your location and open it in dialog box.Make exe of both files and use in selenium RC like in second step.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://docs.google.com/uc?id=0B0LJXE_W-vjXY2U0OTQ1MDEtZTZhZS00YzVkLWFlYWItYWMwNzcyNGNjMGMy&amp;export=download&quot;&gt;Download the zip file &lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 2.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Write a selenium rc script like below . This script will works file with internet explorer. This script will open http://www.pdfonline.com/convert-pdf there you &lt;br /&gt;
will get a browse button. when Process proc = Runtime.getRuntime().exec(&quot;C:\\Documents and Settings\\nirkumar\\Desktop\\Browse.exe&quot;); executes then it will &lt;br /&gt;
identify the browser and try to identify the element &quot;Browse button&quot; In attached files &quot;Browse.au3&quot; identtifies the button with name of &quot;File1&quot; but &lt;br /&gt;
if you have differen name of your browse button then open then &quot;Browse.au3&quot; file and change the line &quot; $oForm = _IEGetObjByName($MyIExplorer, &quot;Your browse button name&quot;) and save it and &lt;br /&gt;
make exe of that file. Now call this file in selenium. It will click on browse button.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
import java.io.IOException;
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
import com.thoughtworks.selenium.*;
public class Uploadingfiles extends SeleneseTestCase{
 Selenium selenium;
 public static final String MAX_WAIT_TIME_IN_MS=&quot;60000&quot;;
 private SeleniumServer seleniumServer;
  public void setUp() throws Exception {
     
     RemoteControlConfiguration rc = new RemoteControlConfiguration();
          rc.setSingleWindow(false);
          seleniumServer = new SeleniumServer(rc);
          selenium = new DefaultSelenium(&quot;localhost&quot;, 4444, &quot;*iexplore&quot;, &quot;http://www.pdfonline.com/convert-pdf/&quot;);
          seleniumServer.start();
          selenium.start();
          }
   
public void testgoogling() throws IOException {
selenium.open(&quot;http://www.pdfonline.com/convert-pdf/&quot;);

Process proc = Runtime.getRuntime().exec(&quot;C:\\Documents and Settings\\nirkumar\\Desktop\\Browse.exe&quot;);
Process proc1 = Runtime.getRuntime().exec(&quot;C:\\Documents and Settings\\nirkumar\\Desktop\\Upload.exe&quot;);
pause(10000);
}
}
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
When browse button clicked it will open a choose file dialog box. then Process proc1 = Runtime.getRuntime().exec(&quot;C:\\Documents and Settings\\nirkumar\\Desktop\\Upload.exe&quot;); line will be executed&lt;br /&gt;
and this will set the file path and click open. In the attached zip you will get one file &quot;Upload.a3&quot; in this file you have to set the path of your file which you want to upload&lt;br /&gt;
Local $file = &quot;Your file location&quot; this will set the path of your file and click on open button.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note : This work with Internet explorer only.&lt;br /&gt;
&lt;br /&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;</description><link>http://automationtricks.blogspot.com/2010/09/how-to-upload-file-in-selenium.html</link><author>noreply@blogger.com (Niraj Kumar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIV0rMswIvsGRJSoEesZkFUaoEjz46PLuxGULKL2wNRxmcViM7FBfgZr9czFB4uD0tMifHnI8LKNyu-eRPuaQy5qc4jJYSfI6uOqt_xWFQacGrjojV-D6LRDvahfGrF8kn_ewweGxmCdw/s72-c/uploadfile.PNG" height="72" width="72"/><thr:total>24</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-2943553992718386349</guid><pubDate>Sun, 26 Sep 2010 13:23:00 +0000</pubDate><atom:updated>2010-09-27T02:38:37.358-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Selenium and AutoIT</category><category domain="http://www.blogger.com/atom/ns#">Selenium RC</category><title>How to upload a file in selenium with the help of AutoIT</title><description>How to upload a file in selenium with the help of AutoIT&lt;br /&gt;
Recently, I had the challenge of writing some automation for a work flow which included uploading a file because uploading a file works on windows component.&lt;br /&gt;
selenium is unable to access windows components and it will be handled through AutoIT.&lt;br /&gt;
Once you are able to click on browse button and a dialog box is open to choose the file then you just run a AutoIT script which will help to select the file from your local or remote drive and control will come to your web page to proceed with selenium.&lt;br /&gt;
&lt;br /&gt;
Step to choose a file from your local or remote drive&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Click on browse button on your web page and go to second step.If you are unable to click on browse button then visit below page.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://automationtricks.blogspot.com/2010/09/how-to-click-on-browse-button-in.html&quot;&gt;How to click on browse button&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;setp 2.&lt;/b&gt;&lt;br /&gt;
write a AutoIT script to choose a file from your local or remote drive.&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
WinActivate(&quot;Choose file&quot;);
Local $file = &quot;c:\yourpath\howtoupload.doc&quot;
ControlSetText(&quot;Choose file&quot;, &quot;&quot;, &quot;Edit1&quot;, $file )
ControlClick(&quot;Choose file&quot;, &quot;&quot;, &quot;Button2&quot;)

&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;setp 3.&lt;/b&gt;&lt;br /&gt;
Complie AutoIT script and make exe of that script.&lt;br /&gt;
&lt;br /&gt;
Right click on that saved script file and click on &quot;Compile script&quot; from context menu. This will make an exe file of that script.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIV0rMswIvsGRJSoEesZkFUaoEjz46PLuxGULKL2wNRxmcViM7FBfgZr9czFB4uD0tMifHnI8LKNyu-eRPuaQy5qc4jJYSfI6uOqt_xWFQacGrjojV-D6LRDvahfGrF8kn_ewweGxmCdw/s1600/uploadfile.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;209&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIV0rMswIvsGRJSoEesZkFUaoEjz46PLuxGULKL2wNRxmcViM7FBfgZr9czFB4uD0tMifHnI8LKNyu-eRPuaQy5qc4jJYSfI6uOqt_xWFQacGrjojV-D6LRDvahfGrF8kn_ewweGxmCdw/s320/uploadfile.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;setp 4.&lt;/b&gt;&lt;br /&gt;
Call that exe in selenium.&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
Process proc = Runtime.getRuntime().exec(&quot;C:\\Documents and Settings\\nirkumar\\Desktop\\Browse.exe&quot;);

&lt;/code&gt;
&lt;/pre&gt;&lt;a href=&quot;https://docs.google.com/uc?id=0B0LJXE_W-vjXMmJkYzZiNWQtYTBiYS00OTY3LWJmMjctMWY3ZTRiNzkzYzRk&amp;export=download&quot;&gt;Download AutoIT script&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://docs.google.com/uc?id=0B0LJXE_W-vjXZjNlNzA4YmItZTBhZS00NGI1LTkyYzctNDI4NWE5N2Q5ZjIx&amp;export=download&quot;&gt;Download exe file of AutoIT script&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
If you want to test this script then just download the script exe file and click on browse button on web page and run this exe file. Just make sure you have your file in correct path by changing this line of script in the second step &lt;br /&gt;
Local $file = &quot;c:\yourpath\howtoupload.doc&quot;&lt;br /&gt;
in above line of script change your file path then make exe of your script then click on browse button on your web page then run this exe . I am sure this would work.&lt;br /&gt;
If it still is nor working then change the script like &lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
WinActivate(&quot;File Upload&quot;);
Local $file = &quot;c:\yourpath\howtoupload.doc&quot;
ControlSetText(&quot;File Upload&quot;, &quot;&quot;, &quot;Edit1&quot;, $file )
ControlClick(&quot;File Upload&quot;, &quot;&quot;, &quot;Button2&quot;)
&lt;/code&gt;
&lt;/pre&gt;&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;</description><link>http://automationtricks.blogspot.com/2010/09/how-to-upload-file-in-selenium-with.html</link><author>noreply@blogger.com (Niraj Kumar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIV0rMswIvsGRJSoEesZkFUaoEjz46PLuxGULKL2wNRxmcViM7FBfgZr9czFB4uD0tMifHnI8LKNyu-eRPuaQy5qc4jJYSfI6uOqt_xWFQacGrjojV-D6LRDvahfGrF8kn_ewweGxmCdw/s72-c/uploadfile.PNG" height="72" width="72"/><thr:total>253</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-6026040771131404890</guid><pubDate>Sun, 26 Sep 2010 12:47:00 +0000</pubDate><atom:updated>2010-10-04T04:21:57.527-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Selenium and AutoIT</category><category domain="http://www.blogger.com/atom/ns#">Selenium RC</category><title>How to click on browse button in selenium with the help of AutoIT</title><description>Recently, I had the challenge of writing some automation for a work flow which included uploading a file, and then downloading a file later in the work flow.&lt;br /&gt;
&lt;b&gt;&lt;u&gt;AutoIT&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Autoit is a freeware windows testing tool. Autoit allows you accessing windows components similar to QTP. Basically once you have identified the id of the component on the screen you can use it by either clicking on it, typing in something.  Using Autoit we can identify the internet explorer “Choose file” or Firefox &lt;br /&gt;
&lt;br /&gt;
“File Upload” windows and enter the correct value to the input &lt;br /&gt;
&lt;br /&gt;
field after which you will press the open button.&lt;br /&gt;
&lt;br /&gt;
Step to click on browse button.&lt;br /&gt;
&lt;b&gt;Step 1.&lt;/b&gt;&lt;br /&gt;
Download the AutoIT and intall it.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.autoitscript.com/autoit3/downloads.shtml&quot;&gt;Download AutoIT&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;setp 2.&lt;/b&gt;&lt;br /&gt;
write a AutoIT script to click on browse button and save it.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;

#include &amp;lt;IE.au3&amp;gt;
; Internet Explorer is partly integrated in shell.application
$oShell = ObjCreate(&quot;shell.application&quot;) ; Get the Windows 

Shell Object
$oShellWindows=$oShell.windows   ; Get the 

collection of open shell Windows
$MyIExplorer=&quot;&quot;
for $Window in $oShellWindows    ; Count all existing 

shell windows
  ; Note: Internet Explorer appends a slash to the URL in it&#39;s 

window name
  if StringInStr($Window.LocationURL,&quot;http://&quot;) then
      $MyIExplorer=$Window
      exitloop
  endif
next
$oForm = _IEGetObjByName ($MyIExplorer, &quot;UploadedFile&quot;)
_IEAction($oForm, &quot;click&quot;)

&lt;/ie.au3&gt;&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;setp 3.&lt;/b&gt;&lt;br /&gt;
Compile AutoIT script and make exe file of that script.&lt;br /&gt;
&lt;br /&gt;
Right click on that saved script file and click on &quot;Compile script&quot; from context menu. This will make an exe file of that script.&lt;br /&gt;
&lt;span id=&quot;goog_1673186738&quot;&gt;&lt;/span&gt;&lt;span id=&quot;goog_1673186739&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0dVfpJiamaVJYV0BA-xiutYdUSO2a6WN3rybl8v1fbgzxRrJYSl9a-Q-DKaKVCVzGTOs2mQuMmhQQMPH7hm3N4xvQxlANxNkvXbURxkYJaGeC7Ce-5Voe66T_ngx1Mq3aSijwZPtv12M/s1600/compileandmakeexe.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;209&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0dVfpJiamaVJYV0BA-xiutYdUSO2a6WN3rybl8v1fbgzxRrJYSl9a-Q-DKaKVCVzGTOs2mQuMmhQQMPH7hm3N4xvQxlANxNkvXbURxkYJaGeC7Ce-5Voe66T_ngx1Mq3aSijwZPtv12M/s320/compileandmakeexe.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;setp 4.&lt;/b&gt;&lt;br /&gt;
Call that exe in selenium.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
Process proc = Runtime.getRuntime().exec(&quot;C:\\Documents and Settings\\nirkumar\\Desktop\\Browse.exe&quot;);

&lt;/code&gt;
&lt;/pre&gt;This will click on browse button and open choose file or upload file dialog box.&lt;br /&gt;
&lt;a href=&quot;https://docs.google.com/uc?id=0B0LJXE_W-vjXM2UyZGEyYmEtMGNiZC00YTY5LThlZWQtZDliN2U0ZDc5YjZj&amp;export=download&quot;&gt;Download AutoIT script&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://docs.google.com/uc?id=0B0LJXE_W-vjXOWQ0NWE4YmItNzcxNC00NmE1LTkyM2EtZWEwZWY0ZWVmZWY2&amp;export=download&quot;&gt;Download exe of that script&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
If you want to test this script works then download the exe and open the page which has browse button and run(double click on this exe) this exe file. i am sure this &lt;br /&gt;
will click on your browse button and open a dialog box. If it does not then definitely your browse button has some other name than &quot;UploadedFile&quot; then in the step 2 change the button name and make exe of that script and run it. &lt;br /&gt;
&lt;br /&gt;
NOTE: This will work in Internet explorer. &lt;br /&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;</description><link>http://automationtricks.blogspot.com/2010/09/how-to-click-on-browse-button-in.html</link><author>noreply@blogger.com (Niraj Kumar)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0dVfpJiamaVJYV0BA-xiutYdUSO2a6WN3rybl8v1fbgzxRrJYSl9a-Q-DKaKVCVzGTOs2mQuMmhQQMPH7hm3N4xvQxlANxNkvXbURxkYJaGeC7Ce-5Voe66T_ngx1Mq3aSijwZPtv12M/s72-c/compileandmakeexe.PNG" height="72" width="72"/><thr:total>8</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-4480689799090938997</guid><pubDate>Tue, 14 Sep 2010 18:41:00 +0000</pubDate><atom:updated>2010-09-26T06:40:46.314-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Selenium</category><category domain="http://www.blogger.com/atom/ns#">Selenium IDE</category><title>How to share a variable in two test cases</title><description>How to share a variable in more than one test case. &lt;br /&gt;
We Create a variable in one test case and use in another test cases. If these test cases are running seperately and independetely then those variable&lt;br /&gt;
cannot shared. But if we run all test cases in test suite then one varaible declared in one testcase can be used in another &lt;br /&gt;
Follow these steps.&lt;br /&gt;
Create your test cases saparetly and call them in a test suite.&lt;br /&gt;
&lt;b&gt; 1.Create first test case &lt;/b&gt;&lt;br /&gt;
Test1.html&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&amp;gt;
&amp;lt;title&amp;gt;Propagate_Negative_API_UK&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;table cellpadding=&quot;1&quot; cellspacing=&quot;1&quot; border=&quot;1&quot;&amp;gt;
&amp;lt;thead&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;td rowspan=&quot;1&quot; colspan=&quot;3&quot;&amp;gt;Propagate_Negative_API_UK&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;/thead&amp;gt;&amp;lt;tbody&amp;gt;
&amp;lt;!------------------ Initialization steps ----------&amp;gt;
&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;store&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;varaible from first test1&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;vartest1&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;


&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;open&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;http://www.google.com&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;/tbody&amp;gt;&amp;lt;/table&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;b&gt; 2.Create second test case &lt;/b&gt;&lt;br /&gt;
Test2.html&lt;br /&gt;
==========&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&amp;gt;
&amp;lt;title&amp;gt;Propagate_Negative_API_UK&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;table cellpadding=&quot;1&quot; cellspacing=&quot;1&quot; border=&quot;1&quot;&amp;gt;
&amp;lt;thead&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;td rowspan=&quot;1&quot; colspan=&quot;3&quot;&amp;gt;Propagate_Negative_API_UK&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;/thead&amp;gt;&amp;lt;tbody&amp;gt;
&amp;lt;!------------------ Initialization steps ----------&amp;gt;
&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;store&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;varaible from first test2&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;vartest2&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;open&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;http://www.yahoo.com&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;echo&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;${vartest1}&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;b&gt; 3.Create third test case &lt;/b&gt;&lt;br /&gt;
Test3.html&lt;br /&gt;
=========&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&amp;gt;
&amp;lt;title&amp;gt;Propagate_Negative_API_UK&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;table cellpadding=&quot;1&quot; cellspacing=&quot;1&quot; border=&quot;1&quot;&amp;gt;
&amp;lt;thead&amp;gt;
&amp;lt;tr&amp;gt;&amp;lt;td rowspan=&quot;1&quot; colspan=&quot;3&quot;&amp;gt;Propagate_Negative_API_UK&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
&amp;lt;/thead&amp;gt;&amp;lt;tbody&amp;gt;
&amp;lt;!------------------ Initialization steps ----------&amp;gt;
&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;store&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;varaible from first test3&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;vartest3&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;open&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;http://www.gmail.com&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
 &amp;lt;td&amp;gt;echo&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;${vartest2}&amp;lt;/td&amp;gt;
 &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;/tbody&amp;gt;&amp;lt;/table&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;b&gt; 4.Create test suite&lt;/b&gt;&lt;br /&gt;
TestSuite.html&lt;br /&gt;
=========&lt;br /&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;&quot;&gt;&lt;code&gt;

&amp;lt;html&amp;gt;
 &amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
   &amp;lt;table&amp;gt;
    &amp;lt;tbody&amp;gt;

     &amp;lt;tr&amp;gt;
       &amp;lt;td&amp;gt;Test suite for sharing variable among test cases &amp;lt;/td&amp;gt;
     &amp;lt;/tr&amp;gt;

     &amp;lt;tr&amp;gt;
      &amp;lt;td&amp;gt;&amp;lt;a target=&quot;testFrame&quot; href=&quot;test1.html&quot;&amp;gt;test1&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;
     &amp;lt;/tr&amp;gt;

    &amp;lt;tr&amp;gt;
      &amp;lt;td&amp;gt;&amp;lt;a target=&quot;testFrame&quot; href=&quot;test2.html&quot;&amp;gt;test2&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;

    &amp;lt;tr&amp;gt;
      &amp;lt;td&amp;gt;&amp;lt;a target=&quot;testFrame&quot; href=&quot;test3.html&quot;&amp;gt;test3&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;
    &amp;lt;/tr&amp;gt;
  &amp;lt;/tbody&amp;gt;
&amp;lt;/table&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
Run your test suite and you will see the variable &lt;b&gt;vartest1&lt;/b&gt; decalred in testcase1 being used in testcases2 &lt;br /&gt;
and variable &lt;b&gt;vartest2&lt;/b&gt; declared in testcase2 being used in testcase3.&lt;br /&gt;
&lt;br /&gt;
Files are attached here . Right click on this link and save as ...&lt;br /&gt;
&lt;a href=&quot;https://docs.google.com/uc?id=0B0LJXE_W-vjXOTgyNDdkYjItYmM5Zi00ZGEwLTk2OWItYWRjNWI2ZDE0NDBi&amp;export=download&amp;hl=en&quot;&gt;&amp;nbsp; Download test case and suite &lt;/a&gt;&lt;br /&gt;
&lt;div id=&quot;preLoadLayer2&quot; style=&quot;display: none; left: -18px; position: absolute; top: -32px; z-index: 2147482647;&quot;&gt;&lt;a class=&quot;kLink&quot; href=&quot;http://www.blogdoctor.me/2007/02/upload-files-to-blogger.html#&quot; id=&quot;KonaLink2&quot; style=&quot;position: static; text-decoration: underline ! important;&quot; target=&quot;undefined&quot;&gt;&lt;span class=&quot;preLoadWrap&quot; id=&quot;preLoadWrap2&quot; style=&quot;position: relative;&quot;&gt;&lt;img class=&quot;preloadImg&quot; src=&quot;http://konac.kontera.com/javascript/lib/imgs/grey_loader.gif&quot; style=&quot;border: medium none; height: 22px; width: 22px;&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;a class=&quot;kLink&quot; href=&quot;http://www.blogdoctor.me/2007/02/upload-files-to-blogger.html#&quot; id=&quot;KonaLink2&quot; style=&quot;position: static; text-decoration: underline ! important;&quot; target=&quot;undefined&quot;&gt;&lt;span class=&quot;preLoadWrap&quot; id=&quot;preLoadWrap2&quot; style=&quot;position: relative;&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;</description><link>http://automationtricks.blogspot.com/2010/09/how-to-share-variable-in-two-test-cases.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-5484472283682291335</guid><pubDate>Tue, 14 Sep 2010 14:05:00 +0000</pubDate><atom:updated>2010-09-28T11:14:01.837-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Selenium</category><category domain="http://www.blogger.com/atom/ns#">Selenium RC</category><category domain="http://www.blogger.com/atom/ns#">xpath</category><title>How to use functions in xpath in selenium</title><description>&lt;b&gt; How to use functions in xpath &lt;/b&gt;&lt;br /&gt;
Automation using selenium is a great experience. It provides many way to identif an object or element on the web page.&lt;br /&gt;
But sometime we face the problems of idenfying the objects on a page which have same attributes. When we get more than&lt;br /&gt;
one element which are same in attribute and name like multiple checkboxes with same name and same id. More than one button having &lt;br /&gt;
same name and ids. There are no way to distingues those element. In this case we have problem to instruct selenium to identify a perticular &lt;br /&gt;
object on a web page.&lt;br /&gt;
I am giving you a simple example . In the below html source there are 6 checkboxes are there having same type and same name.&lt;br /&gt;
It is really tough to select third or fifth. &lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;html&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;input type=&#39;checkbox&#39; name=&#39;chk&#39;&amp;gt;first
&amp;lt;br&amp;gt;&amp;lt;input type=&#39;checkbox&#39; name=&#39;chk&#39;&amp;gt;second
&amp;lt;br&amp;gt;&amp;lt;input type=&#39;checkbox&#39; name=&#39;chk&#39;&amp;gt;third
&amp;lt;br&amp;gt;&amp;lt;input type=&#39;checkbox&#39; name=&#39;chk&#39;&amp;gt;forth
&amp;lt;br&amp;gt;&amp;lt;input type=&#39;checkbox&#39; name=&#39;chk&#39;&amp;gt;fifth
&amp;lt;br&amp;gt;&amp;lt;input type=&#39;checkbox&#39; name=&#39;chk&#39;&amp;gt;sixth
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
Thare are some function we can use in Xpath to identify the abject in above cases.&lt;br /&gt;
An XPath expression can return one of four basic XPath data types:&lt;br /&gt;
&lt;br /&gt;
    * String&lt;br /&gt;
    * Number&lt;br /&gt;
    * Boolean&lt;br /&gt;
    * Node-set&lt;br /&gt;
 &lt;br /&gt;
&lt;b&gt;XPath Type : Functions&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Node set  :&lt;/b&gt; last(), position(), count(), id(), local-name(), namespace-uri(), name()&lt;br /&gt;
&lt;b&gt;String   :&lt;/b&gt; string(), concat(), starts-with(), contains(), substring-before(), substring-after(), substring(), string-length(), normalize-space(), translate()&lt;br /&gt;
&lt;b&gt;Boolean   :&lt;/b&gt; boolean(), not(), true(), false(), lang()&lt;br /&gt;
&lt;b&gt;Number   :&lt;/b&gt; number(), sum(), floor(), ceiling(), round()&lt;br /&gt;
&lt;br /&gt;
I will show you how we can use some of these above functions in xpath to identify the objects.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Node Set : last()&lt;/b&gt;&lt;br /&gt;
&lt;/br&gt;&lt;br /&gt;
In the above html file there are six checkboxes and all are having same attributes (same type and name)&lt;br /&gt;
How we can select the last checkbox based on the position. We can use last() function to indentify the last object among all similar objects.&lt;br /&gt;
Below code will check or uncheck the last checkbox.&lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
selenium.click(&quot;xpath=(//input[@type=&#39;checkbox&#39;])[last()]&quot;);
&lt;/code&gt;
&lt;/pre&gt;How we can select the second last checkbox and third last checkbox. We can use last()-  function to indentify the last object among all similar objects.&lt;br /&gt;
Below code will check or uncheck the second last checkbox and thrid last checkbox respectively.&lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
selenium.click(&quot;xpath=(//input[@type=&#39;submit&#39;])[last()-1]&quot;);
selenium.click(&quot;xpath=(//input[@type=&#39;submit&#39;])[last()-2]&quot;);
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;Node Set : position() &lt;/b&gt;&lt;br/&gt;&lt;br /&gt;
If you want to select any object based on their position using xpath then you can use position() function in xpath.&lt;br /&gt;
You want to select second checkbox and forth checkbox then use below command &lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
selenium.click(&quot;xpath=(//input[@type=&#39;checkbox&#39;])[position()=2]&quot;);
selenium.click(&quot;xpath=(//input[@type=&#39;checkbox&#39;])[position()=4]&quot;);
&lt;/code&gt;
&lt;/pre&gt;above code will select second and forth checkbox respectively.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;String : starts-with() &lt;/b&gt;&lt;br/&gt;&lt;br /&gt;
Many web sites create dynamic element on their web pages  where Ids of the elements gets generated dynamically.&lt;br /&gt;
Each time id gets generated differently. So to handle this situation we use some JavaScript functions.&lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
XPath: //button[starts-with(@id, &#39;continue-&#39;)]  
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
Sometimes an element gets identfied by a value that could be surrounded by other text, then contains function can be used.&lt;br /&gt;
To demonstrate, the element &lt;input class=&quot;top suggest business&quot;&gt; can be located based on the ‘suggest’ class without having&lt;br /&gt;
 to couple it with the ‘top’ and ‘business’ classes using the following &lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
XPath: //input[contains(@class, &#39;suggest&#39;)].
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
For rest of the function please keep reading my blogs i will be posting very soon.&lt;br /&gt;
&lt;br /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;IL_RELATED_TAGS&quot; value=&quot;1&quot;/&gt;</description><link>http://automationtricks.blogspot.com/2010/09/how-to-use-functions-in-xpath-in.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>325</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-1380352628890689087</guid><pubDate>Tue, 24 Aug 2010 18:15:00 +0000</pubDate><atom:updated>2010-09-04T11:59:58.626-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Selenium RC</category><title>How to handle Selenium is already running on port 4444</title><description>When we run selenium RC test cases sometimes we faces this issue saying &quot;java.net.BindException: Selenium is already running on port 4444. Or some other service is.&quot; When you check the port 4444 no service is running. We change the port and run the program even that too is not working. &lt;br /&gt;
In these cases we need to shutdown the selenium server on this port.&lt;br /&gt;
Use below command to shut down the server.&lt;br /&gt;
&lt;br /&gt;
http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer&lt;br /&gt;
&lt;br /&gt;
If selenium server is already running on port 4444 then it will shut down the server and says &lt;br /&gt;
OKOK&lt;br /&gt;
if selenium is not running on this port 4444 then by hitting above url will give you &lt;br /&gt;
&quot;Unable to connect&quot;&lt;br /&gt;
Now you can run your test cases i am sure will run smoothing.</description><link>http://automationtricks.blogspot.com/2010/08/how-to-handle-selenium-is-already.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>47</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-762289821851716315</guid><pubDate>Tue, 24 Aug 2010 18:00:00 +0000</pubDate><atom:updated>2010-09-23T20:46:53.334-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Selenium IDE</category><category domain="http://www.blogger.com/atom/ns#">Selenium RC</category><title>How to get browser name, version and operating system detail in selenium</title><description>We can get the browser name, version and operating system name and version with the following commands in selenium RC.&lt;br /&gt;
Below code is tested in Mozilla Firefox&lt;br /&gt;
&lt;b&gt;Browser Name &lt;/b&gt;&lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
System.out.println(selenium.getEval(&quot;navigator.appCodeName;&quot;));

Mozilla
&lt;/code&gt;
&lt;/pre&gt;&lt;b&gt;Browser version &lt;/b&gt;&lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
System.out.println(selenium.getEval(&quot;navigator.appVersion;&quot;));

5.0 (Windows; en-US)
&lt;/code&gt;
&lt;/pre&gt;&lt;b&gt;Browser and Operating system detail&lt;/b&gt;&lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
System.out.println(selenium.getEval(&quot;navigator.userAgent;&quot;));

Result.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729)

String browser = selenium.getEval(&quot;navigator.userAgent&quot;);
if (browser.contains(&quot;Firefox&quot;)  || browser.contains(&quot;Chrome&quot;)) {

&lt;/code&gt;
&lt;/pre&gt;</description><link>http://automationtricks.blogspot.com/2010/08/how-to-get-browser-name-version-and.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-4640108202668346727.post-5605856787285345042</guid><pubDate>Fri, 20 Aug 2010 05:07:00 +0000</pubDate><atom:updated>2010-09-13T07:14:26.276-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Selenium IDE</category><category domain="http://www.blogger.com/atom/ns#">Selenium RC</category><title>How to verify html source in selenium</title><description>We can verify the html source with selenium commands&lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;title&amp;gt;HTML Source&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
what need to be verifed Text is here we need to verify
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;b&gt;Script &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
verifyTrue(selenium.getHtmlSource().matches(&quot;^[\\s\\S]*Text is here[\\s\\S]*$&quot;));
&lt;/code&gt;
&lt;/pre&gt;above command will verify Text is here in above html srource&lt;br /&gt;
&lt;pre style=&quot;border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;&quot;&gt;&lt;code&gt;
verifyTrue(selenium.getHtmlSource().matches(&quot;^[\\s\\S]*Text i here[\\s\\S]*$&quot;));
&lt;/code&gt;
&lt;/pre&gt;above command will fail because it tries to verify Text i here which is not there in html source&lt;br /&gt;
&lt;br /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;IL_RELATED_TAGS&quot; value=&quot;1&quot;/&gt;</description><link>http://automationtricks.blogspot.com/2010/08/how-to-verify-html-source-in-selenium.html</link><author>noreply@blogger.com (Niraj Kumar)</author><thr:total>7</thr:total></item></channel></rss>