<?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-543267854941927967</atom:id><lastBuildDate>Fri, 31 Oct 2025 01:39:45 +0000</lastBuildDate><category>WebDriver Selenium2</category><category>Tips and Tricks</category><category>Thoughts on Life</category><category>Error Messages</category><category>Java</category><category>FirefoxDriver</category><category>General</category><category>Personal</category><category>TestNG</category><category>Google</category><category>Moral Stories</category><category>Android</category><category>Apple</category><category>Chrome</category><category>ChromeDriver</category><category>InternetExplorerDriver</category><category>Eclipse</category><category>Firefox</category><category>JDBC</category><category>JavaScript</category><category>OperaDriver</category><category>Safari</category><category>Testing</category><category>Youtube</category><title>My Thoughts</title><description>~ by Vamshi Kurra &lt;a href=&quot;https://play.google.com/store/apps/dev?id=7324317861767414429&quot;&gt;&#xa;  &lt;img alt=&quot;Get it on Google Play&quot; src=&quot;https://play.google.com/intl/en_us/badges/images/badge_new.png&quot;&gt;&#xa;&lt;/a&gt;</description><link>http://www.mythoughts.co.in/</link><managingEditor>noreply@blogger.com (Unknown)</managingEditor><generator>Blogger</generator><openSearch:totalResults>64</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-736223305769145516</guid><pubDate>Thu, 06 Mar 2014 04:00:00 +0000</pubDate><atom:updated>2014-08-02T00:47:38.018+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">FirefoxDriver</category><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>On test case failure take a screenshot with Selenium WebDriver</title><description>&lt;meta name=&quot;identifier-url&quot; content=&quot;http://www.mythoughts.co.in/2014/03/on-test-case-failure-take-screenshot.html&quot; /&gt;
&lt;meta name=&quot;title&quot; content=&quot;On test case failure take a screenshot with Selenium WebDriver&quot; /&gt;
&lt;meta name=&quot;description&quot; content=&quot;On test case failure take a screenshot with Selenium WebDriver&quot; /&gt;
&lt;meta name=&quot;abstract&quot; content=&quot;On test case failure take a screenshot with Selenium WebDriver&quot; /&gt;
&lt;meta name=&quot;keywords&quot; content=&quot;selenium,webdriver,automation&quot; /&gt;
&lt;meta name=&quot;author&quot; content=&quot;Vamshi Kurra&quot; /&gt;
&lt;meta name=&quot;revisit-after&quot; content=&quot;5&quot; /&gt;
&lt;meta name=&quot;language&quot; content=&quot;EN&quot; /&gt;
&lt;meta name=&quot;copyright&quot; content=&quot;© Vamshi Kurra&quot; /&gt;

&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Don&#39;t you think &quot;A picture is worth a thousand words..&quot; :)&lt;br /&gt;
&lt;br /&gt;
It is always(at least in most of the cases :P) better to take screenshot of webpage when the test run fails.&lt;br /&gt;
&lt;br /&gt;
Because with one look at the screenshot we can get an idea of where exactly the script got failed. Moreover reading screenshot is easier compare to reading 100&#39;s of console errors :P&lt;br /&gt;
&lt;br /&gt;
Here is the sample code to take screenshot of webpage&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);

FileUtils.copyFile(scrFile, new File(&quot;PathOnLocalDrive&quot;)&lt;/pre&gt;
&lt;br /&gt;
To get screenshot on test failure , we should put the entire code in try-catch block . In the catch block make sure to copy the above screenshot code.&lt;br /&gt;
&lt;br /&gt;
In my example I am trying to register as a new user. For both first and last name fields I have used correct locator element whereas for emailaddress field I have used wrong locator element i.e &lt;b&gt;name(&quot;GmailAddress1&quot;)&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
So when I run the script , test failed and I got the screenshot with pre filled first and last names but not email address.&lt;br /&gt;
&lt;br /&gt;
Here is the sample code :&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class TakeScreenshot {
 
   WebDriver driver;
 
 @BeforeTest
 public void start(){
  driver = new FirefoxDriver();
 }
 
 @Test
 public void Test() throws IOException{
 try{
  driver.get(&quot;https://mail.google.com/&quot;);
  driver.findElement(By.id(&quot;link-signup&quot;)).click();
  driver.findElement(By.name(&quot;FirstName&quot;)).sendKeys(&quot;First Name&quot;);
  driver.findElement(By.name(&quot;LastName&quot;)).sendKeys(&quot;Last Name&quot;);
  driver.findElement(By.name(&quot;GmailAddress1&quot;)).sendKeys(&quot;GmailAddress@gmail.com&quot;);
  
 }catch(Exception e){
  //Takes the screenshot  when test fails
     File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
     FileUtils.copyFile(scrFile, new File(&quot;C:\\Users\\Public\\Pictures\\failure.png&quot;));
   
  }
 }
}&lt;/pre&gt;
And here is the screenshot of webpage on test failure&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/AVvXsEiB5WMbRmSEffoHnauBpZ5-76uCXBIeqn7GW4FMy7lSgUnH0S-nkLj6OkJFoHMGj2B6GA3wZ1Ue9c0QskvwZgmbLybWu8SiUFaK3ShM0YNmZO9ncbHoEu0kk3qmTToYKOrKkkT9VYDjLPuj/s1600/failure.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/AVvXsEiB5WMbRmSEffoHnauBpZ5-76uCXBIeqn7GW4FMy7lSgUnH0S-nkLj6OkJFoHMGj2B6GA3wZ1Ue9c0QskvwZgmbLybWu8SiUFaK3ShM0YNmZO9ncbHoEu0kk3qmTToYKOrKkkT9VYDjLPuj/s1600/failure.png&quot; height=&quot;400&quot; width=&quot;390&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Reference &amp;nbsp;:&lt;br /&gt;
&lt;a href=&quot;http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp#taking-a-screenshot&quot; target=&quot;_blank&quot;&gt;http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp#taking-a-screenshot&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/TakesScreenshot.html&quot; target=&quot;_blank&quot;&gt;http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/TakesScreenshot.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Between have a great day ...!!! :)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;/div&gt;</description><link>http://www.mythoughts.co.in/2014/03/on-test-case-failure-take-screenshot.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiB5WMbRmSEffoHnauBpZ5-76uCXBIeqn7GW4FMy7lSgUnH0S-nkLj6OkJFoHMGj2B6GA3wZ1Ue9c0QskvwZgmbLybWu8SiUFaK3ShM0YNmZO9ncbHoEu0kk3qmTToYKOrKkkT9VYDjLPuj/s72-c/failure.png" height="72" width="72"/><thr:total>12</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-948324143790563986</guid><pubDate>Sun, 29 Dec 2013 07:52:00 +0000</pubDate><atom:updated>2014-04-02T16:13:01.290+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">FirefoxDriver</category><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>Configure browser proxy settings using Selenium WebDriver </title><description>&lt;meta name=&quot;Description&quot; content=&quot;Configure browser proxy settings using Selenium WebDriver &quot; /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Most of software testers are familiar with the term &quot;Changing proxy settings&quot; :P .&lt;br /&gt;
The only reason ( atleast for me :P ) we change browser proxy settings is to verify&amp;nbsp;&quot;multilingual&quot; and &quot;multi-regional&quot; websites .&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;A &lt;b&gt;multilingual &lt;/b&gt;website is any website that offers content in more than one language (&lt;a href=&quot;http://www.facebook.com/&quot; target=&quot;_blank&quot;&gt;Facebook&lt;/a&gt;) .&lt;/li&gt;
&lt;li&gt;A &lt;b&gt;multi-regional &lt;/b&gt;website is one that explicitly targets users in different countries (&lt;a href=&quot;http://www.bwin.com/&quot; target=&quot;_blank&quot;&gt;Bwin&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
If business is happened to spread in multiple countries then website has to offer content in more than one language.But it is always not so easy to test &quot;multi-regional&quot; websites.Sometimes we have to &lt;a href=&quot;http://www.wikihow.com/Change-Proxy-Settings&quot; target=&quot;_blank&quot;&gt;change the proxy settings &lt;/a&gt;of browser to verify the functionality.&lt;br /&gt;
&lt;br /&gt;
Say if you directly access the&amp;nbsp;&lt;a href=&quot;http://www.bwin.com/&quot; target=&quot;_blank&quot;&gt;bwin.com&lt;/a&gt;&amp;nbsp;from India then we will get redirecte to&amp;nbsp;&lt;a href=&quot;http://help.bwin.com/closed&quot;&gt;http://help.bwin.com/closed&lt;/a&gt;&amp;nbsp;&amp;nbsp; and we will see the below page.&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/AVvXsEjrpSf7N78Aa6b3-LP0y1DjRBb_p8gH1R4UuKX7r_f_k3T_6y2VO6Xmdk1_1oJ0WWu5ow0dlIMUUkPYmP-K76GUaewmI_TfQEsFg-lyG-qifYAtwA2E47_BAKVApK-o6Kf2PvHwZ_eJOzih/s1600/Bwin-India.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrpSf7N78Aa6b3-LP0y1DjRBb_p8gH1R4UuKX7r_f_k3T_6y2VO6Xmdk1_1oJ0WWu5ow0dlIMUUkPYmP-K76GUaewmI_TfQEsFg-lyG-qifYAtwA2E47_BAKVApK-o6Kf2PvHwZ_eJOzih/s1600/Bwin-India.png&quot; height=&quot;286&quot; title=&quot;Bwin website in India&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
But if you access the same&amp;nbsp;&lt;a href=&quot;http://www.bwin.com/&quot; target=&quot;_blank&quot;&gt;bwin.com&lt;/a&gt;&amp;nbsp;site from United States then you will see the below page.&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/AVvXsEh4OQludGjnzzoFIFNTxumkjElfKNbx0Pz1iZfmN1dz6IGcr7eLmYpWB5ixOpOV6twvsJ2Ll9QsLV1f4GmBz3g46_VUEtQO2Z8Z96piIZdNZwpc0nz1fuTe5fFPXgbICBdEMtiu8y5H5NnX/s1600/Bwin+-+US.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4OQludGjnzzoFIFNTxumkjElfKNbx0Pz1iZfmN1dz6IGcr7eLmYpWB5ixOpOV6twvsJ2Ll9QsLV1f4GmBz3g46_VUEtQO2Z8Z96piIZdNZwpc0nz1fuTe5fFPXgbICBdEMtiu8y5H5NnX/s1600/Bwin+-+US.png&quot; height=&quot;400&quot; title=&quot;Bwin website in US&quot; width=&quot;357&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Manually if we want to test this functionality then we will get &lt;a href=&quot;http://hidemyass.com/proxy-list/&quot; target=&quot;_blank&quot;&gt;proxy server details&lt;/a&gt;&amp;nbsp;from online and change our browser &lt;a href=&quot;http://www.wikihow.com/Change-Proxy-Settings&quot; target=&quot;_blank&quot;&gt;proxy settings&lt;/a&gt;&amp;nbsp;, before accessing the site from our browser.&lt;br /&gt;
&lt;br /&gt;
But if we want to verify the same functionality through automation , then we must know way using which we can modify the proxy server settings of browser . And here is the sample program to do that &amp;nbsp;:)&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class ProxySettings {
 
  WebDriver driver;
    String serverIP=199.201.125.147;
String port=199.201.125.147;   

@BeforeTest
    public void setUpDriver() {
    FirefoxProfile profile = new FirefoxProfile();
    profile.setPreference(&quot;network.proxy.type&quot;,1);
    profile.setPreference(&quot;network.proxy.ftp&quot;,serverIP);
    profile.setPreference(&quot;network.proxy.http&quot;,serverIP);
    profile.setPreference(&quot;network.proxy.socks&quot;,serverIP);
    profile.setPreference(&quot;network.proxy.ssl&quot;,serverIP);
    profile.setPreference(&quot;network.proxy.ftp_port&quot;,port);
    profile.setPreference(&quot;network.proxy.http_port&quot;,port);
    profile.setPreference(&quot;network.proxy.socks_port&quot;,port);
    profile.setPreference(&quot;network.proxy.ssl_port&quot;,port);
    driver = new FirefoxDriver(profile);
    }
   
   
   @Test
   public void start() throws IOException{
    driver.get(&quot;https://www.bwin.com/&quot;);
    driver.findElement(By.id(&quot;username&quot;)).sendKeys(&quot;MyUserName&quot;);
    driver.findElement(By.id(&quot;password&quot;)).sendKeys(&quot;MyTestPassword&quot;);
    driver.findElement(By.name(&quot;submit&quot;)).click();
   }
   

}
&lt;/pre&gt;
&lt;br /&gt;
And last but not the least &amp;nbsp;,&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #38761d; font-size: x-large;&quot;&gt;Advance Happy New Year ..!! Have fun :)&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/i&gt;&lt;/b&gt; &lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;</description><link>http://www.mythoughts.co.in/2013/12/configure-browser-proxy-settings-using.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrpSf7N78Aa6b3-LP0y1DjRBb_p8gH1R4UuKX7r_f_k3T_6y2VO6Xmdk1_1oJ0WWu5ow0dlIMUUkPYmP-K76GUaewmI_TfQEsFg-lyG-qifYAtwA2E47_BAKVApK-o6Kf2PvHwZ_eJOzih/s72-c/Bwin-India.png" height="72" width="72"/><thr:total>19</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-5691845562085116223</guid><pubDate>Wed, 27 Nov 2013 07:58:00 +0000</pubDate><atom:updated>2014-04-02T16:13:14.073+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">FirefoxDriver</category><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>Download a file using Selenium WebDriver with AutoIt Integration</title><description>&lt;meta name=&quot;Description&quot; content=&quot;Download a file using Selenium WebDriver with AutoIt Integration&quot; /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Selenium can not handle file downloading because browsers use native dialogs for downloading files which cannot be &lt;a href=&quot;http://docs.seleniumhq.org/docs/03_webdriver.jsp#how-does-webdriver-drive-the-browser-compared-to-selenium-rc&quot; target=&quot;_blank&quot;&gt;controlled by JavaScript&lt;/a&gt; .&lt;br /&gt;
&lt;br /&gt;
There are some third party tools using which we can automate download functionality.Some of the tools are &lt;a href=&quot;http://www.autoitscript.com/site/autoit/&quot; target=&quot;_blank&quot;&gt;AutoIt&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href=&quot;http://www.sikuli.org/&quot; target=&quot;_blank&quot;&gt;Sikuli&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
I have used AutoIt for downloading file . If you want to use AutoIt script in your selenium script then&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b&gt;Get an exe file of AutoIt script&lt;/b&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Call the exe file from Selenium script&amp;nbsp;&lt;/b&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;1. Get .exe file of AutoIt script :&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here is the AutoIt Script for downloading a &amp;nbsp;file from website.This script takes one parameter as an input i.e the exact location from where we would like to download the file .And the &amp;nbsp;output (downloaded file) will be stored at C:\Users\Public\Downloads.&lt;br /&gt;
&lt;br /&gt;
Save the below script with extension as Download.au3 and run it &amp;nbsp;then it will generate &amp;nbsp;Download.exe file&lt;br /&gt;
&lt;br /&gt;
You can also download the .exe format of script from &lt;a href=&quot;https://docs.google.com/file/d/0B00rtzEfza2uVWpoVEdWeVZLUGs/edit?usp=drive_web&quot; target=&quot;_blank&quot;&gt;here &lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;#comments-start
InetGet ( &quot;URL&quot; ,&quot;filename&quot; , options , background)

&amp;gt;&amp;gt;URL URL of the file to download. The URL parameter should be in the form &quot;http://www.somesite.com/path/file.html&quot; - just like an address you would type into your web browser.

&amp;gt;&amp;gt;filename [optional] Local filename to download to. 

&amp;gt;&amp;gt;options [optional] 
0 = (default) Get the file from local cache if available.
1 = Forces a reload from the remote site.
2 = Ignore all SSL errors (with HTTPS connections).
4 = Use ASCII when transfering files with the FTP protocol (Can not be combined with flag 8).
8 = Use BINARY when transfering files with the FTP protocol (Can not be combined with flag 4). This is the default transfer mode if none are provided.
16 = By-pass forcing the connection online (See remarks). 

&amp;gt;&amp;gt;background [optional] 
0 = (default) Wait until the download is complete before continuing.
1 = return immediately and download in the background (see remarks). 

#comments-end


;Exact location of WebSite from where we would like to download the file.We are reading url from commandline
$URL =$CmdLineRaw 

;Local address to which we would like to download the file 
$filename = &quot;C:\Users\Public\Downloads\Recognised_Student_Form.pdf&quot;

InetGet ($URL, $filename , 1, 0)
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
2&lt;b&gt;.Call the .exe file from Selenium script :&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
If you are using java then you can run the .exe file from your &amp;nbsp;selenium script using the below sample code:&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;&lt;br /&gt;
Runtime.getRuntime().exec(&quot;Path of autoIt exe file&quot;);&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&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/AVvXsEgjJ_QIasKBzPOJEPMzlOa5TliK53_KWZ-lchyMRKSK_BKaAYcjSplIem35RY2uir9ytsPvpiy8zoGbub2cVrUdKhxacK62vWwUpq8ZQACatVXLB8pIb-MTqokB7kA6uheNUZFtldfAcGfF/s1600/DownloadDialogue.jpg&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/AVvXsEgjJ_QIasKBzPOJEPMzlOa5TliK53_KWZ-lchyMRKSK_BKaAYcjSplIem35RY2uir9ytsPvpiy8zoGbub2cVrUdKhxacK62vWwUpq8ZQACatVXLB8pIb-MTqokB7kA6uheNUZFtldfAcGfF/s1600/DownloadDialogue.jpg&quot; height=&quot;339&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
Here is the Selenium code which will naviagte to the &lt;a href=&quot;http://www.ox.ac.uk/admissions/postgraduate_courses/apply/application_forms.html&quot; target=&quot;_blank&quot;&gt;Oxford Application&lt;/a&gt; form .Then it will download &amp;nbsp;&quot;&lt;i&gt;Recognised Student 2013/14 - Application Form (230 kb)&lt;/i&gt;&quot; file and save it at C:\Users\Public\Downloads with name as &quot;&lt;b&gt;Recognised_Student_Form.pdf&lt;/b&gt;&quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;import java.io.IOException;
import java.util.ArrayList;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class FileDownload {
 
 WebDriver driver;
  
  @BeforeTest
   public void setUpDriver() {
    driver = new FirefoxDriver();
   }
  
  @Test
  public void start() throws IOException{
   driver.get(&quot;http://www.ox.ac.uk/admissions/postgraduate_courses/apply/application_forms.html&quot;);
   
   //Get the downloadable file location from the site with link name as &quot;Recognised Student 2013/14 - Application Form (230 kb) &quot;
   String href=driver.findElement(By.xpath(&quot;.//*[@id=&#39;aapplications_for_recognised_student_status&#39;]/div/ul/li[1]/a&quot;)).getAttribute(&quot;href&quot;);
   
   //Framing the command string which includes two parameters
   //Parameter 1-  Location where the Download.exe file is located
   //Parameter 2 - file location which we have stored in &quot;href&quot; variable 
   String command=&quot;Location where Download.exe file is saved&quot;+&quot; &quot;+href;
   //If you happened to save Download.exe file  at &quot;Public downloads&quot; folder then command statement will be like 
      //String command=&quot;\&quot;C:/Users/Public/Documents/Download.exe\&quot;&quot;+&quot; &quot;+href;
   
      System.out.println(&quot;command is &quot;+command);
      ArrayList&lt;string&gt; argList = new ArrayList&lt;string&gt;();
      argList.add(href);
      
      //Running the windows command from Java
      Runtime.getRuntime().exec(command);     
  }
  }
&lt;/string&gt;&lt;/string&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;
If you would like to verify the pdf content then check this &lt;a href=&quot;http://www.mythoughts.co.in/2012/05/webdriverselenium2-extract-text-from.html#.UpWlp8QoEjA&quot;&gt;article &lt;/a&gt;&amp;nbsp;..!!&amp;nbsp;:)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</description><link>http://www.mythoughts.co.in/2013/11/download-file-using-selenium-webdriver.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjJ_QIasKBzPOJEPMzlOa5TliK53_KWZ-lchyMRKSK_BKaAYcjSplIem35RY2uir9ytsPvpiy8zoGbub2cVrUdKhxacK62vWwUpq8ZQACatVXLB8pIb-MTqokB7kA6uheNUZFtldfAcGfF/s72-c/DownloadDialogue.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-5614451749129773593</guid><pubDate>Fri, 04 Oct 2013 19:09:00 +0000</pubDate><atom:updated>2013-11-05T12:12:58.680+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">FirefoxDriver</category><category domain="http://www.blogger.com/atom/ns#">Java</category><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>Extract and Verify the text from image using Selenium WebDriver </title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Firstly WebDriver does not support the functionality of extracting text from an image , at least as of now &amp;nbsp;:) .&lt;br /&gt;
So if we would like to extract and verify text from an image then we should use &lt;a href=&quot;http://en.wikipedia.org/wiki/Optical_character_recognition&quot; target=&quot;_blank&quot;&gt;OCR (Optical Character Recognition)&lt;/a&gt; technology.&lt;br /&gt;
&lt;br /&gt;
Coming to OCR , here is one of the nice &lt;a href=&quot;http://www.makeuseof.com/tag/top-5-free-ocr-software-tools-to-convert-your-images-into-text-nb/&quot; target=&quot;_blank&quot;&gt;article &lt;/a&gt; , and it says :&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;OCR software extracts all the information from the image into easily editable text format.Optical character recognition (OCR) is a system of converting scanned printed/handwritten image files into its machine readable text format. OCR software works by analyzing a document and comparing it with fonts stored in its database and/or by noting features typical to characters.&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
There are good no.of free OCR software tools . If your preferred program is Java then you can use one of the Java OCR libraries to extract text from an image. I used &lt;a href=&quot;http://asprise.com/product/ocr/index.php?lang=java&quot; target=&quot;_blank&quot;&gt;ASPRISE OCR&lt;/a&gt; java library in this article. To work with&amp;nbsp;&amp;nbsp;ASPRISE OCR library , follow the below simple two steps.&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Download &quot;&lt;a href=&quot;http://asprise.com/product/ocr/download.php?lang=java&quot; target=&quot;_blank&quot;&gt;Asprise OCR&lt;/a&gt;&quot; libraries , depending on the operating system you are using .&lt;/li&gt;
&lt;li&gt;Unzip the downloaded &amp;nbsp;folder and add the &lt;b&gt;aspriseOCR &lt;/b&gt;jar file to&lt;a href=&quot;http://www.mythoughts.co.in/2012/08/webdriver-selenium-2-part-3-writing.html#.Uk67HFB9uSo&quot; target=&quot;_blank&quot;&gt; your working directory&lt;/a&gt;&amp;nbsp;. If you want you can download the single jar file from &lt;a href=&quot;https://docs.google.com/file/d/0B00rtzEfza2uVHdsNmhoWWlmRlU/edit?usp=drive_web&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&amp;nbsp;.&lt;/li&gt;
&lt;li&gt;Also Copy the &quot;AspriseOCR.dll&quot; file from unzipped downloaded folder and save it &amp;nbsp;under &quot;C:\Windows\System32&quot; .&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
Now you are ready to go &amp;nbsp;:P .&lt;br /&gt;
&lt;br /&gt;
Look at the below sample image .&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/AVvXsEgB6j3Yn6-LlRNqfQp1QvtINI0H9YbPfzY228Qmt72DdJhfy3h9ort0tySJcwdX9KVZGOzR8XHHrIIRo18_VpmMsn8LtZuYAn1ulTP48R2qZKtDIp3JNX5LlR8IAE0a2CC0GN4ZWXOy3qnV/s1600/love.jpg&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/AVvXsEgB6j3Yn6-LlRNqfQp1QvtINI0H9YbPfzY228Qmt72DdJhfy3h9ort0tySJcwdX9KVZGOzR8XHHrIIRo18_VpmMsn8LtZuYAn1ulTP48R2qZKtDIp3JNX5LlR8IAE0a2CC0GN4ZWXOy3qnV/s1600/love.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
And here is the sample code to read the text from above image :&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;import java.awt.Image;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.asprise.util.ocr.OCR;

public class ExtractImage {
 
 WebDriver driver;
 
 @BeforeTest
  public void setUpDriver() {
   driver = new FirefoxDriver();
  }
 
 @Test
 public void start() throws IOException{
   
 /*Navigate to http://www.mythoughts.co.in/2013/10/extract-and-verify-text-from-image.html page
  * and get the image source attribute
  *  
  */  
 driver.get(&quot;http://www.mythoughts.co.in/2013/10/extract-and-verify-text-from-image.html&quot;);
 String imageUrl=driver.findElement(By.xpath(&quot;//*[@id=&#39;post-body-5614451749129773593&#39;]/div[1]/div[1]/div/a/img&quot;)).getAttribute(&quot;src&quot;);
 System.out.println(&quot;Image source path : \n&quot;+ imageUrl);

 URL url = new URL(imageUrl);
 Image image = ImageIO.read(url);
 String s = new OCR().recognizeCharacters((RenderedImage) image);
 System.out.println(&quot;Text From Image : \n&quot;+ s);
 System.out.println(&quot;Length of total text : \n&quot;+ s.length());
 driver.quit();
    
 /* Use below code If you want to read image location from your hard disk   
  *   
   BufferedImage image = ImageIO.read(new File(&quot;Image location&quot;));   
   String imageText = new OCR().recognizeCharacters((RenderedImage) image);  
   System.out.println(&quot;Text From Image : \n&quot;+ imageText);  
   System.out.println(&quot;Length of total text : \n&quot;+ imageText.length());   
      
   */ 
}

}
&lt;/pre&gt;
&lt;br /&gt;
&lt;div&gt;
Here is the output of the above program:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
Image source path : &lt;br /&gt;
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgB6j3Yn6-LlRNqfQp1QvtINI0H9YbPfzY228Qmt72DdJhfy3h9ort0tySJcwdX9KVZGOzR8XHHrIIRo18_VpmMsn8LtZuYAn1ulTP48R2qZKtDIp3JNX5LlR8IAE0a2CC0GN4ZWXOy3qnV/s1600/love.jpg&lt;br /&gt;
&lt;br /&gt;
Never M2suse the O, ne&lt;br /&gt;
Who Likes You&lt;br /&gt;
Never Say Busy To Th,e One&lt;br /&gt;
Who Needs You&lt;br /&gt;
Never cheat The One&lt;br /&gt;
Who ReaZZy Trust You,&lt;br /&gt;
Never foJnget The One&lt;br /&gt;
Who  Zways Remember You.&lt;br /&gt;
&lt;br /&gt;
Length of total text : &lt;br /&gt;
175&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats for now. Have a great weekend ..!! :)&lt;br /&gt;
&lt;br /&gt;
Reference :&lt;br /&gt;
&lt;a href=&quot;http://asprise.com/product/ocr/javadoc/index.html&quot;&gt;http://asprise.com/product/ocr/javadoc/index.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://www.mythoughts.co.in/2013/10/extract-and-verify-text-from-image.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgB6j3Yn6-LlRNqfQp1QvtINI0H9YbPfzY228Qmt72DdJhfy3h9ort0tySJcwdX9KVZGOzR8XHHrIIRo18_VpmMsn8LtZuYAn1ulTP48R2qZKtDIp3JNX5LlR8IAE0a2CC0GN4ZWXOy3qnV/s72-c/love.jpg" height="72" width="72"/><thr:total>32</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-3697632758143252588</guid><pubDate>Sat, 21 Sep 2013 18:16:00 +0000</pubDate><atom:updated>2013-09-22T10:34:32.293+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Error Messages</category><category domain="http://www.blogger.com/atom/ns#">InternetExplorerDriver</category><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>org.openqa.selenium.remote.SessionNotFoundException:Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Sometimes when we are trying to&lt;a href=&quot;http://www.mythoughts.co.in/2012/05/starting-opera-browser-using.html#.UjIC8cYwcjw&quot; target=&quot;_blank&quot;&gt; load InternetExplorer from WebDriver&lt;/a&gt; we will get below error :&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
&lt;i&gt;org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (WARNING: The server did not provide any stacktrace information)&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt; &lt;i&gt;Command duration or timeout: 1.39 seconds&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Build info: version: &#39;2.34.0&#39;, revision: &#39;11cd0ef&#39;, time: &#39;2013-08-06 17:11:28&#39;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;System info: os.name: &#39;Windows 8&#39;, os.arch: &#39;amd64&#39;, os.version: &#39;6.2&#39;, java.version: &#39;1.7.0_09&#39;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;Driver info: org.openqa.selenium.ie.InternetExplorerDriver&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;
&lt;/i&gt; &lt;/code&gt;&lt;br /&gt;
This error is because of the security settings in IE. There is a permanent fix to this. :P&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; Open IE , then go to Tools&amp;gt;&amp;gt;Security tab .&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;Now either check or uncheck the &quot;Enable Protected Mode&quot; checkbox for all zones i.e Internet , Local internet, Trusted Sites, Restricted Sites.&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/AVvXsEim7YO0xkPPh2Hub8r8JiyoU6Bgc_4dzPPQI4SpFjuXa9ZGedixZD6RFz7U05LpF-VjlJluYau7HWEzUX_Lc3u8IwNNdnivXKCDk7_oa3iSpXSyajAteOTxRaVsgMu6fCb4Xr5I3XVejfmA/s1600/Enable+Protected+Mode.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/AVvXsEim7YO0xkPPh2Hub8r8JiyoU6Bgc_4dzPPQI4SpFjuXa9ZGedixZD6RFz7U05LpF-VjlJluYau7HWEzUX_Lc3u8IwNNdnivXKCDk7_oa3iSpXSyajAteOTxRaVsgMu6fCb4Xr5I3XVejfmA/s1600/Enable+Protected+Mode.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
We are done . Now start&lt;a href=&quot;http://www.mythoughts.co.in/2012/05/starting-opera-browser-using.html#.UjIC8cYwcjw&quot; target=&quot;_blank&quot;&gt; running your script&lt;/a&gt; , it will go great &amp;nbsp;without any issues :)&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://www.mythoughts.co.in/2013/09/orgopenqaseleniumremotesessionnotfounde.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEim7YO0xkPPh2Hub8r8JiyoU6Bgc_4dzPPQI4SpFjuXa9ZGedixZD6RFz7U05LpF-VjlJluYau7HWEzUX_Lc3u8IwNNdnivXKCDk7_oa3iSpXSyajAteOTxRaVsgMu6fCb4Xr5I3XVejfmA/s72-c/Enable+Protected+Mode.png" height="72" width="72"/><thr:total>9</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-1955980458341596253</guid><pubDate>Wed, 11 Sep 2013 19:32:00 +0000</pubDate><atom:updated>2013-09-12T01:02:27.709+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">ChromeDriver</category><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>Seleinum Webdriver - Loading chrome browser with default extension</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
When we start &lt;a href=&quot;http://www.mythoughts.co.in/2012/05/starting-chrome-browser-using.html&quot; target=&quot;_blank&quot;&gt;chrome browser using webdriver &lt;/a&gt;then by default it will load with out any extensions. But we can also load chrome browser with some default extensions if we need . To do this we need to know .crx file path of chrome extension. Here are the steps to find out the .crx file path :&lt;br /&gt;
&lt;br /&gt;
1.Open chrome browser and type&amp;nbsp;&lt;a href=&quot;chrome://extensions/&quot;&gt;chrome://extensions/&lt;/a&gt;&amp;nbsp;. Now note down the extension id that you would like to be loaded when your browser starts.&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/AVvXsEjDYfr0coiRm709esNTWZF7rcY0AIdAqI3KweFyV6VuB6divS4Jgj_nhk0w1I2RmmicofWdoIahdwom8DOdQjh4hfv-z9NgauPB0_O-EZ0S0vfHEuBgqPnI5JDPaUzF9-633PsXdd381VNu/s1600/ExtensionID.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/AVvXsEjDYfr0coiRm709esNTWZF7rcY0AIdAqI3KweFyV6VuB6divS4Jgj_nhk0w1I2RmmicofWdoIahdwom8DOdQjh4hfv-z9NgauPB0_O-EZ0S0vfHEuBgqPnI5JDPaUzF9-633PsXdd381VNu/s1600/ExtensionID.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
2.Check the &quot;Developer Mode&quot; checkbox.Now you will see &quot;Pack Extension&quot; button .&lt;br /&gt;
&lt;br /&gt;
3.Go to&lt;a href=&quot;http://www.chromium.org/user-experience/user-data-directory&quot; target=&quot;_blank&quot;&gt;&amp;nbsp;Extenstion folder of chrome&lt;/a&gt;&amp;nbsp;.You will see the list of other folders with unique id&#39;s. Go to folder with the id , which you got in Step 1. Go deep into the folder until you find the manifest.json file and then copy the location .&lt;br /&gt;
3.Click on &quot;Pack Extension&quot; button and enter the path of folder in which extension manifest.json file is located.&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/AVvXsEgmC4dh3KioXzPHuq6_kISIgo2wNsEMPDkCETOEvInLKMWRlH3mvLEauy3FJHd9H3_ohD_zrG_UrxZz5amkFCaSVJmwwc6FNNGNTeHckp84GkoB6Gc_4_aWgOa4K6SLbk1rFeLrzOWb1D_i/s1600/PackExtension+-+Copy.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/AVvXsEgmC4dh3KioXzPHuq6_kISIgo2wNsEMPDkCETOEvInLKMWRlH3mvLEauy3FJHd9H3_ohD_zrG_UrxZz5amkFCaSVJmwwc6FNNGNTeHckp84GkoB6Gc_4_aWgOa4K6SLbk1rFeLrzOWb1D_i/s1600/PackExtension+-+Copy.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;Click on Pack Extension button.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
4.We will get confirmation alert which displays the path of .crx file of extension. Copy that path and use it in your 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/AVvXsEjC48SWyvMwfKL62hKOs3NYaxNc9RE0e9ILAc7btzW8hN4cK6Ke67j47sys5e8wDqQH7NZ8sZoYmE6Fokv83HPxHF0fo0m80d5PzNt_k7vKoeyHDK-OR0ckemlX9CKrfbbSwHGWdF1UJLpN/s1600/Package.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/AVvXsEjC48SWyvMwfKL62hKOs3NYaxNc9RE0e9ILAc7btzW8hN4cK6Ke67j47sys5e8wDqQH7NZ8sZoYmE6Fokv83HPxHF0fo0m80d5PzNt_k7vKoeyHDK-OR0ckemlX9CKrfbbSwHGWdF1UJLpN/s1600/Package.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Thats it. Now we are done with the .crx file path . Use that path in the below code to load chrome browser with the default extension.&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;import java.io.File;
	import org.openqa.selenium.WebDriver;
	import org.openqa.selenium.chrome.ChromeDriver;
	import org.openqa.selenium.chrome.ChromeOptions;
    import org.testng.annotations.Test;

	@Test
	public class Chrome {

		WebDriver  driver;  
		
		public void start(){	
			ChromeOptions options = new ChromeOptions();		
			options.addArguments(&quot;start-maximized&quot;);
			options.addExtensions(new File(&quot;CRX FILE PATH&quot;));
			System.setProperty(&quot;webdriver.chrome.driver&quot;,&quot;PATH of chromedriver.exe&quot;);
			ChromeDriver driver = new ChromeDriver(options);
                        driver.get(&quot;http://mythoughts.co.in&quot;);		
		}
}
&lt;/pre&gt;
&lt;br /&gt;
Referenes:&lt;br /&gt;
&lt;a href=&quot;http://developer.chrome.com/extensions/packaging.html&quot; target=&quot;_blank&quot;&gt;http://developer.chrome.com/extensions/packaging.html&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.chromium.org/user-experience/user-data-directory&quot;&gt;http://www.chromium.org/user-experience/user-data-directory&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://www.mythoughts.co.in/2013/09/seleinum-webdriver-loading-chrome.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDYfr0coiRm709esNTWZF7rcY0AIdAqI3KweFyV6VuB6divS4Jgj_nhk0w1I2RmmicofWdoIahdwom8DOdQjh4hfv-z9NgauPB0_O-EZ0S0vfHEuBgqPnI5JDPaUzF9-633PsXdd381VNu/s72-c/ExtensionID.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-482860082588354882</guid><pubDate>Fri, 12 Jul 2013 20:14:00 +0000</pubDate><atom:updated>2013-07-13T01:44:51.378+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>Verifying ToolTip information by enabling javascript in browser </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;br /&gt;
These days most of websites are using the &lt;a href=&quot;http://en.wikipedia.org/wiki/Tooltip&quot; target=&quot;_blank&quot;&gt;ToolTip&lt;/a&gt;&amp;nbsp;to provide information to end user.&lt;br /&gt;
&lt;br /&gt;
ToolTip(also known as ScrrenTip) will be visible to the user whenever he/she mouseovers on specific object and it just displays information about the&amp;nbsp;object(button,textbox,link,image etc..).&lt;br /&gt;
&lt;br /&gt;
These tooltips works only when javascript is enabled.&lt;br /&gt;
&lt;br /&gt;
So automating tooltip involves :&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&amp;nbsp;Verifying that tooltip presents when we mouse over on specific object&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;Verifying that the text that present in the tooltip is correct.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
In this &lt;a href=&quot;http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/&quot; target=&quot;_blank&quot;&gt;site &lt;/a&gt;&amp;nbsp;if you mouse over on &quot;Download&quot; link we will see a tooltip.&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/AVvXsEh7y3klMfmgGveeheiGq-pJb1zObUxf_ebjErxVgRtsA6x6DAHP8OsSH3KTb3RRdWRNXFztvTz21JL8mo40pZ2z0Uu0vk-cW8Isav-yGoCd-NP1-PIPnDZlBGvTvwH_vhXVUmqg5wwft_3u/s1600/ToolTip.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;ToolTip Screenshot&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7y3klMfmgGveeheiGq-pJb1zObUxf_ebjErxVgRtsA6x6DAHP8OsSH3KTb3RRdWRNXFztvTz21JL8mo40pZ2z0Uu0vk-cW8Isav-yGoCd-NP1-PIPnDZlBGvTvwH_vhXVUmqg5wwft_3u/s1600/ToolTip.jpg&quot; height=&quot;147&quot; title=&quot;ToolTip Screenshot&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the program which will check the existence of tooltip and also the text present in the tooltip. In this program I have used HtmlDriver because it provides inbuilt methods for enabling and disabling of javascript.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;

public class HTMLdriver {
 public static void main(String args[]){
 
 HtmlUnitDriver driver = new HtmlUnitDriver();
 driver.setJavascriptEnabled(true);
 driver.get(&quot;http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/&quot;);
 WebElement element=driver.findElement(By.linkText(&quot;Download&quot;));
 Actions builder = new Actions(driver);  // Configure the Action  
 Action mouseOver =builder.moveToElement(element).build(); // Get the action  
 mouseOver.perform(); // Execute the Action 
   if(driver.findElement(By.id(&quot;tooltip&quot;)).isDisplayed()){
    System.out.println(&quot;Tooltip is coming up fine&quot;);
    System.out.println(&quot;Here is the tool tip text : &quot;+driver.findElement(By.id(&quot;tooltip&quot;)).getText());
   }else{
    System.out.println(&quot;There is no Tool tip text&quot;);
   }

 }
}
&lt;/pre&gt;
&lt;br /&gt;
If you want to check the correctness of the program then disable javascript and run the program.In this case script will fail as tooltip failed to appear when we mouseover on Download link.&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;driver.setJavascriptEnabled(false);&lt;/pre&gt;
&lt;/div&gt;
</description><link>http://www.mythoughts.co.in/2013/07/verifying-tooltip-information-by.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7y3klMfmgGveeheiGq-pJb1zObUxf_ebjErxVgRtsA6x6DAHP8OsSH3KTb3RRdWRNXFztvTz21JL8mo40pZ2z0Uu0vk-cW8Isav-yGoCd-NP1-PIPnDZlBGvTvwH_vhXVUmqg5wwft_3u/s72-c/ToolTip.jpg" height="72" width="72"/><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-5608931519450525639</guid><pubDate>Mon, 08 Apr 2013 19:20:00 +0000</pubDate><atom:updated>2013-10-21T16:20:05.705+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">FirefoxDriver</category><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>Selecting a date from Datepicker using Selenium WebDriver</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;br /&gt;
Calendars&amp;nbsp;look pretty and&amp;nbsp;of course&amp;nbsp;they are fancy too.So now a days most of the websites are using advanced &lt;a href=&quot;http://calendars%20look%20pretty%20and%20of%20course%20they%20are%20fancy%20too/&quot; target=&quot;_blank&quot;&gt;jQuery Datepickers&lt;/a&gt; instead of displaying individual dropdowns for month,day,year.&amp;nbsp;:P&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/AVvXsEhBSjg0g_2ywg2uvb9-TN3XXc8sqipT-UgZ1E103x6q6yyka6YtLsJi-DSppCv1GwvVn861E4GFxcdfGwJ8pC91TJAzpK8NK4SjAZP8lbsxLvwPjYf09Ayy4nIXKnzldgNbvGPx_WqTNyIb/s1600/DatePiker.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Datepicker&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBSjg0g_2ywg2uvb9-TN3XXc8sqipT-UgZ1E103x6q6yyka6YtLsJi-DSppCv1GwvVn861E4GFxcdfGwJ8pC91TJAzpK8NK4SjAZP8lbsxLvwPjYf09Ayy4nIXKnzldgNbvGPx_WqTNyIb/s1600/DatePiker.jpg&quot; height=&quot;320&quot; title=&quot;Datepicker&quot; width=&quot;316&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
If we look at the Datepicker, it is just a like a table with set of rows and columns.To select a date ,we just have to navigate to the cell where our desired date is&amp;nbsp;present.&lt;br /&gt;
&lt;br /&gt;
Here is a sample code on how to pick a 13th date from the next month.&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;import java.util.List;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;;

public class DatePicker {

 WebDriver driver;
 
 @BeforeTest
 public void start(){
 System.setProperty(&quot;webdriver.firefox.bin&quot;, &quot;C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe&quot;);  
 driver = new FirefoxDriver();
 }
 
 @Test
 public void Test(){
 
  driver.get(&quot;http://jqueryui.com/datepicker/&quot;);
  driver.switchTo().frame(0);
  driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
  //Click on textbox so that datepicker will come
  driver.findElement(By.id(&quot;datepicker&quot;)).click();
  driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
  //Click on next so that we will be in next month
  driver.findElement(By.xpath(&quot;.//*[@id=&#39;ui-datepicker-div&#39;]/div/a[2]/span&quot;)).click();
  
  /*DatePicker is a table.So navigate to each cell 
   * If a particular cell matches value 13 then select it
   */
  WebElement dateWidget = driver.findElement(By.id(&quot;ui-datepicker-div&quot;));
  List&lt;webelement&gt; rows=dateWidget.findElements(By.tagName(&quot;tr&quot;));
  List&lt;webelement&gt; columns=dateWidget.findElements(By.tagName(&quot;td&quot;));
  
  for (WebElement cell: columns){
   //Select 13th Date 
   if (cell.getText().equals(&quot;13&quot;)){
   cell.findElement(By.linkText(&quot;13&quot;)).click();
   break;
   }
  } 
 }
}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</description><link>http://www.mythoughts.co.in/2013/04/selecting-date-from-datepicker-using.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBSjg0g_2ywg2uvb9-TN3XXc8sqipT-UgZ1E103x6q6yyka6YtLsJi-DSppCv1GwvVn861E4GFxcdfGwJ8pC91TJAzpK8NK4SjAZP8lbsxLvwPjYf09Ayy4nIXKnzldgNbvGPx_WqTNyIb/s72-c/DatePiker.jpg" height="72" width="72"/><thr:total>22</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-2841811663085549479</guid><pubDate>Tue, 05 Mar 2013 17:58:00 +0000</pubDate><atom:updated>2013-09-12T23:51:36.276+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Error Messages</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
If you running webdriver scripts on &lt;a href=&quot;http://windows.microsoft.com/en-us/windows-8/meet&quot; target=&quot;_blank&quot;&gt;Windows 8&lt;/a&gt; then the below error is the first one you will encounter. Atleast it happened for me :) .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: WIN8&lt;br /&gt;
Build info: version: &#39;2.31.0&#39;, revision: &#39;1bd294d&#39;, time: &#39;2013-02-27 20:53:56&#39;&lt;br /&gt;
System info: os.name: &#39;Windows 8&#39;, os.arch: &#39;amd64&#39;, os.version: &#39;6.2&#39;, java.version: &#39;1.7.0_09&#39;&lt;br /&gt;
Driver info: driver.version: FirefoxDriver&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The solution to the above problem is to specify the location of firefox in your script .&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;System.setProperty(&quot;webdriver.firefox.bin&quot;, &quot;C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe&quot;);

&lt;/pre&gt;
Here is my modified script.And it went through without any errors :)&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class FacebookRegistration {

WebDriver driver;
 
 @BeforeTest
 public void start(){
  System.setProperty(&quot;webdriver.firefox.bin&quot;, &quot;C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe&quot;);
  driver = new FirefoxDriver();
 }
 

 @Test
 public void run(){
  driver.get(&quot;http://facebook.com&quot;);
 }
}

&lt;/pre&gt;
&lt;/div&gt;
</description><link>http://www.mythoughts.co.in/2013/03/orgopenqaseleniumwebdriverexception.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-8782001173948380111</guid><pubDate>Sat, 02 Feb 2013 07:47:00 +0000</pubDate><atom:updated>2013-02-02T13:20:08.326+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>Executing javascript using Selenium WebDriver</title><description>Using webdriver sometimes we need to run javascript code dircetly from our script.&lt;br /&gt;
&lt;br /&gt;
In one of the previous post we have discussed &lt;a href=&quot;http://www.mythoughts.co.in/2012/11/automatingbreaking-captcha-using.html#.UQy_fr-TyjA&quot;&gt;how to break catcha on webpage&lt;/a&gt;&amp;nbsp;. To break captcha we need to run javascript code directly from our script .So it is important to know how to run javacript code using WebDriver. Here are the steps:&lt;br /&gt;
&lt;br /&gt;
1.Cast the WebDrier instance to a&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/JavascriptExecutor.html&quot; target=&quot;_blank&quot;&gt;JavascriptExecutor&lt;/a&gt;&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;WebDriver driver;
JavascriptExecutor js = (JavascriptExecutor) driver;&lt;/pre&gt;
2.Use&amp;nbsp;executeScript method to run the script&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;js.executeScript(&quot;return document.title&quot;);&lt;/pre&gt;
Here is the sample script using TestNG.&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;import java.util.ArrayList;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Reporter;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class ExecuteJavascript {
	
 WebDriver driver;

 @BeforeTest
 public void start(){
  driver = new FirefoxDriver();
 }
 
 @Test
 public void javaScriptExec(){
  
  driver.get(&quot;http://duckduckgo.com/&quot;);
  JavascriptExecutor js=(JavascriptExecutor) driver;
  
  String readyState=(String)js.executeScript(&quot;return document.readyState&quot;);
  System.out.println(&quot;readyState  : &quot;+readyState);

  String title=(String)js.executeScript(&quot;return document.title&quot;);
  System.out.println(&quot;title  : &quot;+title);
		  
  String domain=(String)js.executeScript(&quot;return document.domain&quot;);
  System.out.println(&quot;domain  : &quot;+domain);
		  
  
  String lastModified=(String)js.executeScript(&quot;return document.lastModified&quot;);
  System.out.println(&quot;lastModified  : &quot;+lastModified);
		  
  String URL=(String)js.executeScript(&quot;return document.URL&quot;);
  System.out.println(&quot;Full URL  : &quot;+URL);

 String error=(String) ((JavascriptExecutor) driver).executeScript(&quot;return window.jsErrors&quot;);
  System.out.println(&quot;Windows js errors  :   &quot;+error);
		   
   }

@AfterTest
 public void stop(){
 driver.quit();
 }

}
&lt;/pre&gt;
If you &lt;a href=&quot;http://www.mythoughts.co.in/2012/08/webdriver-selenium-2-part-3-writing.html#.UQzFGL-TyjA&quot;&gt;run &lt;/a&gt;the above program then the output will come like below :&lt;br /&gt;
&lt;br /&gt;
readyState &amp;nbsp;: complete&lt;br /&gt;
title &amp;nbsp;: DuckDuckGo&lt;br /&gt;
domain &amp;nbsp;: duckduckgo.com&lt;br /&gt;
lastModified &amp;nbsp;: 02/02/2013 13:11:42&lt;br /&gt;
Full URL &amp;nbsp;: https://duckduckgo.com/&lt;br /&gt;
Windows js errors &amp;nbsp;: &amp;nbsp; null&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Reference :&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://code.google.com/p/selenium/wiki/WebDriverJs#Getting_Started&quot; target=&quot;_blank&quot;&gt;http://code.google.com/p/selenium/wiki/WebDriverJs#Getting_Started&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://code.google.com/p/selenium/wiki/FrequentlyAskedQuestions#Q:_How_do_I_execute_Javascript_directly?&quot; target=&quot;_blank&quot;&gt;http://code.google.com/p/selenium/wiki/FrequentlyAskedQuestions#Q:_How_do_I_execute_Javascript_directly?&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/JavascriptExecutor.html&quot; target=&quot;_blank&quot;&gt;http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/JavascriptExecutor.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description><link>http://www.mythoughts.co.in/2013/02/executing-javascript-using-selenium.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>8</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-1964676982415240903</guid><pubDate>Sat, 05 Jan 2013 16:34:00 +0000</pubDate><atom:updated>2013-02-02T01:53:00.832+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>Maximize browser window using webdriver</title><description>&lt;br /&gt;
There are times when we want to to maximize the browser window during the execution of our script .For this purpose webdriver providers a built-in method and here is the syntax :&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;WebDriver driver;
driver.manage().window().maximize();

&lt;/pre&gt;
Here is the sample code using TestNG framework. :&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;import java.awt.Toolkit;
import java.io.IOException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Reporter;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class MaximizeWindow {

WebDriver driver;

@BeforeTest
public void setUpDriver() {
driver = new FirefoxDriver();
      }
  

@Test
public void maximize() {
 //declare varibales for windows
org.openqa.selenium.Dimension defaultDim;
org.openqa.selenium.Dimension maximizeDim;
//Load google website on browser
driver.get(&quot;http://google.com&quot;);
//Display the current screen dimensions
defaultDim=driver.manage().window().getSize();
System.out.println(&quot;screenHeight before maximizing&quot;+defaultDim.getHeight());
System.out.println(&quot;screenWidth before maximizing&quot;+defaultDim.getWidth());
//maximize the window using webdriver method
driver.manage().window().maximize();
//Display the maximized window dimensions
maximizeDim=driver.manage().window().getSize();
System.out.println(&quot;screenHeight after maximizing:&quot;+maximizeDim.getHeight());
System.out.println(&quot;screenWidth after maximizing:&quot;+maximizeDim.getWidth());

      }


  }&lt;/pre&gt;
Last but not the least&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;/b&gt; &lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;Belated Happy New Year All..!!&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/i&gt;&lt;/b&gt; &lt;b&gt;&lt;i&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;Have fun..!! :)&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
</description><link>http://www.mythoughts.co.in/2013/01/maximize-browser-window-using-webdriver.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-6835468116592839881</guid><pubDate>Sun, 16 Dec 2012 07:44:00 +0000</pubDate><atom:updated>2012-12-16T13:15:39.276+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>Sending special characters and key events to WebDriver using sendKeys() method</title><description>There are times at which we would like to send special characters (Enter , F5, Ctrl, Alt etc..) to webdriver from our script. This can be done by using sendKeys method itself. For this purpose we will use the &lt;a href=&quot;http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/Keys.html&quot;&gt;Keys &lt;/a&gt;&amp;nbsp;method as parameter to the sendKeys method.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Syntax :&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;//Sending F5 key
driver.findElement(By.id(&quot;name&quot;)).sendKeys(Keys.F5);

//Sending arrow down key 
driver.findElement(By.id(&quot;name&quot;)).sendKeys(Keys.ARROW_DOWN);

//sending pagedown key from keyboard
driver.findElement(By.id(&quot;name&quot;)).sendKeys(Keys.PAGE_DOWN);

//sending space key 
driver.findElement(By.id(&quot;name&quot;)).sendKeys(Keys.SPACE);

//sending tab key
driver.findElement(By.id(&quot;name&quot;)).sendKeys(Keys.TAB);

//sending alt key
driver.findElement(By.id(&quot;name&quot;)).sendKeys(Keys.ALT);
&lt;/pre&gt;
We can also send the pressable keys as &lt;a href=&quot;http://www.w3.org/TR/2012/WD-webdriver-20120710/#typing-keys&quot;&gt;Unicode PUA(Privtae User Area) &lt;/a&gt;&amp;nbsp;format&amp;nbsp;. So the above samples can be rewritten as below :&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;sendKeys(Keys.F5) == sendKeys(&quot;\uE035&quot;)

sendKeys(Keys.PAGE_DOWN) == sendKeys(&quot;\uE00F&quot;)

sendKeys(Keys.ARROW_DOWN) == sendKeys(&quot;\uE015&quot;)

sendKeys(Keys.SPACE) == sendKeys(&quot;\uE00D&quot;)

sendKeys(Keys.TAB) == sendKeys(&quot;\uE004&quot;)

sendKeys(Keys.ALT) == sendKeys(&quot;\uE00A&quot;)&lt;/pre&gt;
Here is the sample program for logging into&lt;a href=&quot;https://www.facebook.com/&quot;&gt; Facebook&lt;/a&gt;&amp;nbsp;:&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class Sendkeys {
 
WebDriver driver;
 
@BeforeTest
 public void start(){
  driver = new FirefoxDriver();
 }

@Test
public void sendkeysmethod(){
 //Load facebook login page
 driver.get(&quot;https://facebook.com&quot;);
 
 //Refresh the page 
 //We can also refresh like below 
 //driver.findElement(By.name(&quot;email&quot;)).sendKeys(&quot;\uE035&quot;)
 driver.findElement(By.name(&quot;email&quot;)).sendKeys(Keys.F5);
 
 //Fillup Emailadress and Password fields
 driver.findElement(By.name(&quot;email&quot;)).sendKeys(&quot;EmailAddress&quot;);
 driver.findElement(By.name(&quot;pass&quot;)).sendKeys(&quot;password&quot;);
 
 //Sending Enter key so that facebook login credentials will be authenticated
 driver.findElement(By.name(&quot;pass&quot;)).sendKeys(Keys.ENTER);
 
    }
}

&lt;/pre&gt;
&lt;b&gt;Reference :&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt; &lt;a href=&quot;http://www.w3.org/TR/2012/WD-webdriver-20120710/#typing-keys&quot;&gt;http://www.w3.org/TR/2012/WD-webdriver-20120710/#typing-keys&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://code.google.com/p/selenium/wiki/GettingStarted&quot;&gt;http://code.google.com/p/selenium/wiki/GettingStarted&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/Keys.html&quot;&gt;http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/Keys.html&lt;/a&gt;&lt;/div&gt;
</description><link>http://www.mythoughts.co.in/2012/12/sending-special-characters-and-key.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-3153983639391356008</guid><pubDate>Sun, 25 Nov 2012 19:21:00 +0000</pubDate><atom:updated>2012-11-26T01:09:25.139+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>Automating(Breaking) captcha using Selenium Webdriver</title><description>Usually most of the companies either use their own captchas or one of the third party captchas(&lt;a href=&quot;http://www.google.com/recaptcha/captcha&quot;&gt;Google&lt;/a&gt;,&amp;nbsp;&lt;a href=&quot;http://www.sound-decisions.ca/the-test-bed/jquery-s3-capcha.php?r=s&quot;&gt;jQuery plugins&lt;/a&gt;) in the user registration page of their sites .So these pages can&#39;t be automated fully.Infact&amp;nbsp;&lt;a href=&quot;http://www.captcha.net/&quot;&gt;Captcha&lt;/a&gt;&amp;nbsp;itself is implemented to prevent automation.&amp;nbsp;As per official captcha site&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 12px; line-height: 18px;&quot;&gt;&lt;i&gt;A CAPTCHA is a program that &amp;nbsp;protects &amp;nbsp;websites against &lt;a href=&quot;http://en.wikipedia.org/wiki/Internet_bot&quot;&gt;bots &lt;/a&gt;&amp;nbsp;by generating and grading tests that humans can pass but current computer programs cannot.&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 12px; line-height: 18px;&quot;&gt;&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;Captchas are not brakeable but there are some third party captchas that can be breakable and one of the example for it is &quot;jQuery Real Person&quot; captcha . Here is the &lt;a href=&quot;http://www.exploit-db.com/exploits/18167/&quot;&gt;documentation&amp;nbsp;&lt;/a&gt;&amp;nbsp;:)&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/AVvXsEin63ZzEV3tXvA1zmSsszZjBt_94yIiDWIJcZG7HC7zsEQ4xugrg_thZa-uIYGflTfObzTzCOsJwID2ZCimRM-6-PeRFobjBd0dsDhyA_Jll6LJamqLkDtHdEUlvGjRH6Tdg27OSJZErEVj/s1600/Vamshi+Kurra-Real+Person+captcha.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Vamshi Kurra- Real Person Captcha&quot; border=&quot;0&quot; height=&quot;108&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin63ZzEV3tXvA1zmSsszZjBt_94yIiDWIJcZG7HC7zsEQ4xugrg_thZa-uIYGflTfObzTzCOsJwID2ZCimRM-6-PeRFobjBd0dsDhyA_Jll6LJamqLkDtHdEUlvGjRH6Tdg27OSJZErEVj/s400/Vamshi+Kurra-Real+Person+captcha.png&quot; title=&quot;jQuery Real Person Captcha&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the sample code to brake the &quot;jQuery Real Person&quot; Captcha using Selenium WebDriver.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class captchaAutomtion { 
 
 WebDriver driver;
 
 @BeforeTest
 public void start(){
  driver = new FirefoxDriver();
 }
 
 @Test
 public void Test(){ 
  //Loading jQuery Real Person Captcha demonstration page
  driver.get(&quot;http://keith-wood.name/realPerson.html&quot;);
  JavascriptExecutor js = (JavascriptExecutor) driver;
  //Setting the captcha values
  js.executeScript(&quot;document.getElementsByName(&#39;defaultRealHash&#39;)[0].setAttribute(&#39;value&#39;, &#39;-897204064&#39;)&quot;);
  driver.findElement(By.name(&quot;defaultReal&quot;)).sendKeys(&quot;QNXCUL&quot;);
  //Submit the form
  driver.findElement(By.xpath(&quot;.//*[@id=&#39;default&#39;]/form/p[2]/input&quot;)).submit(); 
 }

}
&lt;/pre&gt;
&lt;br /&gt;
Do share some of the captcha plugins that can be breakable with me :P</description><link>http://www.mythoughts.co.in/2012/11/automatingbreaking-captcha-using.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin63ZzEV3tXvA1zmSsszZjBt_94yIiDWIJcZG7HC7zsEQ4xugrg_thZa-uIYGflTfObzTzCOsJwID2ZCimRM-6-PeRFobjBd0dsDhyA_Jll6LJamqLkDtHdEUlvGjRH6Tdg27OSJZErEVj/s72-c/Vamshi+Kurra-Real+Person+captcha.png" height="72" width="72"/><thr:total>31</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-3394877880689370821</guid><pubDate>Sun, 25 Nov 2012 18:45:00 +0000</pubDate><atom:updated>2012-11-26T00:17:07.420+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">TestNG</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms</title><description>&amp;nbsp;I am using selenium 2.24 jar files.But today , I got below errors when I ran one of my sample script.&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
*** LOG addons.manager: Application has been upgraded
*** LOG addons.xpi: startup
*** LOG addons.xpi: Skipping unavailable install location app-system-local
*** LOG addons.xpi: Skipping unavailable install location app-system-share
*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: C:\Users\vkurra\AppData\Local\Temp\anonymous4553384920216924839webdriver-profile\extensions\webdriver-staging
*** LOG addons.xpi: checkForChanges
*** LOG addons.xpi-utils: Opening database
*** LOG addons.xpi-utils: Creating database schema
*** LOG addons.xpi: New add-on fxdriver@googlecode.com installed in app-profile
*** LOG addons.xpi: New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global
*** LOG addons.xpi: Updating database with changes to installed add-ons
*** LOG addons.xpi-utils: Updating add-on states
*** LOG addons.xpi-utils: Writing add-ons list
*** LOG addons.xpi: shutdown
*** LOG addons.xpi-utils: shutdown
*** LOG addons.xpi-utils: Database closed
*** LOG addons.xpi: startup
*** LOG addons.xpi: Skipping unavailable install location app-system-local
*** LOG addons.xpi: Skipping unavailable install location app-system-share
*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on ID: C:\Users\vkurra\AppData\Local\Temp\anonymous4553384920216924839webdriver-profile\extensions\webdriver-staging
*** LOG addons.xpi: checkForChanges
*** LOG addons.xpi: No changes found
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Immidiate thing I have done is , &lt;b&gt;selenium jars updation&lt;/b&gt;. I have &lt;a href=&quot;http://seleniumhq.org/download/&quot;&gt;downloaded &lt;/a&gt;latest selenium 2.25 jars and added them to my project buildpath. Now things are going smooth :)&lt;br /&gt;
&lt;br /&gt;</description><link>http://www.mythoughts.co.in/2012/11/orgopenqaseleniumfirefoxnotconnectedexc.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>10</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-107648466676681826</guid><pubDate>Sat, 17 Nov 2012 04:30:00 +0000</pubDate><atom:updated>2012-11-24T00:24:43.318+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>5 different ways to refresh a webpage using Selenium Webdriver</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;
Here are the 5 different ways, using which we can refresh a webpage.There might be even more :)&lt;br /&gt;
&lt;br /&gt;
There is no special extra coding. I have just used the existing functions in different ways to get it work.&amp;nbsp;Here they are :&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;1.Using sendKeys.Keys method&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;driver.get(&quot;https://accounts.google.com/SignUp&quot;);
driver.findElement(By.id(&quot;firstname-placeholder&quot;)).sendKeys(Keys.F5);&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;2.Using navigate.refresh() &amp;nbsp;method&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;driver.get(&quot;https://accounts.google.com/SignUp&quot;);  
driver.navigate().refresh();&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;3.Using navigate.to() method&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;driver.get(&quot;https://accounts.google.com/SignUp&quot;);  
driver.navigate().to(driver.getCurrentUrl());&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;4.Using get() method&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;driver.get(&quot;https://accounts.google.com/SignUp&quot;);  
driver.get(driver.getCurrentUrl());&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;5.Using sendKeys() method&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;driver.get(&quot;https://accounts.google.com/SignUp&quot;); 
driver.findElement(By.id(&quot;firstname-placeholder&quot;)).sendKeys(&quot;\uE035&quot;);&lt;/pre&gt;
&lt;br /&gt;
See you in next post.&lt;br /&gt;
&lt;br /&gt;
Have a great weekend..!!&lt;/div&gt;
</description><link>http://www.mythoughts.co.in/2012/11/5-different-ways-to-refresh-webpage.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-5177431162353657243</guid><pubDate>Tue, 13 Nov 2012 06:06:00 +0000</pubDate><atom:updated>2012-11-13T11:36:35.810+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Personal</category><category domain="http://www.blogger.com/atom/ns#">Thoughts on Life</category><title>Happy Diwali all..!! </title><description>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;May all your happiness light up and sorrows burn out.&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; line-height: 18px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; line-height: 18px;&quot;&gt;♥&amp;nbsp;&lt;/span&gt;&amp;nbsp;Happy &lt;a href=&quot;http://hinduism.about.com/cs/diwali/a/aa102003a.htm&quot;&gt;Diwali &lt;/a&gt;all..!!&amp;nbsp;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; line-height: 18px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; line-height: 18px;&quot;&gt;♥&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&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/AVvXsEhIytvLDgCC36qdl5WV9m1RcaPbc78MoZ93aIcK9RlqkkhgV6ZdF5tBBYrVdYopHMej6oF-Ztf2r0DvTyx4BH1D8FNgxS6WnO1HwYtWTd-d7EqKFzx2pYRftuDA2EsWOCMG5WCqvv_BRfal/s1600/laksmi_devi.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;512&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIytvLDgCC36qdl5WV9m1RcaPbc78MoZ93aIcK9RlqkkhgV6ZdF5tBBYrVdYopHMej6oF-Ztf2r0DvTyx4BH1D8FNgxS6WnO1HwYtWTd-d7EqKFzx2pYRftuDA2EsWOCMG5WCqvv_BRfal/s640/laksmi_devi.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://www.mythoughts.co.in/2012/11/happy-diwali-all.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIytvLDgCC36qdl5WV9m1RcaPbc78MoZ93aIcK9RlqkkhgV6ZdF5tBBYrVdYopHMej6oF-Ztf2r0DvTyx4BH1D8FNgxS6WnO1HwYtWTd-d7EqKFzx2pYRftuDA2EsWOCMG5WCqvv_BRfal/s72-c/laksmi_devi.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-484281739158039493</guid><pubDate>Mon, 12 Nov 2012 02:32:00 +0000</pubDate><atom:updated>2012-11-12T08:02:25.729+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>Null point exception while running webdriver script</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 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 dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Sometimes simple mistakes will take lot of time in debugging . I can bet on it :P&lt;br /&gt;
Today while runing a sample script I got errors like below :&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Here is the script with syntax error:&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class AutoComplete {
 
 WebDriver driver;
 
 @BeforeTest
 public void start(){
 WebDriver driver = new FirefoxDriver();
 }
 
 @Test
 public void AutoComplete()
 {
 driver.get(&quot;http://mythoughts.co.in/&quot;);
 driver.manage().window().maximize();
 }

}

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
I just overlooked the above script and thought everything is fine. But the issue got fixed when I remove the &quot;WebDriver&quot; statement from the&lt;b&gt; line 13&lt;/b&gt; and script ran successfully.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Here is the script which ran successfully.&lt;/b&gt;&lt;/div&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class AutoComplete {
 
 WebDriver driver;
 
 @BeforeTest
 public void start(){
 driver = new FirefoxDriver();
 }
 
 @Test
 public void AutoComplete()
 {
 driver.get(&quot;http://mythoughts.co.in/&quot;);
 driver.manage().window().maximize();
 }

}

&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://www.mythoughts.co.in/2012/11/null-point-exception-while-running.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-6146827522079600477</guid><pubDate>Sun, 14 Oct 2012 07:18:00 +0000</pubDate><atom:updated>2012-10-14T12:51:11.315+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>WebDriver Tutorial Part 6 : Working with the different types of web elements </title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
From the&lt;a href=&quot;http://www.mythoughts.co.in/2012/09/webdriver-tutorial-part-5-locating.html&quot;&gt; previous post&lt;/a&gt; , it was clear on how to identify the webelements on webpage. In this post we will see how to work with different webelemts.&lt;br /&gt;
&lt;br /&gt;
By default , selenium defines predefined functions which we can use on different types of webelemts.&lt;br /&gt;
Here are some of the predefinied functions:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;driver.findElement(By.id(&quot;WebelemntId&quot;)).&lt;b&gt;clear();&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;driver.findElement(By.id(&quot;WebelemntId&quot;)).&lt;b&gt;isEnabled();&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;driver.findElement(By.id(&quot;WebelemntId&quot;)).&lt;b&gt;isDisplayed();&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;driver.findElement(By.id(&quot;WebelemntId&quot;)).&lt;b&gt;submit();&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;driver.findElement(By.id(&quot;WebelemntId&quot;)).&lt;b&gt;sendKeys(&quot;test&quot;);&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;driver.findElement(By.id(&quot;WebelemntId&quot;)).&lt;b&gt;isSelected();&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;driver.findElement(By.id(&quot;WebelemntId&quot;)).&lt;b&gt;getAttribute(&quot;&quot;);&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;driver.findElement(By.id(&quot;WebelemntId&quot;)).&lt;b&gt;getLocation();&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;driver.findElement(By.id(&quot;WebelemntId&quot;)).&lt;b&gt;getTagName();&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;driver.findElement(By.id(&quot;WebelemntId&quot;)).&lt;b&gt;getText();&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;driver.findElement(By.id(&quot;WebelemntId&quot;)).&lt;b&gt;getSize();&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
All the functions canot be used for every webelement.&lt;br /&gt;
&lt;br /&gt;
Say &amp;nbsp;&quot;sendKeys()&quot; method is sending text to a webelement .This method can be used with textboxes but we can&#39;t use it on images , links. These are all basic things which we will learn through experience.&lt;br /&gt;
&lt;br /&gt;
Here are the samples , on how to achieve basic functionality of different webelements using webdriver functions:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Textbox&quot;&gt;Textboxes&lt;/a&gt;&amp;nbsp;:Send text&lt;br /&gt;
Sending text to Textboxes can be done by using &quot;sendKeys()&quot; method. Here is how it works:&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;driver.findElement(By.id(&quot;textBoxId&quot;)).sendKeys(&quot;sending text&quot;);&lt;/pre&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Radio_button&quot;&gt;RadioButtons&lt;/a&gt;&amp;nbsp;:Select an option&lt;br /&gt;
Selecting an option from Radio button can be done by using&amp;nbsp;&quot;click()&quot; method.Here is how it works:&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;driver.findElement(By.id(&quot;radioButtonId&quot;)).click();&lt;/pre&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Hyperlink&quot;&gt;Hyperlinks&lt;/a&gt;&amp;nbsp;:Click on links&lt;br /&gt;
Clicking on link can be done by using &quot;click()&quot; method.Here is how it works:&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;driver.findElement(By.id(&quot;linkId&quot;)).click();&lt;/pre&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Checkbox&quot;&gt;Checkboxes&lt;/a&gt;&amp;nbsp;:Check the checkboxes&lt;br /&gt;
Selecting options from Checkboxes can be done by using&amp;nbsp;&quot;click()&quot; method.Here is how it works:&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;driver.findElement(By.id(&quot;checkBoxId&quot;)).click();&lt;/pre&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Drop-down_list&quot;&gt;Drop-down List&lt;/a&gt;&amp;nbsp;:Select an option&lt;br /&gt;
Selecting an option from Dropdown list &amp;nbsp;can be done by using &amp;nbsp;&quot;sendKeys()&quot; method.Here is how it works:&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;driver.findElement(By.id(&quot;dropdownListId&quot;)).sendKeys(&quot;SelectOption1&quot;);&lt;/pre&gt;
&lt;a href=&quot;http://www.w3schools.com/tags/tag_textarea.asp&quot;&gt;Textarea&lt;/a&gt;&amp;nbsp;:Send text&lt;br /&gt;
Sending text to Textboxes can be done by using &quot;sendKeys()&quot; method.Here is how it works:&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;driver.findElement(By.id(&quot;textAreaId&quot;)).click();&lt;/pre&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Button_(computing)&quot;&gt;Button&lt;/a&gt;&amp;nbsp;:click on it.&lt;br /&gt;
Submitting button can be done by using either &quot;click()&quot; or &quot;submit()&quot; mrthods.Here is how it works:&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;driver.findElement(By.id(&quot;butonId&quot;)).click();&lt;/pre&gt;
Below example is the working code for &quot;submitting a form which has most of the webelements like textbox, textarea, radiobutton, checkboxe and dropdown list&quot;.&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;package blog;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class DocumentIdentifiers {
 
 WebDriver driver;
 
 @BeforeTest
 public void start(){
 driver = new FirefoxDriver();
 }
 
 @Test
 public void ok(){
 driver.get(&quot;https://docs.google.com/spreadsheet/viewform?fromEmail=true&amp;amp;formkey=dGp5WEhMR0c1SzFTRFhmTjJNVk12T1E6MQ&quot;);
//Send text to firstname, lastname and email address fields
 driver.findElement(By.id(&quot;entry_0&quot;)).sendKeys(&quot;First Name&quot;);
 driver.findElement(By.id(&quot;entry_3&quot;)).sendKeys(&quot;Last Name&quot;);
 driver.findElement(By.id(&quot;entry_13&quot;)).sendKeys(&quot;Emailaddress&quot;);
//Setting value for Gender radiobutton
 driver.findElement(By.id(&quot;group_2_1&quot;)).click();
//Selecting values for &quot;Your preferred Programming language&quot; checkbox
 driver.findElement(By.id(&quot;group_5_1&quot;)).click();
 driver.findElement(By.id(&quot;group_5_2&quot;)).click();
 driver.findElement(By.id(&quot;group_5_3&quot;)).click();
//Setting value for &quot;your Location&quot; dropdown list
 driver.findElement(By.id(&quot;entry_6&quot;)).sendKeys(&quot;Non India&quot;);
//Giving the value for user rating radiobutton
 driver.findElement(By.id(&quot;group_7_3&quot;)).click();
//sending value to feedback textarea elemenet
 driver.findElement(By.id(&quot;entry_8&quot;)).sendKeys(&quot;Adding new comments &quot;);
//Submitting the form
 driver.findElement(By.name(&quot;submit&quot;)).submit();   
 }
 
 @AfterTest
 public void close(){
 driver.quit();
 }
}

&lt;/pre&gt;
Starting from next post , I will concentrate more on live problems. See you all in next post ..!! :)&lt;br /&gt;
&lt;br /&gt;
Between Advance &lt;a href=&quot;http://www.mythoughts.co.in/2011/10/happy-dasara.html&quot;&gt;happy dasara&lt;/a&gt; to you and your family. Have a great year ahead..!!:)&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://www.mythoughts.co.in/2012/10/webdriver-tutorial-part-6-working-with.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>10</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-1810164739549952771</guid><pubDate>Sun, 02 Sep 2012 10:05:00 +0000</pubDate><atom:updated>2012-10-01T23:29:47.425+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>WebDriver Tutorial Part 5 : Locating WebElemnts on the Webpage </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;
Every webpage is nothing but the set of of different&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/HTML_element&quot;&gt;elments&lt;/a&gt;. So we need to have idea on the following things before we start building the script.&lt;br /&gt;
1.Knowing the different&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/HTML_element&quot;&gt;elements &lt;/a&gt;&amp;nbsp;on WebPage&lt;br /&gt;
2.Locating the &lt;a href=&quot;http://en.wikipedia.org/wiki/HTML_element&quot;&gt;elements &lt;/a&gt;on web page&lt;br /&gt;
3.Working wth the&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/HTML_element&quot;&gt;elemets&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. Knowing the different typesof &amp;nbsp;&lt;/b&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/HTML_element&quot; style=&quot;font-weight: bold;&quot;&gt;elements&amp;nbsp;&lt;/a&gt;&lt;b&gt;&amp;nbsp;on WebPage&lt;/b&gt; &lt;br /&gt;
By looking at the webpage we should be able to identify the type of element it consists.Sometimes we can check elements types by viewing the source code.Here are the common elements most of the time we encounter in the process of automation.&lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Textbox&quot;&gt;Text box&lt;/a&gt;&amp;nbsp; &lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Drop-down_list&quot;&gt;Drop-down List&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Checkbox&quot;&gt;Checkbox&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Radio_button&quot;&gt;Radio button&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.w3schools.com/tags/tag_textarea.asp&quot;&gt;TextArea &lt;/a&gt;&amp;nbsp; &lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Hyperlink&quot;&gt;Hyperlink&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/HTML_element#Images_and_objects&quot;&gt;Image&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Button_(computing)&quot;&gt;Button&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Frame_(GUI)&quot;&gt;Frames&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Alert_dialog_box&quot;&gt;Alert dialog box&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://en.wikipedia.org/wiki/Window_(computing)&quot;&gt;Window&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2.Locating the&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/HTML_element&quot;&gt;elements&amp;nbsp;&lt;/a&gt;on web page&amp;nbsp;&lt;/b&gt; &lt;br /&gt;
Before starting let us have a look at the below sample form which consists of &quot;First Name, Last name , Email address, Sex, Submit button&quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;form action=&quot;MAILTO:vamshikurra@mythoughts.co.in&quot; enctype=&quot;text/plain&quot; method=&quot;post&quot;&gt;
First name:&lt;br /&gt;
&lt;input id=&quot;firstname&quot; maxlength=&quot;45&quot; name=&quot;firstname&quot; type=&quot;text&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
Last name:&lt;br /&gt;
&lt;input id=&quot;lastname&quot; maxlength=&quot;45&quot; name=&quot;lastname&quot; type=&quot;text&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
Email Address:&lt;br /&gt;
&lt;input maxlength=&quot;45&quot; name=&quot;email&quot; type=&quot;text&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
Your Sex :&lt;br /&gt;
&lt;input name=&quot;sex&quot; required=&quot;required&quot; type=&quot;radio&quot; value=&quot;male&quot; /&gt; Male&lt;br /&gt;
&lt;input name=&quot;sex&quot; required=&quot;required&quot; type=&quot;radio&quot; value=&quot;female&quot; /&gt; Female&lt;br /&gt;
&lt;br /&gt;
&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; /&gt; &lt;br /&gt;
&lt;br /&gt;&lt;/form&gt;
&lt;/div&gt;
Above form has 5 elements, three textboxes, one radio button and one submit button.We have successfully identified the elements type.Now we need to locate the elements on webpage using Selenium.&lt;br /&gt;
&lt;br /&gt;
If we see the viewsource of &quot;First Name&quot; textbox , it will look like &lt;br /&gt;
&lt;i&gt;&amp;lt;input id=&quot;firstname&quot; maxlength=&quot;45&quot; name=&quot;firstname&quot; type=&quot;text&quot; /&amp;gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
It means we can locate the &quot;First Name&quot; text box on the webpage using 4 different locators i.e &amp;nbsp;id, name, Xpath, CSS.&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;WebDriver driver=new FirefoxDriver()
WebElement textbox=driver.findElement(By.name(&quot;firstname&quot;));
OR
WebElement textbox=driver.findElement(By.id(&quot;firstname&quot;)); &lt;/pre&gt;
&lt;i&gt;We can easily get the Xpath and CSS values of an element using firefox addons like &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/firebug/&quot;&gt;Firebug&lt;/a&gt;&amp;nbsp;and&amp;nbsp; &lt;a href=&quot;https://www.google.co.in/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CCUQFjAA&amp;amp;url=https%3A%2F%2Faddons.mozilla.org%2Fen-US%2Ffirefox%2Faddon%2Ffirepath%2F&amp;amp;ei=zW5CUIyMA8-HrAeZl4GADg&amp;amp;usg=AFQjCNEENM92ldNpno_J2FPTt9Xpwt3ilA&amp;amp;sig2=aZ0yzPV32zquBHoCRtDx0A&quot;&gt;FirePath&lt;/a&gt;.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
In selenium we can identify the elements on the webpage with the following locators.&lt;br /&gt;
&lt;a href=&quot;http://seleniumhq.org/docs/02_selenium_ide.html#locating-by-id&quot;&gt;Locating By Id&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://seleniumhq.org/docs/02_selenium_ide.html#locating-by-name&quot;&gt;Locating By&amp;nbsp;Name&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://seleniumhq.org/docs/02_selenium_ide.html#locating-by-xpath&quot;&gt;Locating By&amp;nbsp;Xpath&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://seleniumhq.org/docs/02_selenium_ide.html#locating-hyperlinks-by-link-text&quot;&gt;Locating Hyperlinks by LinkText&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://seleniumhq.org/docs/02_selenium_ide.html#locating-by-dom&quot;&gt;Locating By&amp;nbsp;DOM&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://seleniumhq.org/docs/02_selenium_ide.html#locating-by-css&quot;&gt;Locating By&amp;nbsp;CSS&lt;/a&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt; &lt;b&gt;3.Working wth the&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/HTML_element&quot;&gt;elemets&lt;/a&gt;&lt;/b&gt; &lt;br /&gt;
Knowing the element type and locating the element is not what we actually want. We want to work with those elements to perform some action on the webpage say &quot;locate the submit button on webpage and click on it&quot;.&lt;br /&gt;
&lt;br /&gt;
In the next post , we will see how we can work with the different elements using selenium ...!! :)&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://www.mythoughts.co.in/2012/09/webdriver-tutorial-part-5-locating.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-7486254193851611555</guid><pubDate>Sat, 18 Aug 2012 05:30:00 +0000</pubDate><atom:updated>2018-10-23T19:21:58.753+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">TestNG</category><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>WebDriver Tutorial Part 4 : Working with TestNG framework in Eclipse</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Writing a script in plain Java is simple like what we have done in the&lt;a href=&quot;http://www.mythoughts.co.in/2012/08/webdriver-selenium-2-part-3-writing.html&quot;&gt; previous post&lt;/a&gt;. But there is more we can do using WebDriver.&lt;br /&gt;
&lt;br /&gt;
Say If you want to run multiple scripts at a time ,better reporting and you want to go for datadriven testing (Running the same script with multiple data) then&lt;a href=&quot;http://www.mythoughts.co.in/2012/08/webdriver-selenium-2-part-3-writing.html&quot;&gt; plain Java script &lt;/a&gt;is not enough .&lt;br /&gt;
&lt;br /&gt;
So it is recommended to use any of the existing frameworks like &lt;a href=&quot;https://www.guru99.com/all-about-testng-and-selenium.html&quot;&gt;TestNG &lt;/a&gt;or &lt;a href=&quot;http://www.junit.org/&quot;&gt;JUnit&lt;/a&gt;. Select one of the framework and start using it.&lt;br /&gt;
&lt;br /&gt;
In this post , I start with TestNG. If you are planning to use TestNG then you need to&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;1.Install TestNG Eclipse plug-in&amp;nbsp;&lt;/li&gt;
&lt;li&gt;2.Customize the output directory path&lt;/li&gt;
&lt;li&gt;3.Start writing scripts&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;1.Install TestNG Eclipse plug-in&amp;nbsp;&lt;/b&gt; &lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
Detailed instruction on how to install TestNG plug-in can be found here&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://testng.org/doc/download.html&quot;&gt;http://testng.org/doc/download.html&lt;/a&gt; &lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;2.Customize the output directory path&lt;/b&gt; &lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
This is not a mandatory step. But it is good to have it.Using this you can tell TestNG where to store all the output results files.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
In Eclipse Goto Window&amp;gt;&amp;gt;Preferences&amp;gt;&amp;gt;TestNG&amp;gt;&amp;gt;&lt;/div&gt;
&lt;div&gt;
Set the Output Direcory location as per your wish and click on &quot;Ok&quot;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&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/AVvXsEg31Fqwd9DS_7nvgFJvtqCSM0rbX5bzHOjRFLpg-BN8E70jGBqKlKJOOPvldu5t4E5FPGo-ifllr4MsXeAUActkVHXrENBeKMCQeeZFnkB0s3zQpiagOP5wis8BRqH6z5_3e8uG4dWSOq3t/s1600/TestNG+.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Vamshi Kurra -TestNG&quot; border=&quot;0&quot; height=&quot;310&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg31Fqwd9DS_7nvgFJvtqCSM0rbX5bzHOjRFLpg-BN8E70jGBqKlKJOOPvldu5t4E5FPGo-ifllr4MsXeAUActkVHXrENBeKMCQeeZFnkB0s3zQpiagOP5wis8BRqH6z5_3e8uG4dWSOq3t/s400/TestNG+.jpg&quot; title=&quot;&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;3.Start writing scripts&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Writing scripts using TestNG is so simple. We will start with the editing of script we have written in the &lt;a href=&quot;http://www.mythoughts.co.in/2012/08/webdriver-selenium-2-part-3-writing.html&quot;&gt;previous post&amp;nbsp;&lt;/a&gt;.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Here is the edited script using TestNG.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;package learning;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class GoogleSearchTestNG {

 WebDriver driver;
 
 @BeforeTest
 public void start(){
  driver = new FirefoxDriver();
 }
 
 @Test
 public void Test(){ 
  System.out.println(&quot;Loading Google search page&quot;);
  driver.get(&quot;http://google.com&quot;);
  System.out.println(&quot;Google search page loaded fine&quot;);
 }
 
 @AfterTest
 public void close(){
  driver.quit(); 
 }
}

&lt;/pre&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
If you look at the above code the main chnages we have done is&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
1.Imported new TestNG files&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
2.Now there is no main function.We removed it.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
3.We have split the single main function into 3 functions. i.e start(), test(), close()&lt;br /&gt;
start() &amp;nbsp;-- Initialize the WebDriver&lt;br /&gt;
Test() &amp;nbsp;-- Perform our exact requirement.&lt;br /&gt;
close() -- Close the Browser once&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
4.There are 3 different annotations named &quot;BeforeTest&quot; , &quot;Test&quot; , &quot;AfterTest&quot;.&lt;/div&gt;
&lt;b&gt;@BeforeTest &lt;/b&gt;-- Keep this annotaion before a method which has to be called initially when you run the script. In our script ,we put it before start() method because we want to initialize the WebDriver first.&lt;br /&gt;
&lt;b&gt;@Test &lt;/b&gt;&amp;nbsp; &amp;nbsp;-- Keep this annotation before a method which will do the exact operation of your script.&lt;br /&gt;
&lt;b&gt;@AfterTest&lt;/b&gt; -- Keep this annotation before mehod which has to run at the end. In our script , closing browser has to be done at the end. So we put this annotation before close() method.&lt;br /&gt;
&lt;br /&gt;
TestNG is so powerful . But now we stop here :) and experiment more on WebDriver functions. Once that is done we will come back to TestNG.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Can&#39;t wait and learn more ?? , you can always refer documents &lt;a href=&quot;http://testng.org/doc/documentation-main.html&quot;&gt;here&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Going forward all the example scripts in this site will refer to TestNG.&lt;/div&gt;
&lt;/div&gt;
</description><link>http://www.mythoughts.co.in/2012/08/webdriver-selenium-2-part-4-working.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg31Fqwd9DS_7nvgFJvtqCSM0rbX5bzHOjRFLpg-BN8E70jGBqKlKJOOPvldu5t4E5FPGo-ifllr4MsXeAUActkVHXrENBeKMCQeeZFnkB0s3zQpiagOP5wis8BRqH6z5_3e8uG4dWSOq3t/s72-c/TestNG+.jpg" height="72" width="72"/><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-6641017438352004147</guid><pubDate>Sun, 12 Aug 2012 09:55:00 +0000</pubDate><atom:updated>2013-05-10T12:36:31.187+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>WebDriver Tutorial Part 3 :Writing first script using Webdriver</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
If you have missed the previous post then you can have a look at&lt;a href=&quot;http://www.mythoughts.co.in/2012/08/installing-java-settingup-path-variables.html&quot;&gt; here&lt;/a&gt; .&lt;br /&gt;
&lt;br /&gt;
Now we are ready to start our first script in Webdriver using Eclipse .Open your Eclipse and follow the below steps&lt;br /&gt;
&lt;br /&gt;
1.Create new Java Project&lt;br /&gt;
2.Add the Webdriver Jar files to the created Project&lt;br /&gt;
3.Create a new Package under Java Project&lt;br /&gt;
4.Create a Java class file under the Package&lt;br /&gt;
5.Write the code in the Java class file and run it.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. Create a new Java project&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt; Goto File &amp;gt;&amp;gt; New &amp;gt;&amp;gt;Java Project&lt;br /&gt;
We will get a popup which will prompt us to provide the project name.&lt;br /&gt;
Give the project name say &quot;ExploreWebDriver&quot; then click on Finish button.&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/AVvXsEhNSDzuUOic5VJ_ty3QBlR6_bUX-gN_uvPowONIhJBSQzJ5rzXEVQA4mUEUnb9tT1GdfqlJ41Kd_QqYVVbQGIOa8xnEDA7Abr5OLao_QHihYkTGjnqGc8hW3b7CTX4FzdhT_h4j1Na_EF7h/s1600/New+WebDriver+Project.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Vamshi Kurra - New java project creation popup in Eclipse&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNSDzuUOic5VJ_ty3QBlR6_bUX-gN_uvPowONIhJBSQzJ5rzXEVQA4mUEUnb9tT1GdfqlJ41Kd_QqYVVbQGIOa8xnEDA7Abr5OLao_QHihYkTGjnqGc8hW3b7CTX4FzdhT_h4j1Na_EF7h/s1600/New+WebDriver+Project.jpg&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;2.Add the Webdriver Jar files to the created Project&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt; Right click on created project then goto&lt;br /&gt;
Build Path&amp;gt;&amp;gt;Configure Build Path &amp;gt;&amp;gt;Select Libraries tab&amp;gt;&amp;gt;Add External jars&lt;br /&gt;
Which will open a folder search prompt , goto the locations where you have downloaded WebDriver jar files and add them .Then click on &quot;Ok&quot; button&lt;br /&gt;
You need to add below jar files.If you don&#39;t have these files downloaded on your computer then you can download them from the below pages :&lt;br /&gt;
&lt;a href=&quot;http://seleniumhq.org/download/&quot;&gt;http://seleniumhq.org/download/&lt;/a&gt;
&lt;br /&gt;
&lt;a href=&quot;http://code.google.com/p/selenium/downloads/list&quot;&gt;http://code.google.com/p/selenium/downloads/list&lt;/a&gt;&lt;br /&gt;
You can also download all jars from my shared location&lt;br /&gt;
&lt;span style=&quot;color: #0000ee;&quot;&gt;&lt;u&gt;&lt;a href=&quot;https://docs.google.com/folder/d/0B00rtzEfza2uZnRBZnNVWHFVNjA/edit&quot;&gt;https://docs.google.com/folder/d/0B00rtzEfza2uZnRBZnNVWHFVNjA/edit&lt;/a&gt;&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;a.selenium-java-2.32.0-srcs.jar&lt;/li&gt;
&lt;li&gt;b.selenium-java-2.32.0.jar&lt;/li&gt;
&lt;li&gt;c.selenium-server-standalone-2.32.0.jar&lt;/li&gt;
&lt;/ul&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/AVvXsEiTTmVLBYPE08c424aYtWHMi2-_A8SeVOv_cNygPNh2ODLg07_Mlik8T68LSAAKI307yFtiEkhRQcyfseQn3kIYlEknXWDVD-IDqK8asNFth0f4j3cLt-rHRixzGMu94LHNK7oWL6SuF6C8/s1600/Vamshi+Kurra+-+Add+WebDriver+jar+Files+using+Eclipse.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Vamshi Kurra- Adding External jar files in Eclipse&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTTmVLBYPE08c424aYtWHMi2-_A8SeVOv_cNygPNh2ODLg07_Mlik8T68LSAAKI307yFtiEkhRQcyfseQn3kIYlEknXWDVD-IDqK8asNFth0f4j3cLt-rHRixzGMu94LHNK7oWL6SuF6C8/s400/Vamshi+Kurra+-+Add+WebDriver+jar+Files+using+Eclipse.png&quot; height=&quot;305&quot; title=&quot;&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;3.Create a new Package under Java Project&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&amp;nbsp;Goto creatd project&amp;nbsp;&amp;nbsp;i.e. &quot;ExploreWebDriver&quot;&amp;nbsp;and expand it.Now we will see a separate folder named &quot;src&quot;. Right Click on it and then Goto&lt;br /&gt;
New&amp;gt;&amp;gt;Package&amp;gt;&amp;gt;Give the name of package in the &quot;package creation&quot; popup. Say &quot;learning&quot; is the name of the Package.Now click on finish button.&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/AVvXsEgVs8PBMOfbHxOne8C5Ywv__QD1HJDAmuDk6MhA04i5uK2wGFZTSHAFhqPrOVK85CYP52RFo3A_sI_qKoFWXBekPv5z9NzxzWGymRYxSolgwF2HUF45AoFxs8jeGSSUnjRiKxjhxwiMvg1O/s1600/VamshiKurra+-+Package+creation.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Vamshi Kurra - New Java Package popup&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVs8PBMOfbHxOne8C5Ywv__QD1HJDAmuDk6MhA04i5uK2wGFZTSHAFhqPrOVK85CYP52RFo3A_sI_qKoFWXBekPv5z9NzxzWGymRYxSolgwF2HUF45AoFxs8jeGSSUnjRiKxjhxwiMvg1O/s320/VamshiKurra+-+Package+creation.png&quot; height=&quot;303&quot; title=&quot;&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;4.Create a Java class file under the Package&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&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: left;&quot;&gt;
Right click on the created package i.e &quot;Learing&quot; and then goto&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
New&amp;gt;&amp;gt;Class&amp;gt;&amp;gt;we will get &quot;New Java Class&quot; popup. Enter the name of the class say &quot;GoogleSearch&quot; and click on Finish.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&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/AVvXsEgCQIYVuszLN1nF0OHF9Tr6XxaE8wyiumYayZkhircbpXE8ZCEYmykrJE6D1VLtTs4EUc5WGGBsh2sdNW9k6NhyphenhyphenSc_0bypsh-p5DehaFbpSEp2eI3i7PA_RN7xBM13HpDjkc99eje1QV2P_/s1600/Vamshi+Kurra-New+Java+Class.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Vamshi Kurra- Adding new Java Class in Eclipse&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCQIYVuszLN1nF0OHF9Tr6XxaE8wyiumYayZkhircbpXE8ZCEYmykrJE6D1VLtTs4EUc5WGGBsh2sdNW9k6NhyphenhyphenSc_0bypsh-p5DehaFbpSEp2eI3i7PA_RN7xBM13HpDjkc99eje1QV2P_/s400/Vamshi+Kurra-New+Java+Class.png&quot; height=&quot;400&quot; title=&quot;&quot; width=&quot;343&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&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: left;&quot;&gt;
&lt;b&gt;5.Write the code in the Java class file and run it.&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
Copy the below code and paste it in the created Java class file.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;package learning;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class GoogleSearch {
 
 public static void main(String args[]){
  WebDriver driver=new FirefoxDriver();
  System.out.println(&quot;Loading Google search page&quot;);
  driver.get(&quot;http://google.com&quot;);
  System.out.println(&quot;Google search page loaded fine&quot;); 
 }

}&lt;/pre&gt;
&lt;br /&gt;
Here is how your Eclipse project hierarchy looks like :&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/AVvXsEjNK7-ow2XYGRZbVZ2dx7nsU7ct-FI4VfTA9xIrqvv9nfSZR32zgNdlyCvJPrIpEunFWzQyJJrv2Foqo75fOYsmT7nwjutqnNmQswIsBOs6jynf_CH7PqRvioaN0JewOM3sY_eRVFphBIHC/s1600/Vamshi+Kurra-New+WebDriver+Script.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Vamshi Kurra- Eclipse project hierarchy&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNK7-ow2XYGRZbVZ2dx7nsU7ct-FI4VfTA9xIrqvv9nfSZR32zgNdlyCvJPrIpEunFWzQyJJrv2Foqo75fOYsmT7nwjutqnNmQswIsBOs6jynf_CH7PqRvioaN0JewOM3sY_eRVFphBIHC/s640/Vamshi+Kurra-New+WebDriver+Script.png&quot; height=&quot;196&quot; title=&quot;&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Now Click run .&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Script will run successfully and a new firefox window will be opened with the Google.com .&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://www.mythoughts.co.in/2012/08/webdriver-selenium-2-part-3-writing.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNSDzuUOic5VJ_ty3QBlR6_bUX-gN_uvPowONIhJBSQzJ5rzXEVQA4mUEUnb9tT1GdfqlJ41Kd_QqYVVbQGIOa8xnEDA7Abr5OLao_QHihYkTGjnqGc8hW3b7CTX4FzdhT_h4j1Na_EF7h/s72-c/New+WebDriver+Project.jpg" height="72" width="72"/><thr:total>8</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-2765858254966663504</guid><pubDate>Sun, 05 Aug 2012 14:45:00 +0000</pubDate><atom:updated>2014-01-01T11:55:57.496+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>WebDriver Tutorial Part 2 : Installing Java and Eclipse IDE</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
Once we are familiar with selenium IDE , the next step is &quot;Choosing a programnning language&quot; and start scripting .&lt;br /&gt;
&lt;br /&gt;
Selenium supports multiple languages like&amp;nbsp;Java, C#, Phython, Ruby,Php, Perl . Depending upon your flexibility select any one of the language as your scripting langauge and install that language components.&lt;br /&gt;
&lt;br /&gt;
Suppose If you are planning to use Java as your programming language (like me) then here are steps for installing it.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1 : Installing Java:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Before installing check whether your computer already has Java or not , by visiting&lt;br /&gt;
&lt;a href=&quot;http://java.com/en/download/installed.jsp&quot;&gt;http://java.com/en/download/installed.jsp&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
If you don&#39;t have Java istalled on your computer , then you can start installing Java by visiting&lt;br /&gt;
&lt;a href=&quot;http://www.java.com/en/download/help/windows_manual_download.xml&quot;&gt;http://www.java.com/en/download/help/windows_manual_download.xml&lt;/a&gt;&lt;br /&gt;
&amp;nbsp;Above site will have step by step instructions on how to install Java.&lt;br /&gt;
&lt;br /&gt;
&lt;b style=&quot;font-weight: bold;&quot;&gt;Step 2: Set up Path and Class Path for Java :&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Here are the step to step instructions on how to setup PATH variables in java (with screenshots :)&amp;nbsp;)&lt;br /&gt;
&lt;a href=&quot;http://www.roseindia.net/java/java-classpath.shtml&quot;&gt;http://www.roseindia.net/java/java-classpath.shtml&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Here is the website which describes all the above details clearly&lt;br /&gt;
&lt;a href=&quot;http://www.ugrad.cs.ubc.ca/~cs211/tutorials/Eclipse/Eclipse_Java_Windows_XP.html&quot;&gt;http://www.ugrad.cs.ubc.ca/~cs211/tutorials/Eclipse/Eclipse_Java_Windows_XP.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b style=&quot;font-weight: bold;&quot;&gt;Step 3 :Installing Eclipse&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Eclipse is an opensource IDE(Integrated Development Environment&amp;nbsp;). Download Eclipse from&lt;br /&gt;
&lt;a href=&quot;http://www.eclipse.org/downloads&quot;&gt;http://www.eclipse.org/downloads&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Follow the below tutorial which gives the basic idea on how to configure Eclipse and use it.&lt;br /&gt;
&lt;a href=&quot;http://www.vogella.com/articles/Eclipse/article.html&quot;&gt;http://www.vogella.com/articles/Eclipse/article.html&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</description><link>http://www.mythoughts.co.in/2012/08/installing-java-settingup-path-variables.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-521621779236344892</guid><pubDate>Sun, 29 Jul 2012 07:57:00 +0000</pubDate><atom:updated>2014-01-01T11:57:53.522+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>WebDriver Tutorial Part 1 : Overview on WebDriver and Selenium IDE</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
Before we start , quick details on &lt;a href=&quot;http://seleniumhq.org/docs/03_webdriver.html#introducing-webdriver&quot;&gt;WebDriver&lt;/a&gt; ( Selenium 2 )&lt;br /&gt;
&lt;br /&gt;
Selenium&amp;nbsp;is a Automation tool &amp;nbsp;for testing WebApplications. And using this we can automate ONLY web applications but not Windows based applications.&lt;br /&gt;
&lt;br /&gt;
There are others tool which can be used to automate both web applications and windows applicaions like &lt;a href=&quot;http://www8.hp.com/us/en/software/enterprise-software.html&quot;&gt;QTP(Quick Test Professional)&lt;/a&gt;&amp;nbsp;.Unlike QTP , Selenium&amp;nbsp;is freeware :) .&lt;br /&gt;
&lt;br /&gt;
This is why most of the companies prefer Selenium whenever they want to automate Webbased applications ,between who hates to save money :) .&lt;br /&gt;
&lt;br /&gt;
If you are the beginner and doesn&#39;t know anything about&amp;nbsp;Selenium then please start using &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/selenium-ide/&quot;&gt;Selenium IDE&lt;/a&gt; which is a firefox addon, used to record and run the testcases.&lt;br /&gt;
&lt;br /&gt;
Using Seleniun IDE , we can even export our testcases.&lt;br /&gt;
&lt;br /&gt;
Install&amp;nbsp;&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/selenium-ide/&quot;&gt;Selenium IDE&lt;/a&gt;&amp;nbsp;and start playing with it. It is one of the simple tool which doesn&#39;t require much detailed explanations :)&lt;br /&gt;
&lt;br /&gt;
But&amp;nbsp;Selenium IDE itself is not enough for effective test script as it doesnt supports looping(for, while etc..) and our cusom needs.So we need to use other programming languages to customize testscript and achieve what our test senario demands.&lt;br /&gt;
&lt;br /&gt;
Stay tuned lot more to discuss :)&lt;br /&gt;
&lt;br /&gt;
Check Part 2 &amp;nbsp;i.e&amp;nbsp;&lt;a href=&quot;http://www.mythoughts.co.in/2012/08/installing-java-settingup-path-variables.html&quot;&gt;&amp;nbsp;Installing Java and Eclipse IDE&lt;/a&gt;&lt;/div&gt;</description><link>http://www.mythoughts.co.in/2012/07/selenium-part1-install-langauge.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-2986600632493723350</guid><pubDate>Tue, 19 Jun 2012 17:21:00 +0000</pubDate><atom:updated>2014-01-01T11:57:30.462+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">WebDriver Selenium2</category><title>Handling &quot;drag and drop&quot; actions using WebDriver(Selenium 2)</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
Automating rich web application is even more interesting since it involves advanced user interactions.&lt;br /&gt;
&lt;br /&gt;
Say we have a web application which drag an item from one location and then drop it at another location.These kind of drag and drops are cant be automated with one single statement .In WebDriver we have a separatae &quot;Actions&quot; class to handle advanced user interactions(say drag and drop) on web page.&lt;br /&gt;
&lt;br /&gt;
Here is the documentation on how to automate advanced user interactions :&lt;br /&gt;
&lt;a href=&quot;http://code.google.com/p/selenium/wiki/AdvancedUserInteractions&quot;&gt;http://code.google.com/p/selenium/wiki/AdvancedUserInteractions&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Here is the sample code using TestNG framework&lt;br /&gt;
&lt;pre class=&quot;cpp&quot; name=&quot;code&quot;&gt;import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class draganddrop {
 
 WebDriver driver;
 
 @BeforeTest
 public void start(){
  FirefoxProfile profile = new FirefoxProfile();
  profile.setEnableNativeEvents(true);
  driver = new FirefoxDriver(profile);
 }

 @Test
 public void start1(){
  driver.get(&quot;http://jqueryui.com/droppable/&quot;);
  driver.switchTo().frame(0);  
  driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
  WebElement dragElement=driver.findElement(By.id(&quot;draggable&quot;));
  WebElement dropElement=driver.findElement(By.id(&quot;droppable&quot;));
    
  Actions builder = new Actions(driver);  // Configure the Action
  Action dragAndDrop = builder.clickAndHold(dragElement)
    .moveToElement(dropElement)
    .release(dropElement)
    .build();  // Get the action
    dragAndDrop.perform(); // Execute the Action
 }
}
&lt;/pre&gt;&lt;/div&gt;</description><link>http://www.mythoughts.co.in/2012/06/handling-drag-and-drop-actions-using.html</link><author>noreply@blogger.com (Unknown)</author><thr:total>28</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-543267854941927967.post-3996634438873971254</guid><pubDate>Mon, 11 Jun 2012 16:34:00 +0000</pubDate><atom:updated>2014-01-01T11:57:20.801+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Apple</category><title>Apple Store is down</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hey guys did you visit &quot;&lt;a href=&quot;http://store.apple.com/&quot;&gt;Apple Store&lt;/a&gt;&quot; today ? Right now it is down. &lt;br /&gt;
&lt;br /&gt;
They are updating Apple Store for us .Let us hope to see some good stuff .. :)&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/AVvXsEhhvqF8BIPYzfpO_I_9aL1d4atQ0OUk5iXQI5uMeNIkU1Yp7ljXyeLa4sZ1GG_LL7nM7UneXSXkm4ZBSMamZOtQ-hq5gNEVRhuk3TRmdrpVNhz_-rbxCEQHi7YelyeDaZnndDT36drWl5lk/s1600/The+Apple+Store.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;336&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhvqF8BIPYzfpO_I_9aL1d4atQ0OUk5iXQI5uMeNIkU1Yp7ljXyeLa4sZ1GG_LL7nM7UneXSXkm4ZBSMamZOtQ-hq5gNEVRhuk3TRmdrpVNhz_-rbxCEQHi7YelyeDaZnndDT36drWl5lk/s640/The+Apple+Store.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</description><link>http://www.mythoughts.co.in/2012/06/apple-store-is-down.html</link><author>noreply@blogger.com (Unknown)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhvqF8BIPYzfpO_I_9aL1d4atQ0OUk5iXQI5uMeNIkU1Yp7ljXyeLa4sZ1GG_LL7nM7UneXSXkm4ZBSMamZOtQ-hq5gNEVRhuk3TRmdrpVNhz_-rbxCEQHi7YelyeDaZnndDT36drWl5lk/s72-c/The+Apple+Store.png" height="72" width="72"/><thr:total>0</thr:total></item></channel></rss>