<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='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'><id>tag:blogger.com,1999:blog-7671953244112869876</id><updated>2024-08-29T23:33:27.559-07:00</updated><category term="Selenium"/><category term="Selenium Web Driver"/><category term="java"/><category term="Selenium WebDriver"/><category term="selenium rc"/><category term="TestNG"/><category term="webdriver"/><category term="Action Class"/><category term="Switching between Windows using Selenium Webdriver"/><category term="TestNG.xml"/><category term="j2ee"/><category term="jre"/><category term="mac"/><category term="BufferedWriter"/><category term="CSS Drop Down Menu"/><category term="Internet Explorer and Google Chrome Drivers"/><category term="Links on a page"/><category term="MacOS"/><category term="Multipe Browsers testing selenium webdriver"/><category term="Selenium IDE Installation"/><category term="Sub Menu"/><category term="Web Driver"/><category term="android-server.apk"/><category term="capturing screenshot"/><category term="cross browser testing with selenium webdriver."/><category term="getText()"/><category term="handling pupup windows"/><category term="jvm"/><category term="popup"/><category term="selenium profile"/><category term="switch window"/><category term="-firefoxProfileTemplate"/><category term=".class"/><category term="Action"/><category term="Action.doubleClick()"/><category term="Action.perform()"/><category term="Add the required Security Certificates"/><category term="Alert class"/><category term="Alert.accept()"/><category term="Alert.dismiss()"/><category term="Android Mobile Web Application Automation"/><category term="Android Virtual Device"/><category term="Android Web Applications"/><category term="Annotation"/><category term="Apache CommonsIO"/><category term="BufferedReader"/><category term="Create Firefox Profile Template"/><category term="Cusomized Sequence"/><category term="Data"/><category term="Data Driven"/><category term="Date"/><category term="Date Picker"/><category term="Digital Certificate Verifica"/><category term="Eclipse IDE Setup"/><category term="Excel"/><category term="File.seperator"/><category term="FileInputStream"/><category term="FileUtils"/><category term="FileWriter"/><category term="Google Excel"/><category term="HTML Table"/><category term="Handling Date Picker"/><category term="Handling Tables"/><category term="Hotspot"/><category term="InputStream"/><category term="InputStreamReader"/><category term="JQuery Date Picker"/><category term="Javascript prompt"/><category term="MS Excel"/><category term="MS Office"/><category term="Major/Minor Version"/><category term="Menu"/><category term="Mouse Mover"/><category term="Office"/><category term="Open Excel"/><category term="Open Office"/><category term="Previous Date"/><category term="PrintWriter"/><category term="Prioritizing Selenium Test cases"/><category term="Priority"/><category term="Reading input from Excel"/><category term="Robot and StringSelection class"/><category term="Screenshot using Selenium Web Driver"/><category term="Switching between"/><category term="Switching between Windows using RC"/><category term="Switching between Windows using Selenium RC"/><category term="Switching between Windows using Webdriver"/><category term="Table columns"/><category term="Table rows"/><category term="Test Case Priority"/><category term="Unsupported Major/Minor Version issue"/><category term="Wedriver"/><category term="Wi-Fi"/><category term="Word processing using java"/><category term="ZipInputStream"/><category term="adding an image to word document programatically using java"/><category term="adding image to word"/><category term="adding text to word using java"/><category term="alert"/><category term="android automation"/><category term="avd"/><category term="capturing an element"/><category term="class name"/><category term="class path"/><category term="className"/><category term="classpath"/><category term="combo box"/><category term="compound class name"/><category term="confirm"/><category term="console operation"/><category term="cssSelector"/><category term="deriver.getAttribute()"/><category term="doubleClick()"/><category term="driver"/><category term="driver.getWindowHandle()"/><category term="driver.manage()"/><category term="driver.manage().window()"/><category term="driver.manage().window().maximize()"/><category term="driver.navigate().to"/><category term="driver.switchTo()"/><category term="driver.switchto().alert()"/><category term="dropdown"/><category term="extract files"/><category term="file upload using"/><category term="fileOut.println"/><category term="findElements()"/><category term="firefox profile"/><category term="firefox.exe -p"/><category term="handling images"/><category term="html tree structure"/><category term="image processing"/><category term="install java"/><category term="internet sharing"/><category term="java cache"/><category term="java class"/><category term="java classpath"/><category term="java path"/><category term="jdk"/><category term="maximizing window"/><category term="network sharing"/><category term="parallel executing browsers"/><category term="path"/><category term="perform()"/><category term="profile template"/><category term="read files"/><category term="readFileToString"/><category term="readLine()"/><category term="select options with Selenium"/><category term="set path"/><category term="setting java classpath"/><category term="setting java path"/><category term="setting path"/><category term="unzip"/><category term="word processing"/><category term="write files"/><category term="write text files"/><category term="xls sheet"/><title type='text'>Selenium Solutions</title><subtitle type='html'>Simplified Solutions form Real Time Experience</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>42</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-7320842005472376817</id><published>2019-06-11T22:38:00.002-07:00</published><updated>2019-06-11T22:38:40.853-07:00</updated><title type='text'>How to uninstall Java from Mac machine</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Uninstalling software from Mac machine is bit tricky. It is as easy as Windows.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
In this post we will know how to uninstall Java from any Mac machine. Follow the below steps to uninstall successfully from your machine&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Note: We can uninstall the software as an Admin only&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
1. Open terminal&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
2. Copy and past&lt;span&gt; &lt;/span&gt;the following commands one by one&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;code style=&quot;border: 0px; font: 1em/1.5 &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monospace; margin: 1.5em 0px; padding: 0px; vertical-align: baseline; white-space: normal;&quot;&gt;sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span&gt;&lt;/span&gt;&lt;code style=&quot;border: 0px; font: 1em/1.5 &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monospace; margin: 1.5em 0px; padding: 0px; vertical-align: baseline; white-space: normal;&quot;&gt;sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane&lt;/code&gt;&lt;span&gt; &lt;/span&gt;&lt;code style=&quot;border: 0px; font: 1em/1.5 &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monospace; margin: 1.5em 0px; padding: 0px; vertical-align: baseline; white-space: normal;&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;code style=&quot;border: 0px; font: 1em/1.5 &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monospace; margin: 1.5em 0px; padding: 0px; vertical-align: baseline; white-space: normal;&quot;&gt;sudo rm -fr ~/Library/Application\ Support/Oracle/Java &lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp; &lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Do not attempt to uninstall Java by removing the Java tools from /usr/bin. This directory is part of the system software and any changes will be reset by Apple the next time you perform an update of the OS.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
The Java Deployment cache contains files that may have been stored by Java while Java was running. It may also contain settings that were modified through the Java Control Panel.&lt;br /&gt;&lt;br /&gt;These instructions will help you remove the Java Deployment cache, if Java has been uninstalled from the computer. The cache may still be on the computer if it was not removed during the uninstall. If Java is still installed, you may use the uninstall tool, to uninstall Java and select to remove the Java cache.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Remove Oracle Java cache on Mac&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
1. Open terminal&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
2. Copy and past&lt;span&gt; &lt;/span&gt;the following command&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;code style=&quot;border: 0px; font: 1em/1.5 &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monospace; margin: 1.5em 0px; padding: 0px; vertical-align: baseline; white-space: normal;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #333333; display: inline !important; float: none; font-family: &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monospace; font-size: 12px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;rm -r ~/&quot;Library/Application Support/Oracle/Java&quot;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;code style=&quot;border: 0px; font: 1em/1.5 &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monospace; margin: 1.5em 0px; padding: 0px; vertical-align: baseline; white-space: normal;&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: #333333; display: inline !important; float: none; font-family: &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monospace; font-size: 12px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;Source: Oracle &lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/7320842005472376817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2019/06/how-to-uninstall-java-from-mac-machine.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/7320842005472376817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/7320842005472376817'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2019/06/how-to-uninstall-java-from-mac-machine.html' title='How to uninstall Java from Mac machine'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-7871110948946493986</id><published>2019-02-15T20:23:00.000-08:00</published><updated>2019-02-15T20:23:09.763-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Excel"/><category scheme="http://www.blogger.com/atom/ns#" term="Google Excel"/><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><category scheme="http://www.blogger.com/atom/ns#" term="MacOS"/><category scheme="http://www.blogger.com/atom/ns#" term="MS Excel"/><category scheme="http://www.blogger.com/atom/ns#" term="MS Office"/><category scheme="http://www.blogger.com/atom/ns#" term="Office"/><category scheme="http://www.blogger.com/atom/ns#" term="Open Excel"/><category scheme="http://www.blogger.com/atom/ns#" term="Open Office"/><title type='text'>How to use linebreak in Excel on Mac</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
As a regular user of Excel sometimes we need linebreak in an excel spreadsheet cell. On Windows its pretty simple and straight forward solution hit alt+enter. When it comes to Mac, its little bit tricky because there when we try the same the control will move to next cell.&lt;br /&gt;
&lt;br /&gt;
To achieve this on Mac, we have to hit control+option+return keys&lt;br /&gt;
&lt;br /&gt;
Hope this post will help you in addressing the issue you are facing&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/7871110948946493986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2019/02/how-to-use-linebreak-in-excel-on-mac.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/7871110948946493986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/7871110948946493986'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2019/02/how-to-use-linebreak-in-excel-on-mac.html' title='How to use linebreak in Excel on Mac'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-3670568886388388115</id><published>2018-08-05T22:34:00.000-07:00</published><updated>2018-08-05T22:34:49.338-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Hotspot"/><category scheme="http://www.blogger.com/atom/ns#" term="internet sharing"/><category scheme="http://www.blogger.com/atom/ns#" term="MacOS"/><category scheme="http://www.blogger.com/atom/ns#" term="network sharing"/><category scheme="http://www.blogger.com/atom/ns#" term="Wi-Fi"/><title type='text'>How to make our Mac into a WiFi Hotspot</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Our Mac can function as a&amp;nbsp;wireless hotspot, which allows us to connect other devices to it and share its Internet connection.&lt;span&gt;&lt;/span&gt;&lt;a href=&quot;https://www.howtogeek.com/213329/how-to-share-your-smartphones-internet-connection-hotspots-and-tethering-explained/&quot; style=&quot;background-color: transparent; box-sizing: inherit; color: #114491; display: inline; text-decoration: underline;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
This is most useful feature by Mac if our Mac is connected to a wired network via Ethernet. We can connect any wireless devices to Mac and share the wired Internet connection with any wireless device and almost as our Mac works a wireless router.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Below are the steps to achieve this:&lt;/div&gt;
&lt;h2 style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; clear: both; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 21px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 600; letter-spacing: normal; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Enable Internet Sharing and Configure Your&amp;nbsp;Hotspot&lt;/h2&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
The Wi-Fi hotspot option is part of the “Internet Sharing” feature in macOS. You’ll find it in the System Preferences&amp;nbsp;window. Click the Apple menu, select System Preferences, and click the&amp;nbsp;Sharing icon.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;img alt=&quot;&quot; class=&quot;alignnone size-full wp-image-214058&quot; src=&quot;https://www.howtogeek.com/wp-content/uploads/2015/04/ximg_552440abb291a.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic._VvZI6Duf6.png&quot; style=&quot;border: 0px none; box-sizing: inherit; height: auto; max-width: 650px;&quot; /&gt;&lt;/div&gt;
&lt;br class=&quot;Apple-interchange-newline&quot; /&gt;&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Select the “Internet Sharing” option in the list. You’ll now need to select the Internet connection you want to share with the devices.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
The one big limitation is that you can’t both be connected to a Wi-Fi network and&amp;nbsp;host a&amp;nbsp;Wi-Fi network at the same time.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
For example, let’s say your Mac is connected to the Internet through an Ethernet adapter. You’d select Ethernet in the list at the top of the window and&lt;span&gt;&amp;nbsp;&lt;/span&gt;share that wired connection over Wi-Fi. If you’re connected via Bluetooth or tethered to an iPhone via a USB cable, you could also select those.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;img alt=&quot;&quot; class=&quot;alignnone size-full wp-image-214059&quot; src=&quot;https://www.howtogeek.com/wp-content/uploads/2015/04/ximg_5524426ece9f1.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.dV9-NAxN9f.png&quot; style=&quot;border: 0px none; box-sizing: inherit; height: auto; max-width: 650px;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
In&amp;nbsp;the “To computers using” box, enable the&amp;nbsp;Wi-Fi option. This will create a Wi-Fi hotspot, and the Internet connection you selected at the top of the window will be shared with devices that connect to the Wi-Fi network.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Click the “Wi-Fi Options”&amp;nbsp;button at the bottom of the window to configure your Wi-Fi hotspot. Select your preferred network name and the best Wi-Fi channel.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Be sure to click the “Security” box and select “WPA2-Personal” and provide a password. By default, the&amp;nbsp;hotspot will be configured without a password and anyone will be able to connect.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;img alt=&quot;&quot; class=&quot;alignnone size-full wp-image-214060&quot; src=&quot;https://www.howtogeek.com/wp-content/uploads/2015/04/ximg_552442b2d0210.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.YuhtplQWWh.png&quot; style=&quot;border: 0px; box-sizing: inherit; height: auto; max-width: 650px;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
When you’re done setting things up, click the checkbox to the left of Internet Sharing and click Start to activate your Wi-Fi hotspot.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; background-color: white; box-sizing: inherit; color: #404040; font-family: &amp;quot;Open Sans&amp;quot;, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1.5em; orphans: 2; text-align: left; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;img alt=&quot;&quot; class=&quot;alignnone size-full wp-image-214061&quot; src=&quot;https://www.howtogeek.com/wp-content/uploads/2015/04/ximg_552443347dec3.png.pagespeed.gp+jp+jw+pj+ws+js+rj+rp+rw+ri+cp+md.ic.O0Hi6V8Kbw.png&quot; style=&quot;border: 0px; box-sizing: inherit; height: auto; max-width: 650px;&quot; /&gt; &lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/3670568886388388115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2018/08/how-to-make-our-mac-into-wifi-hotspot.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/3670568886388388115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/3670568886388388115'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2018/08/how-to-make-our-mac-into-wifi-hotspot.html' title='How to make our Mac into a WiFi Hotspot'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-583259030440183132</id><published>2018-07-23T00:27:00.000-07:00</published><updated>2018-07-23T00:27:12.629-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="install java"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="jdk"/><category scheme="http://www.blogger.com/atom/ns#" term="jre"/><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><title type='text'>How to Install Java in macOS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;background-color: white; color: #303030; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Verdana, Helvetica, Tahoma, Arial, sans-serif; font-size: 16px; font-variant-ligatures: normal; line-height: 1.9em; margin-bottom: 15px; orphans: 2; padding: 0px; widows: 2;&quot;&gt;
The best approach to install Java on the Mac is to get the latest version of Java JRE directly from Oracle. This is fairly straight forward and you can either initiate the process from the terminal application in macOS or by going directly to the Java download page on Oracles website.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #303030; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Verdana, Helvetica, Tahoma, Arial, sans-serif; font-size: 16px; font-variant-ligatures: normal; line-height: 1.9em; margin-bottom: 15px; orphans: 2; padding: 0px; widows: 2;&quot;&gt;
Open the Terminal app and type the following:&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #303030; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Verdana, Helvetica, Tahoma, Arial, sans-serif; font-size: 16px; font-variant-ligatures: normal; line-height: 1.9em; margin-bottom: 15px; orphans: 2; padding: 0px; widows: 2;&quot;&gt;
java&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #303030; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Verdana, Helvetica, Tahoma, Arial, sans-serif; font-size: 16px; font-variant-ligatures: normal; line-height: 1.9em; margin-bottom: 15px; orphans: 2; padding: 0px; widows: 2;&quot;&gt;
Click on the “More Info” button to jump to the Java downloads page in a web browser&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #303030; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Verdana, Helvetica, Tahoma, Arial, sans-serif; font-size: 16px; font-variant-ligatures: normal; line-height: 1.9em; margin-bottom: 15px; orphans: 2; padding: 0px; widows: 2;&quot;&gt;
Start installing Java on MacOS&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #303030; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Verdana, Helvetica, Tahoma, Arial, sans-serif; font-size: 16px; font-variant-ligatures: normal; line-height: 1.9em; margin-bottom: 15px; orphans: 2; padding: 0px; widows: 2;&quot;&gt;
&lt;img alt=&quot;Start installing Java on MacOS&quot; src=&quot;http://cdn.osxdaily.com/wp-content/uploads/2017/06/start-java-install-macos-610x231.jpg&quot; style=&quot;background-color: transparent;&quot; /&gt;This will allow you to download and install the newest most recent version of Java available for the Mac, which is currently JRE8.&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/583259030440183132/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2018/07/how-to-install-java-in-macos.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/583259030440183132'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/583259030440183132'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2018/07/how-to-install-java-in-macos.html' title='How to Install Java in macOS'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-1802450931906495471</id><published>2018-07-23T00:19:00.000-07:00</published><updated>2018-07-23T00:19:22.682-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java cache"/><category scheme="http://www.blogger.com/atom/ns#" term="jre"/><category scheme="http://www.blogger.com/atom/ns#" term="jvm"/><title type='text'>Remove Oracle Java cache on Mac</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Below are the steps to clear Java cache from any Mac machine:&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;background-color: white; border: 0px; color: #333333; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif; font-size: 12px; font-variant-ligatures: normal; margin: 0px 1.5em 1.5em; orphans: 2; padding: 0px; vertical-align: baseline; widows: 2;&quot;&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Click on the&amp;nbsp;&lt;b&gt;Finder&lt;/b&gt;&amp;nbsp;icon located in your dock&lt;/li&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Click on&amp;nbsp;&lt;b&gt;Go&lt;/b&gt;&amp;nbsp;in the Finder menu&lt;/li&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Click on&amp;nbsp;&lt;b&gt;Utilities&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Double-click on the&amp;nbsp;&lt;b&gt;Terminal&lt;/b&gt;&amp;nbsp;icon&lt;/li&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;In the Terminal window&amp;nbsp;&lt;b&gt;Copy and Paste&lt;/b&gt;&amp;nbsp;the commands below:&lt;br /&gt;&lt;code style=&quot;border: 0px; font-family: &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monospace; font-size: 1em; font-stretch: normal; line-height: 1.5; margin: 1.5em 0px; padding: 0px; vertical-align: baseline;&quot;&gt;rm -r ~/&quot;Library/Application Support/Oracle/Java&quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/1802450931906495471/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2018/07/remove-oracle-java-cache-on-mac.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/1802450931906495471'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/1802450931906495471'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2018/07/remove-oracle-java-cache-on-mac.html' title='Remove Oracle Java cache on Mac'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-7065187117439076958</id><published>2018-07-23T00:15:00.000-07:00</published><updated>2018-07-23T00:15:43.481-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="jre"/><category scheme="http://www.blogger.com/atom/ns#" term="jvm"/><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><title type='text'>Uninstall Oracle Java using the terminal from any Mac machine</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b style=&quot;background-color: white; color: #333333; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif; font-size: 12px; font-variant-ligatures: normal; orphans: 2; widows: 2;&quot;&gt;Note:&lt;/b&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif; font-size: 12px; font-variant-ligatures: normal; orphans: 2; widows: 2;&quot;&gt;&amp;nbsp;To uninstall Java, you must have Administrator privileges and execute the remove command either as root or by using the&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-color: white; border: 0px; color: #333333; font-family: &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monospace; font-size: 12px; font-stretch: normal; line-height: 1.5; margin: 1.5em 0px; orphans: 2; padding: 0px; vertical-align: baseline; widows: 2;&quot;&gt;sudo&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif; font-size: 12px; font-variant-ligatures: normal; orphans: 2; widows: 2;&quot;&gt;&amp;nbsp;tool.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif; font-size: 12px; font-variant-ligatures: normal; orphans: 2; widows: 2;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #333333; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif; font-size: 12px; font-variant-ligatures: normal; margin-bottom: 1.5em; orphans: 2; padding: 0px; vertical-align: baseline; widows: 2;&quot;&gt;
Remove one directory and one file (a symlink), as follows:&lt;/div&gt;
&lt;ol style=&quot;background-color: white; border: 0px; color: #333333; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif; font-size: 12px; font-variant-ligatures: normal; margin: 0px 1.5em 1.5em; orphans: 2; padding: 0px; vertical-align: baseline; widows: 2;&quot;&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Click on the&amp;nbsp;&lt;b&gt;Finder&lt;/b&gt;&amp;nbsp;icon located in your dock&lt;/li&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Click on&amp;nbsp;&lt;b&gt;Go&lt;/b&gt;&amp;nbsp;in the Finder menu&lt;/li&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Click on&amp;nbsp;&lt;b&gt;Utilities&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Double-click on the&amp;nbsp;&lt;b&gt;Terminal&lt;/b&gt;&amp;nbsp;icon&lt;/li&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;In the Terminal window&amp;nbsp;&lt;b&gt;Copy and Paste&lt;/b&gt;&amp;nbsp;the commands below:&lt;br /&gt;&lt;code style=&quot;border: 0px; font-family: &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monospace; font-size: 1em; font-stretch: normal; line-height: 1.5; margin: 1.5em 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin&lt;/code&gt;&lt;br /&gt;&lt;code style=&quot;border: 0px; font-family: &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monospace; font-size: 1em; font-stretch: normal; line-height: 1.5; margin: 1.5em 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane&lt;/code&gt;&lt;br /&gt;&lt;code style=&quot;border: 0px; font-family: &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monospace; font-size: 1em; font-stretch: normal; line-height: 1.5; margin: 1.5em 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sudo rm -fr ~/Library/Application\ Support/Oracle/Java&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif; font-size: 12px; font-variant-ligatures: normal; orphans: 2; widows: 2;&quot;&gt;&lt;span style=&quot;font-variant-ligatures: normal;&quot;&gt;Do not attempt to uninstall Java by removing the Java tools from&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;border: 0px; font-family: &amp;quot;andale mono&amp;quot;, &amp;quot;lucida console&amp;quot;, monospace; font-stretch: normal; line-height: 1.5; margin: 1.5em 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/usr/bin&lt;/code&gt;&lt;span style=&quot;font-variant-ligatures: normal;&quot;&gt;. This directory is part of the system software and any changes will be reset by Apple the next time you perform an update of the OS.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif; font-size: 12px; font-variant-ligatures: normal; orphans: 2; widows: 2;&quot;&gt;&lt;span style=&quot;font-variant-ligatures: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/7065187117439076958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2018/07/uninstall-oracle-java-using-terminal.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/7065187117439076958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/7065187117439076958'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2018/07/uninstall-oracle-java-using-terminal.html' title='Uninstall Oracle Java using the terminal from any Mac machine'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-6664796909919774264</id><published>2017-10-29T11:30:00.001-07:00</published><updated>2017-10-29T11:30:30.668-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="file upload using"/><category scheme="http://www.blogger.com/atom/ns#" term="Robot and StringSelection class"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium"/><category scheme="http://www.blogger.com/atom/ns#" term="Wedriver"/><title type='text'>Uploading file with the help of Robot class in Selenium Automation</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
While implementing automation, we always come across with a situation where our code need to upload a file using our selenium code.&lt;br /&gt;
&lt;br /&gt;
As we know Selenium is a Web Automation tool and which don&#39;t support windows automation. In order to upload a files, we have to perform some Windows based operations.&lt;br /&gt;
&lt;br /&gt;
There are different ways to achieve this. One of the way is to take the support of Robot and StringSelection class.&lt;br /&gt;
&lt;br /&gt;
Below simple code will help to perform file upload as part of Selenium Automation:&lt;br /&gt;
&lt;br /&gt;
import java.awt.AWTException;&lt;br /&gt;
import java.awt.Robot;&lt;br /&gt;
import java.awt.Toolkit;&lt;br /&gt;
import java.awt.datatransfer.StringSelection;&lt;br /&gt;
import java.awt.event.KeyEvent;&lt;br /&gt;
import org.openqa.selenium.By;&lt;br /&gt;
import org.openqa.selenium.WebDriver;&lt;br /&gt;
import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;
&lt;br /&gt;
public class FileUpload {&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String[] args) throws InterruptedException, AWTException {&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;// TODO Auto-generated method stub&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;WebDriver driver = new FirefoxDriver();&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;driver.manage().window().maximize();&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;driver.get(&quot;https://html.com/input-type-file/&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Absolute path of the file need to uploaded&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String fileLocation = &quot;C:\\Users\\testData.xlsx&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // the code which helps us to perform Copy and Paste options from Clipboard&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;StringSelection stringSelection = new StringSelection(fileLocation);&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; driver.findElement(By.id(&quot;fileupload&quot;)).click();&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;// CTRL+V and ENTER keys are the keyboard events to achieve the Keyboard operations&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Robot robot = new Robot();&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;robot.keyPress(KeyEvent.VK_CONTROL);&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;robot.keyPress(KeyEvent.VK_V);&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;robot.keyRelease(KeyEvent.VK_V);&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;robot.keyRelease(KeyEvent.VK_CONTROL);&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;robot.keyPress(KeyEvent.VK_ENTER);&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;Thread.sleep(5000);&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;driver.quit();&lt;br /&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/6664796909919774264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2017/10/uploading-file-with-help-of-robot-class.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/6664796909919774264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/6664796909919774264'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2017/10/uploading-file-with-help-of-robot-class.html' title='Uploading file with the help of Robot class in Selenium Automation'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-1501894133362568691</id><published>2017-10-09T23:13:00.000-07:00</published><updated>2017-10-09T23:13:00.872-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="android-server.apk"/><category scheme="http://www.blogger.com/atom/ns#" term="Apache CommonsIO"/><category scheme="http://www.blogger.com/atom/ns#" term="BufferedWriter"/><category scheme="http://www.blogger.com/atom/ns#" term="FileUtils"/><category scheme="http://www.blogger.com/atom/ns#" term="readFileToString"/><title type='text'>Reading a file as String</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Sometimes we need to read test input from a file(.txt/.xml etc) and enter into a text area field. Below code will help to read the content of file and stored in a string.&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To achieve this we need to take the help of Apache CommonsIO. This will be available at&amp;nbsp;&lt;a href=&quot;http://commons.apache.org/proper/commons-io/download_io.cgi&quot;&gt;Apache CommonsIO&lt;/a&gt;&amp;nbsp;and download&amp;nbsp; zip file&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Extract the zip file and you will find&amp;nbsp;commons-io-2.5.jar file&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Add the jar file to the project&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
import java.io.File;&lt;/div&gt;
&lt;div&gt;
import java.nio.charset.Charset;&lt;/div&gt;
&lt;div&gt;
import org.apache.commons.io.FileUtils;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
public class ReadFileToString {&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static void main(String[] args){&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;File inputFile = new File(&quot;d://test.xml&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;//location of the tile&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Reading file to string&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;String str = FileUtils.readFileToString(inputFile,Charset.forName(&quot;utf-8&quot;));&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;nbsp; &amp;nbsp;System.out.println(str);&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; } catch (Exception e) {&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;nbsp; &amp;nbsp; e.printStackTrace();&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
With the help of above code, we can have the content of file. Now we can use the variable to enter the text in text area input field.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
In this case,&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
driver.findElement(By.id(&quot;TextArea&quot;)).sendKeys(str);&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/1501894133362568691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2017/10/reading-file-as-string.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/1501894133362568691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/1501894133362568691'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2017/10/reading-file-as-string.html' title='Reading a file as String'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-4877922472449170097</id><published>2014-01-03T02:35:00.001-08:00</published><updated>2014-01-03T02:35:14.585-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".class"/><category scheme="http://www.blogger.com/atom/ns#" term="console operation"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium Web Driver"/><category scheme="http://www.blogger.com/atom/ns#" term="TestNG"/><category scheme="http://www.blogger.com/atom/ns#" term="TestNG.xml"/><title type='text'>Running Selenium Script from console/command prompt using .class instead of .java file - TestNG</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Purpose: Running Selenium Script from console/command prompt using .class instead of .java file&amp;nbsp;with out JDK&amp;nbsp;- TestNG&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
Some times we need to run our automation script at client box to demonstrate our ability to automate but we don&#39;t want to share our code with out JDK ( required - JRE). We can achieve this by following below steps. With this we can run the script from .class instead&amp;nbsp;of .java file.&lt;br /&gt;
&lt;br /&gt;
We can achieve this using both JUnit and TestNG. In this example we are working with TestNG&lt;br /&gt;
&lt;br /&gt;
Here my example is GoogleConsole.java&lt;br /&gt;
&lt;br /&gt;
Step 1: Prepare required scrip using any IDE and compile&lt;br /&gt;
Step 2: Open command prompt in another system and check whether JRE is available&lt;br /&gt;
Step 3: Prepare testing.xml file as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!DOCTYPE suite SYSTEM &quot;&lt;a href=&quot;http://testng.org/testng-1.0.dtd&quot;&gt;http://testng.org/testng-1.0.dtd&lt;/a&gt;&quot;&amp;gt;&lt;br /&gt;&amp;lt;suite name=&quot;Google&quot;&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;test name=&quot;GoogleConsloe&quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;classes&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;class name=&quot;GoogleConsole&quot;/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/classes&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/test&amp;gt;&lt;br /&gt;&amp;lt;/suite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Step 3: Copy selenium standalone server, TestNG.jar, .class and testing.xml files to a folder&lt;strong&gt;(D:\Google\)&lt;/strong&gt;&lt;br /&gt;
Step 4: Open command prompt and change to D:\Google\&lt;br /&gt;
Step 5: Set path using the following command&lt;br /&gt;
set classpath=%classpath%;D:\Google\selenium-server-standalone-2.39.0.jar;D:\Google\testng-6.8.jar;.;&lt;br /&gt;
&lt;br /&gt;
*Note: update the paths of the .jar files and .class file according to your path.&lt;br /&gt;
&lt;br /&gt;
Step 6: Run the class file using the following command&lt;br /&gt;
&lt;br /&gt;
java org.testng.TestNG java org.testng.TestNG testng.xml&lt;br /&gt;
&lt;br /&gt;
Now you can see the bowser will open and perform the required operation without code and eclipse&lt;br /&gt;
&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/4877922472449170097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2014/01/running-selenium-script-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/4877922472449170097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/4877922472449170097'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2014/01/running-selenium-script-from.html' title='Running Selenium Script from console/command prompt using .class instead of .java file - TestNG'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-1154237842460494760</id><published>2013-12-02T21:59:00.000-08:00</published><updated>2013-12-02T21:59:54.401-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="class path"/><category scheme="http://www.blogger.com/atom/ns#" term="classpath"/><category scheme="http://www.blogger.com/atom/ns#" term="java class"/><category scheme="http://www.blogger.com/atom/ns#" term="java classpath"/><category scheme="http://www.blogger.com/atom/ns#" term="java path"/><category scheme="http://www.blogger.com/atom/ns#" term="path"/><category scheme="http://www.blogger.com/atom/ns#" term="set path"/><category scheme="http://www.blogger.com/atom/ns#" term="setting java classpath"/><category scheme="http://www.blogger.com/atom/ns#" term="setting java path"/><category scheme="http://www.blogger.com/atom/ns#" term="setting path"/><title type='text'>Classpath Setup for Java - Windows</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Purpose: Classpath Setup for Java - Windows 7&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
We all know the importance of CLASSPATH for Java. Setting PATH/CLASSPATH is very easy but some of us facing difficulties. For them I want to contribute from my blog. Following steps will provide how easy we can set CLASSPATH/PATH for Java.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 1: Download and install Java if not available on your box. You can download from the following URL:&lt;br /&gt;
&lt;a href=&quot;http://www.oracle.com/technetwork/java/javase/downloads/index.html&quot;&gt;http://www.oracle.com/technetwork/java/javase/downloads/index.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Step 2: By default JDK will be install at &quot;C:\Program Files\Java\jdkxxx.xx&quot; location only. Unless we change the location at the time of installation this is the default location.&lt;br /&gt;
&lt;br /&gt;
Step 3: Go to JDK installed location and you will find &lt;strong&gt;bin&lt;/strong&gt; folder and open that one. copy the bin folder path.&lt;br /&gt;
&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/AVvXsEh3nQpu3E6xbu-lloDm39DAR3u5C4HLGkIDd5Ajag14iwb7skhkNMt1VkcEI5uWCX1zHCygiNOL6gVR64w4-LKNJtAuov9KdJjGbzyF9eE4iTwPaoCzqg9YkrFlHwdBTnHj5Mn20-eZJuX1/s1600/bin.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/AVvXsEh3nQpu3E6xbu-lloDm39DAR3u5C4HLGkIDd5Ajag14iwb7skhkNMt1VkcEI5uWCX1zHCygiNOL6gVR64w4-LKNJtAuov9KdJjGbzyF9eE4iTwPaoCzqg9YkrFlHwdBTnHj5Mn20-eZJuX1/s1600/bin.png&quot; height=&quot;300&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 4: Right Click on My Computer and Select &lt;strong&gt;&quot;Properties&quot;&lt;/strong&gt;. Once the &lt;strong&gt;Properties&lt;/strong&gt; window is opened click on &lt;strong&gt;Advanced System Settings&lt;/strong&gt;.&lt;br /&gt;
&lt;br /&gt;
Step 5: Once &lt;strong&gt;Advance System Settings&lt;/strong&gt; window is opened click on &lt;strong&gt;Environment Variables option&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&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/AVvXsEhy4NrEFLv8KK0e44lDIHhwGt0V8fQSH38OGVXmXf46prvGlcC16lRlb1QjcJRZo3p7s_GhrTu7QW_Ul-ewAbZLZLRGiI9Q95dTSxeIeLaMO089AlVQ5J66JEw77wMeufloCZbc1GefssEu/s1600/ev.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/AVvXsEhy4NrEFLv8KK0e44lDIHhwGt0V8fQSH38OGVXmXf46prvGlcC16lRlb1QjcJRZo3p7s_GhrTu7QW_Ul-ewAbZLZLRGiI9Q95dTSxeIeLaMO089AlVQ5J66JEw77wMeufloCZbc1GefssEu/s1600/ev.png&quot; height=&quot;320&quot; width=&quot;286&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 6: Once &lt;strong&gt;Environment Variables &lt;/strong&gt;window is opened click on &lt;strong&gt;New &lt;/strong&gt;under &lt;strong&gt;System Variables&lt;/strong&gt; and enter &lt;strong&gt;Variable Name &lt;/strong&gt;as &lt;strong&gt;PATH&lt;/strong&gt; and &lt;strong&gt;Variable Values&lt;/strong&gt;&amp;nbsp; as &lt;strong&gt;Path of Java Bin Folder(previously copied path)&lt;/strong&gt; and click OK&lt;br /&gt;
&lt;strong&gt;&lt;/strong&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/AVvXsEgzrhhPTGOhcOzhvzuQHBAfLyoXtb7fOETsQ8kCpLPgXHkVydj95yv0Zt_dITfdWmSdBSbzJQxMq4CfxdKPtv3eFl2EMxNFq0PYlYmNJzZFHtC3t09Ke2QGRy_lgO8buRizUKC2jheEqGXF/s1600/path.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/AVvXsEgzrhhPTGOhcOzhvzuQHBAfLyoXtb7fOETsQ8kCpLPgXHkVydj95yv0Zt_dITfdWmSdBSbzJQxMq4CfxdKPtv3eFl2EMxNFq0PYlYmNJzZFHtC3t09Ke2QGRy_lgO8buRizUKC2jheEqGXF/s1600/path.png&quot; height=&quot;320&quot; width=&quot;306&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 7: Go to JDK folder -&amp;gt; open lib folder and copy the path&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/AVvXsEjJf8gPY1rA2XXz556SyJSlwf8p0mvihchibrVhGUDcbNbtrCd8jfFrFAA8fr4R_919V2bY8P4EIwbrKBg6fQ-x62LNNPw_ORrZnlJ6L4IusvKyQfu7T5wslZLdLCFlvvlkSj2Z7kLGOcWW/s1600/lib.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/AVvXsEjJf8gPY1rA2XXz556SyJSlwf8p0mvihchibrVhGUDcbNbtrCd8jfFrFAA8fr4R_919V2bY8P4EIwbrKBg6fQ-x62LNNPw_ORrZnlJ6L4IusvKyQfu7T5wslZLdLCFlvvlkSj2Z7kLGOcWW/s1600/lib.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 8: Repeat the steps 4 and 5.&amp;nbsp;Now click on &lt;strong&gt;New &lt;/strong&gt;under &lt;strong&gt;User Variables&lt;/strong&gt; and enter &lt;strong&gt;User Variable &lt;/strong&gt;as &lt;strong&gt;CLASS&lt;/strong&gt; and &lt;strong&gt;Variable Values &lt;/strong&gt;as Path of the lib folder and click on OK&lt;br /&gt;
&lt;br /&gt;
&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/AVvXsEgJNEkKUbpBBuJ9siI0piu3hZbEogguuzJ4QwyAHg7r-BbPbhg6HCsmkDguHfzOLymlVv-OR6uYH2h8IsdasN5xr1kyQszM4CXS34kzuB6UdcdlJIMxXVGBW6Pt7LEW-T2YGXqNwftBGqm5/s1600/class.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/AVvXsEgJNEkKUbpBBuJ9siI0piu3hZbEogguuzJ4QwyAHg7r-BbPbhg6HCsmkDguHfzOLymlVv-OR6uYH2h8IsdasN5xr1kyQszM4CXS34kzuB6UdcdlJIMxXVGBW6Pt7LEW-T2YGXqNwftBGqm5/s1600/class.png&quot; height=&quot;320&quot; width=&quot;304&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Step 9:&amp;nbsp;&amp;nbsp;Click on OK of Environment Variables window and System Properties window&lt;br /&gt;
&lt;br /&gt;
Step 10: Open Command Prompt and run any java program and you are able to successfully complete.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/1154237842460494760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/12/classpath-setup-for-java-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/1154237842460494760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/1154237842460494760'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/12/classpath-setup-for-java-windows.html' title='Classpath Setup for Java - Windows'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3nQpu3E6xbu-lloDm39DAR3u5C4HLGkIDd5Ajag14iwb7skhkNMt1VkcEI5uWCX1zHCygiNOL6gVR64w4-LKNJtAuov9KdJjGbzyF9eE4iTwPaoCzqg9YkrFlHwdBTnHj5Mn20-eZJuX1/s72-c/bin.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-7053441670076706000</id><published>2013-11-27T04:51:00.000-08:00</published><updated>2013-11-27T04:51:35.895-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cross browser testing with selenium webdriver."/><category scheme="http://www.blogger.com/atom/ns#" term="Multipe Browsers testing selenium webdriver"/><category scheme="http://www.blogger.com/atom/ns#" term="parallel executing browsers"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium WebDriver"/><category scheme="http://www.blogger.com/atom/ns#" term="TestNG.xml"/><title type='text'>Executing same selenium script with multiple browsers only or cross browser testing - Opening Browsers Parallel</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Purpose: Executing same selenium script with multiple browsers only or cross browser testing - Opening Browsers Parallel&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
In my previous post I provided one way of executing same script with different browsers. Now I am going to show how to run the same script parallel(opening all the browsers at time)&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Only the change is very small but I wontedly keeping the post separately to avoid the confusion.&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
The parallel attribute on the &amp;lt;suite&amp;gt; tag can take one of following values:&lt;br /&gt;
&lt;br /&gt;&amp;lt;suite name=&quot;My suite&quot; parallel=&quot;methods&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
parallel=&quot;methods&quot;: TestNG will run all your test methods in separate threads. Dependent methods will also run in separate threads but they will respect the order that you specified.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;suite name=&quot;My suite&quot; parallel=&quot;tests&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
parallel=&quot;tests&quot;: TestNG will run all the methods in the same &amp;lt;test&amp;gt; tag in the same thread, but each &amp;lt;test&amp;gt; tag will be in a separate thread. This allows you to group all your classes that are not thread safe in the same &amp;lt;test&amp;gt; and guarantee they will all run in the same thread while taking advantage of TestNG using as many threads as possible to run your tests.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;suite name=&quot;My suite&quot; parallel=&quot;classes&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
parallel=&quot;classes&quot;: TestNG will run all the methods in the same class in the same thread, but each class will be run in a separate thread.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;suite name=&quot;My suite&quot; parallel=&quot;instances&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
parallel=&quot;instances&quot;: TestNG will run all the methods in the same instance in the same thread, but two methods on two different instances will be running in different threads.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From the above parameters: we will use parallel=&quot;tests&quot; to achieve our goal.&lt;br /&gt;
&lt;br /&gt;
Step 1: We need to write our case with small change by passing a parameter.&lt;br /&gt;
&lt;br /&gt;
import org.openqa.selenium.WebDriver;&lt;br /&gt;
import org.openqa.selenium.chrome.ChromeDriver;&lt;br /&gt;
import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;
import org.openqa.selenium.ie.InternetExplorerDriver;&lt;br /&gt;
import org.testng.annotations.AfterMethod;&lt;br /&gt;
import org.testng.annotations.BeforeMethod;&lt;br /&gt;
import org.testng.annotations.Parameters;&lt;br /&gt;
import org.testng.annotations.Test;&lt;br /&gt;
public class MultiBrowser {&lt;br /&gt;
&amp;nbsp;private WebDriver driver;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;@Parameters(&quot;browser&quot;)&lt;br /&gt;
&amp;nbsp;@BeforeMethod&lt;br /&gt;
&amp;nbsp;public void setup(String browser)&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;if(browser.equalsIgnoreCase(&quot;firefox&quot;))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;driver = new FirefoxDriver();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;else if(browser.equalsIgnoreCase(&quot;iexplorer&quot;))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
// Update the&amp;nbsp;driver path with your location&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;System.setProperty(&quot;webdriver.ie.driver&quot;, &quot;Drivers\\IEDriverServer.exe&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;driver = new InternetExplorerDriver();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;else if(browser.equalsIgnoreCase(&quot;chrome&quot;))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
// Update the&amp;nbsp;driver path with your location&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;Drivers\\chromedriver.exe&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;driver = new ChromeDriver();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;driver.manage().window().maximize();&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;@AfterMethod&lt;br /&gt;
&amp;nbsp;public void tearDown()&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;driver.quit();&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;@Test&lt;br /&gt;
&amp;nbsp;public void testMultiBrowser() throws InterruptedException&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;driver.get(&quot;&lt;a href=&quot;http://www.google.com/&quot;&gt;http://www.google.com&lt;/a&gt;&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
2. Now we need to create TestNG.xml and write the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE suite SYSTEM &quot;&lt;a href=&quot;http://testng.org/testng-1.0.dtd&quot;&gt;http://testng.org/testng-1.0.dtd&lt;/a&gt;&quot; &amp;gt;&lt;br /&gt;
&amp;lt;suite name=&quot;MultiBrowser&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;test name=&quot;TestFirefox&quot; verbose=&quot;10&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;parameter name=&quot;browser&quot; value=&quot;firefox&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;classes&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;class name=&quot;MultiBrowser&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/classes&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/test&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;test name=&quot;ChromeTest&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;parameter name=&quot;browser&quot; value=&quot;chrome&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;classes&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;class name=&quot;MultiBrowser&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/classes&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/test&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;test name=&quot;IETest&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;parameter name=&quot;browser&quot; value=&quot;iexplorer&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;classes&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;class name=&quot;MultiBrowser&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/classes&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/test&amp;gt;&lt;br /&gt;
&amp;lt;/suite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Now run the code from TestNG.xml&lt;br /&gt;
&lt;br /&gt;
You can observer all the three browsers will open and perform the task at a time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/7053441670076706000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/11/executing-same-selenium-script-with_27.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/7053441670076706000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/7053441670076706000'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/11/executing-same-selenium-script-with_27.html' title='Executing same selenium script with multiple browsers only or cross browser testing - Opening Browsers Parallel'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-255679204187084754</id><published>2013-11-22T00:35:00.001-08:00</published><updated>2013-11-22T10:16:51.768-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cross browser testing with selenium webdriver."/><category scheme="http://www.blogger.com/atom/ns#" term="Multipe Browsers testing selenium webdriver"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium WebDriver"/><category scheme="http://www.blogger.com/atom/ns#" term="TestNG.xml"/><title type='text'>Executing same selenium script with multiple browsers onfly or cross browser testing</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Purpose: Executing same selenium script with multiple browsers&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Testing in multiple browsers or Browser compatibility Testing: these are the word we always bother while automating our Test Cases. Following code will help how to execute the same script with multiple browsers.&lt;br /&gt;
&lt;br /&gt;
Step 1: We need to write our case with small change by passing a parameter.&lt;br /&gt;
&lt;br /&gt;
import org.openqa.selenium.WebDriver;&lt;br /&gt;
import org.openqa.selenium.chrome.ChromeDriver;&lt;br /&gt;
import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;
import org.openqa.selenium.ie.InternetExplorerDriver;&lt;br /&gt;
import org.testng.annotations.AfterMethod;&lt;br /&gt;
import org.testng.annotations.BeforeMethod;&lt;br /&gt;
import org.testng.annotations.Parameters;&lt;br /&gt;
import org.testng.annotations.Test;&lt;br /&gt;
public class MultiBrowser {&lt;br /&gt;
&amp;nbsp;private WebDriver driver;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;@Parameters(&quot;browser&quot;)&lt;br /&gt;
&amp;nbsp;@BeforeMethod&lt;br /&gt;
&amp;nbsp;public void setup(String browser)&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;if(browser.equalsIgnoreCase(&quot;firefox&quot;))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;driver = new FirefoxDriver();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;else if(browser.equalsIgnoreCase(&quot;iexplorer&quot;))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
// Update the&amp;nbsp;driver path with your location&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;System.setProperty(&quot;webdriver.ie.driver&quot;, &quot;Drivers\\IEDriverServer.exe&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;driver = new InternetExplorerDriver();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;else if(browser.equalsIgnoreCase(&quot;chrome&quot;))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
// Update the&amp;nbsp;driver path with your location&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;Drivers\\chromedriver.exe&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;driver = new ChromeDriver();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;driver.manage().window().maximize();&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;@AfterMethod&lt;br /&gt;
&amp;nbsp;public void tearDown()&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;driver.quit();&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;@Test&lt;br /&gt;
&amp;nbsp;public void testMultiBrowser() throws InterruptedException&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;driver.get(&quot;&lt;a href=&quot;http://www.google.com/&quot;&gt;http://www.google.com&lt;/a&gt;&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
2. Now we need to create TestNG.xml and write the following code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE suite SYSTEM &quot;&lt;a href=&quot;http://testng.org/testng-1.0.dtd&quot;&gt;http://testng.org/testng-1.0.dtd&lt;/a&gt;&quot; &amp;gt;&lt;br /&gt;
&amp;lt;suite name=&quot;MultiBrowser&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;test name=&quot;TestFirefox&quot; verbose=&quot;10&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;parameter name=&quot;browser&quot; value=&quot;firefox&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;classes&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;class name=&quot;MultiBrowser&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/classes&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/test&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;test name=&quot;ChromeTest&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;parameter name=&quot;browser&quot; value=&quot;chrome&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;classes&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;class name=&quot;MultiBrowser&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/classes&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/test&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;test name=&quot;IETest&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;parameter name=&quot;browser&quot; value=&quot;iexplorer&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;classes&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;class name=&quot;MultiBrowser&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/classes&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/test&amp;gt;&lt;br /&gt;
&amp;lt;/suite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Now run the code from TestNG.xml&lt;br /&gt;
&lt;br /&gt;
You can observer all the three browsers will open and perform the task one another.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/255679204187084754/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/11/executing-same-selenium-script-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/255679204187084754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/255679204187084754'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/11/executing-same-selenium-script-with.html' title='Executing same selenium script with multiple browsers onfly or cross browser testing'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-3959756765219956725</id><published>2013-11-17T22:31:00.000-08:00</published><updated>2013-11-17T22:31:38.333-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Annotation"/><category scheme="http://www.blogger.com/atom/ns#" term="Prioritizing Selenium Test cases"/><category scheme="http://www.blogger.com/atom/ns#" term="Priority"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium Web Driver"/><category scheme="http://www.blogger.com/atom/ns#" term="TestNG"/><title type='text'>Prioritizing Selenium Test cases using TestNG annotations</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Purpose: Prioritizing Selenium Test cases using TestNG annotations&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Some times we may need to priorities our test cases based on some requirements. Following code will help you all.&lt;br /&gt;
&lt;br /&gt;
import org.openqa.selenium.WebDriver;&lt;br /&gt;import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;import org.testng.annotations.AfterMethod;&lt;br /&gt;import org.testng.annotations.BeforeMethod;&lt;br /&gt;import org.testng.annotations.Test;&lt;br /&gt;
public class PriorityParam {&lt;br /&gt;&amp;nbsp;public WebDriver driver;&lt;br /&gt;&amp;nbsp;public String baseURL;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@BeforeMethod&lt;br /&gt;&amp;nbsp;public void setup()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver = new FirefoxDriver();&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.manage().window().maximize();&lt;br /&gt;&amp;nbsp;&amp;nbsp;baseURL = &quot;&lt;a href=&quot;http://mail.google.com/&quot;&gt;http://mail.google.com&lt;/a&gt;&quot;;&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@AfterMethod&lt;br /&gt;&amp;nbsp;public void tearDown()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.quit();&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@Test(priority=3)&lt;br /&gt;&amp;nbsp;public void testPriorityParam() throws InterruptedException&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.get(baseURL);&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;System.out.println(&quot;Priority 3&quot;);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@Test(priority=2)&lt;br /&gt;&amp;nbsp;public void testPriorityParam1() throws InterruptedException&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.get(baseURL);&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;System.out.println(&quot;Priority 2&quot;);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@Test(priority=4)&lt;br /&gt;&amp;nbsp;public void testPriorityParam2() throws InterruptedException&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.get(baseURL);&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;System.out.println(&quot;Priority 4&quot;);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/3959756765219956725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/11/prioritizing-selenium-test-cases-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/3959756765219956725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/3959756765219956725'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/11/prioritizing-selenium-test-cases-using.html' title='Prioritizing Selenium Test cases using TestNG annotations'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-4051819752825877359</id><published>2013-11-14T00:55:00.000-08:00</published><updated>2013-11-14T00:55:11.804-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="combo box"/><category scheme="http://www.blogger.com/atom/ns#" term="dropdown"/><category scheme="http://www.blogger.com/atom/ns#" term="select options with Selenium"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium WebDriver"/><title type='text'>Different Operations on Combo Box / Dropdown / Select Option using Selenium Web Driver</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Purpose: Different Operations on Combo Box / Dropdown using Selenium Web Driver&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
We always encounter Combo Box / Dropdown / Select options and following example will help you how to perform different operations.&lt;br /&gt;
&lt;br /&gt;
import java.util.ArrayList;&lt;br /&gt;import java.util.List;&lt;br /&gt;import org.openqa.selenium.By;&lt;br /&gt;import org.openqa.selenium.WebDriver;&lt;br /&gt;import org.openqa.selenium.WebElement;&lt;br /&gt;import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;import org.openqa.selenium.support.ui.Select;&lt;br /&gt;import org.testng.annotations.AfterTest;&lt;br /&gt;import org.testng.annotations.BeforeTest;&lt;br /&gt;import org.testng.annotations.Test;&lt;br /&gt;
&lt;br /&gt;public class SelectOption {&lt;br /&gt;
&amp;nbsp;public WebDriver driver;&lt;br /&gt;&amp;nbsp;public String baseURL;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@BeforeTest&lt;br /&gt;&amp;nbsp;public void setup()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver = new FirefoxDriver();&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.manage().window().maximize();&lt;br /&gt;&amp;nbsp;&amp;nbsp;baseURL = &quot;&lt;a href=&quot;http://hscripts.com/tutorials/html/form-combobox.php&quot;&gt;http://hscripts.com/tutorials/html/form-combobox.php&lt;/a&gt;&quot;;&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@AfterTest&lt;br /&gt;&amp;nbsp;public void tearDown()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.quit();&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@Test&lt;br /&gt;&amp;nbsp;public void testSelectOption() throws InterruptedException&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.get(baseURL);&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;WebElement select = driver.findElement(By.xpath(&quot;.//form[1]/select&quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;WebElement multiSelect = driver.findElement(By.xpath(&quot;.//form[3]/select&quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;List&amp;lt;WebElement&amp;gt; selectedValues = new ArrayList&amp;lt;&amp;gt;();&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;Select dropdown = new Select(select);&lt;br /&gt;&amp;nbsp;&amp;nbsp;dropdown.deselectAll();&lt;br /&gt;&amp;nbsp;&amp;nbsp;dropdown.selectByValue(&quot;two&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;selectedValues = dropdown.getAllSelectedOptions();&lt;br /&gt;&amp;nbsp;&amp;nbsp;for(WebElement value: selectedValues)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println(&quot;Selected Value: &quot;+value.getText());&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;dropdown = new Select(multiSelect);&lt;br /&gt;&amp;nbsp;&amp;nbsp;dropdown.deselectAll();&lt;br /&gt;&amp;nbsp;&amp;nbsp;dropdown.selectByValue(&quot;three&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;dropdown.selectByValue(&quot;four&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;selectedValues = dropdown.getAllSelectedOptions();&lt;br /&gt;&amp;nbsp;&amp;nbsp;for(WebElement value: selectedValues)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println(&quot;Selected Value: &quot;+value.getText());&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;dropdown.deselectAll();&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/4051819752825877359/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/11/different-operations-on-combo-box.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/4051819752825877359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/4051819752825877359'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/11/different-operations-on-combo-box.html' title='Different Operations on Combo Box / Dropdown / Select Option using Selenium Web Driver'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-6082107713619721247</id><published>2013-10-16T22:33:00.001-07:00</published><updated>2013-10-16T22:38:46.132-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="BufferedReader"/><category scheme="http://www.blogger.com/atom/ns#" term="BufferedWriter"/><category scheme="http://www.blogger.com/atom/ns#" term="FileInputStream"/><category scheme="http://www.blogger.com/atom/ns#" term="fileOut.println"/><category scheme="http://www.blogger.com/atom/ns#" term="FileWriter"/><category scheme="http://www.blogger.com/atom/ns#" term="InputStream"/><category scheme="http://www.blogger.com/atom/ns#" term="InputStreamReader"/><category scheme="http://www.blogger.com/atom/ns#" term="PrintWriter"/><category scheme="http://www.blogger.com/atom/ns#" term="read files"/><category scheme="http://www.blogger.com/atom/ns#" term="readLine()"/><category scheme="http://www.blogger.com/atom/ns#" term="write files"/><category scheme="http://www.blogger.com/atom/ns#" term="write text files"/><title type='text'>Reading Test Data from Text File and Writing in to Text File</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Purpose: Reading Test Data from Text File and Writing in to Text File&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Some times we may need to read test data from text file. We can achieve this using simple Java snippet. following code will help you to address this&lt;br /&gt;
&lt;br /&gt;
import java.io.*;&lt;br /&gt;
public class ReadTextFile {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String[] args){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String readFile =&quot;D://test.txt&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String writeFile =&quot;D://test1.txt&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //reading contents from a text file&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InputStream ips=new FileInputStream(readFile); &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InputStreamReader ipsr=new InputStreamReader(ips);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BufferedReader br=new BufferedReader(ipsr);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String line;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; br.readLine();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String[] n = null;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while ((line =br.readLine())!=null){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;n = line.split(&quot;,&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for(int i = 0; i &amp;lt; n.length; i++)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;System.out.print(n[i]);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println(&quot;\n&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; br.close(); &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception e){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(e.toString());&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //writing to a text file&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileWriter fw = new FileWriter (writeFile);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BufferedWriter bw = new BufferedWriter (fw);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PrintWriter fileOut = new PrintWriter (bw);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileOut.println (&quot;\n1. Writing Content to text file&quot;); &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileOut.println (&quot;\n2. Writing content to text file&quot;); &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileOut.close();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception e){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(e.toString());&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Inupt file contents(test.txt):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First Name:, User First Name&lt;br /&gt;Last Name:, User Last Name&lt;br /&gt;User Name:, User Name&lt;br /&gt;Password:, Password&lt;br /&gt;Email:, email&lt;br /&gt;First Name:, User First Name&lt;br /&gt;Last Name:, User Last Name&lt;br /&gt;User Name:, User Name1&lt;br /&gt;Password:, Password1&lt;br /&gt;Email:, email1&lt;br /&gt;
&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/6082107713619721247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/10/reading-test-data-from-text-file-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/6082107713619721247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/6082107713619721247'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/10/reading-test-data-from-text-file-and.html' title='Reading Test Data from Text File and Writing in to Text File'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-8917861850467904482</id><published>2013-09-29T23:28:00.000-07:00</published><updated>2013-09-29T23:28:58.351-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="class name"/><category scheme="http://www.blogger.com/atom/ns#" term="className"/><category scheme="http://www.blogger.com/atom/ns#" term="compound class name"/><category scheme="http://www.blogger.com/atom/ns#" term="cssSelector"/><category scheme="http://www.blogger.com/atom/ns#" term="getText()"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium Web Driver"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium WebDriver"/><title type='text'>Reading an element contnet without using XPath by WebDriver</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Purpose: Reading an element contnet without using XPath by WebDriver&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Some times we can access an element with class only but the class contans compound values but className will not accept compound values.&lt;br /&gt;
&lt;br /&gt;
In order to handle these situatuions we need to write differently. Following code will help you to handle it.&lt;br /&gt;
&lt;br /&gt;
import org.openqa.selenium.By;&lt;br /&gt;import org.openqa.selenium.WebDriver;&lt;br /&gt;import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;import org.testng.annotations.AfterClass;&lt;br /&gt;import org.testng.annotations.BeforeClass;&lt;br /&gt;import org.testng.annotations.Test;&lt;br /&gt;
public class Webelements {&lt;br /&gt;&amp;nbsp;static WebDriver driver;&lt;br /&gt;
&amp;nbsp;// Browser startup&lt;br /&gt;
&amp;nbsp;@BeforeClass&lt;br /&gt;&amp;nbsp;public void setup() {&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver = new FirefoxDriver();&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;// Functionality of Test Case&lt;br /&gt;
&amp;nbsp;@Test&lt;br /&gt;&amp;nbsp;public void testGoogle() throws InterruptedException, IOException {&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.get(&quot;&lt;a href=&quot;http://quirksmode.org/css/selectors/multipleclasses.html&quot;&gt;http://quirksmode.org/css/selectors/multipleclasses.html&lt;/a&gt;&quot;);&lt;br /&gt;
//&amp;nbsp;&amp;nbsp;System.out.println(driver.findElement(By.className(&quot;underline small&quot;)).getText());&lt;br /&gt;&amp;nbsp;&amp;nbsp;System.out.println(driver.findElement(By.cssSelector(&quot;p[class=&#39;underline small&#39;]&quot;)).getText());&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;@AfterClass&lt;br /&gt;&amp;nbsp;public void tear() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.close();&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/8917861850467904482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/reading-element-contnet-without-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/8917861850467904482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/8917861850467904482'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/reading-element-contnet-without-using.html' title='Reading an element contnet without using XPath by WebDriver'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-4113754887694828304</id><published>2013-09-25T22:07:00.000-07:00</published><updated>2013-09-25T22:07:08.400-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="html tree structure"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium Web Driver"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium WebDriver"/><title type='text'>Expanding Tree Structure using Selenium Web Driver</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Purpose: Expanding Tree Structure using Selenium Web Driver&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
Following code will help how to expand tree structure with the help of Selenium WebDriver. Every Tree Structure have its own levels. Following code will help to go 2 level expansion.&lt;br /&gt;
&lt;br /&gt;
import java.util.List;&lt;br /&gt;import org.openqa.selenium.By;&lt;br /&gt;import org.openqa.selenium.WebDriver;&lt;br /&gt;import org.openqa.selenium.WebElement;&lt;br /&gt;import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;import org.testng.annotations.AfterMethod;&lt;br /&gt;import org.testng.annotations.BeforeMethod;&lt;br /&gt;import org.testng.annotations.Test;&lt;br /&gt;
public class TreeStructure {&lt;br /&gt;
&amp;nbsp;public String baseURL = &quot;&lt;a href=&quot;http://www.javascripttoolbox.com/lib/mktree/&quot;&gt;http://www.javascripttoolbox.com/lib/mktree/&lt;/a&gt;&quot;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;public WebDriver driver = new FirefoxDriver();&lt;br /&gt;&amp;nbsp;@BeforeMethod&lt;br /&gt;&amp;nbsp;public void setup()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.get(baseURL);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@AfterMethod&lt;br /&gt;&amp;nbsp;public void tear()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.quit();&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@Test&lt;br /&gt;&amp;nbsp;public void testTreeStructure() throws InterruptedException&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.findElement(By.xpath(&quot;html/body/table/tbody/tr[2]/td[1]/div[2]/div[2]/p[6]/a[2]&quot;)).click();&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;List&amp;lt;WebElement&amp;gt; roots = driver.findElements(By.xpath(&quot;.//*[@id=&#39;tree1&#39;]/li&quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;int rootSize = 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;for(WebElement root: roots)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;String openRoot = root.getAttribute(&quot;class&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(openRoot.equalsIgnoreCase(&quot;liClosed&quot;))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;String xpath = &quot;.//*[@id=&#39;tree1&#39;]/li[&quot;+rootSize+&quot;]/span&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;openTree(xpath);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;List&amp;lt;WebElement&amp;gt; childRoots = driver.findElements(By.xpath(&quot;.//*[@id=&#39;tree1&#39;]/li[&quot;+rootSize+&quot;]/ul/li&quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int subRootSize = 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for(WebElement childRoot: childRoots)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;String openSubRoot = childRoot.getAttribute(&quot;class&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(openSubRoot.equalsIgnoreCase(&quot;liClosed&quot;))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;String path = &quot;.//*[@id=&#39;tree1&#39;]/li[&quot;+rootSize+&quot;]/ul/li[&quot;+subRootSize+&quot;]/span&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;openTree(path);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;subRootSize = subRootSize+1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;rootSize = rootSize+1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;public void openTree(String xpath) throws InterruptedException&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.findElement(By.xpath(xpath)).click();&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/4113754887694828304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/expanding-tree-structure-using-selenium.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/4113754887694828304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/4113754887694828304'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/expanding-tree-structure-using-selenium.html' title='Expanding Tree Structure using Selenium Web Driver'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-2380223770377497364</id><published>2013-09-24T23:34:00.000-07:00</published><updated>2013-09-25T02:11:18.658-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="alert"/><category scheme="http://www.blogger.com/atom/ns#" term="Alert class"/><category scheme="http://www.blogger.com/atom/ns#" term="Alert.accept()"/><category scheme="http://www.blogger.com/atom/ns#" term="Alert.dismiss()"/><category scheme="http://www.blogger.com/atom/ns#" term="confirm"/><category scheme="http://www.blogger.com/atom/ns#" term="driver.switchTo()"/><category scheme="http://www.blogger.com/atom/ns#" term="driver.switchto().alert()"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript prompt"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium Web Driver"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium WebDriver"/><title type='text'>Handling different Javascript prompts using Selenium WebDriver</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Purpose: Handling different Javascript prompts using Selenium WebDriver&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
We always come across different javascript prompts while accessing different websites. Follwoing code will help to handle while automating those functionalities.&lt;br /&gt;
&lt;br /&gt;
This requires one web page which contains different ways to generate Javascript prompts. Following code for Web page&lt;br /&gt;
&lt;br /&gt;
jscriptpopup.html&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;
function show_alert()&lt;br /&gt;
{&lt;br /&gt;
alert(&quot;This is a JavaScript Alert Box!&quot;)&lt;br /&gt;
document.getElementById(&quot;result&quot;).innerHTML=&quot;Alert Prompted&quot;;&lt;br /&gt;
}&lt;br /&gt;
function show_confirm()&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;var r=confirm(&quot;Press a button&quot;);&lt;br /&gt;
&amp;nbsp;if (r==true)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp; x=&quot;Pressed OK Button!&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; document.getElementById(&quot;result&quot;).innerHTML=x;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;else&lt;br /&gt;
&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp; x=&quot;Pressed Cancel Button!&quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; document.getElementById(&quot;result&quot;).innerHTML=x;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; } &lt;br /&gt;
}&lt;br /&gt;
function show_prompt()&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;var v = prompt(&quot;Enter Value&quot;);&lt;br /&gt;
&amp;nbsp;if(v!=null)&lt;br /&gt;
&amp;nbsp; document.getElementById(&quot;result&quot;).innerHTML=&quot;Entered Value is &quot;+v;&lt;br /&gt;
&amp;nbsp; else&lt;br /&gt;
&amp;nbsp;document.getElementById(&quot;result&quot;).innerHTML=&quot;Pressed Cancel button&quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;input type=&quot;button&quot; onclick=&quot;show_alert()&quot; value=&quot;Show Alert Box&quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&quot;button&quot; onclick=&quot;show_confirm()&quot; value=&quot;Show Confrim Box&quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&quot;button&quot; onclick=&quot;show_prompt()&quot; value=&quot;Show Prompt Box&quot; /&amp;gt;&lt;br /&gt;
&amp;lt;div id=&quot;result&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please save the above code and provide the location of the file in WebDriver code&lt;br /&gt;
&lt;br /&gt;
Webdriver Code:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;import org.openqa.selenium.By;&lt;br /&gt;
import org.openqa.selenium.Alert;&lt;br /&gt;
import org.openqa.selenium.WebDriver;&lt;br /&gt;
import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;
import org.testng.annotations.AfterMethod;&lt;br /&gt;
import org.testng.annotations.BeforeMethod;&lt;br /&gt;
import org.testng.annotations.Test;&lt;br /&gt;
public class JscriptPop {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;public String baseURL = &quot;&lt;a href=&quot;file:///D:/Raju/Projects/Tribune%20Direct/Walgreens/Automation/Sample/jscriptpopup.html&quot;&gt;file:///D:/Raju/Projects/Automation/Sample/jscriptpopup.html&lt;/a&gt;&quot;; // Location of the source file&lt;br /&gt;
&amp;nbsp;public Alert alert;&lt;br /&gt;
&amp;nbsp;public static WebDriver driver=new FirefoxDriver();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;@BeforeMethod&lt;br /&gt;
&amp;nbsp;public void setup()&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;driver.get(baseURL);&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;@AfterMethod&lt;br /&gt;
&amp;nbsp;public void tear()&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;driver.quit();&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;@Test&lt;br /&gt;
&amp;nbsp;public void testJscriptPop() throws InterruptedException&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// Clicking Alert Box&lt;br /&gt;
&amp;nbsp;&amp;nbsp;driver.findElement(By.xpath(&quot;//input[@value=&#39;Show Alert Box&#39;]&quot;)).click();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;alert = driver.switchTo().alert();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// To click ok&lt;br /&gt;
&amp;nbsp;&amp;nbsp;alert.accept();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// Clicking Confirm Box&lt;br /&gt;
&amp;nbsp;&amp;nbsp;driver.findElement(By.xpath(&quot;//input[@value=&#39;Show Confrim Box&#39;]&quot;)).click();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;alert = driver.switchTo().alert();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// To click OK&lt;br /&gt;
&amp;nbsp;&amp;nbsp;alert.accept();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// Clicking Confirm Box&lt;br /&gt;
&amp;nbsp;&amp;nbsp;driver.findElement(By.xpath(&quot;//input[@value=&#39;Show Confrim Box&#39;]&quot;)).click();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;alert = driver.switchTo().alert();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// To click Cancel&lt;br /&gt;
&amp;nbsp;&amp;nbsp;alert.dismiss();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// Clicking Confirm Box Prompt Button&lt;br /&gt;
&amp;nbsp;&amp;nbsp;driver.findElement(By.xpath(&quot;//input[@value=&#39;Show Prompt Box&#39;]&quot;)).click();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;alert = driver.switchTo().alert();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;alert.sendKeys(&quot;Test value&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// To click OK&lt;br /&gt;
&amp;nbsp;&amp;nbsp;alert.accept();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// Clicking Confirm Box Prompt Button&lt;br /&gt;
&amp;nbsp;&amp;nbsp;driver.findElement(By.xpath(&quot;//input[@value=&#39;Show Prompt Box&#39;]&quot;)).click();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;alert = driver.switchTo().alert();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// To click Cancel&lt;br /&gt;
&amp;nbsp;&amp;nbsp;alert.dismiss();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
}&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/2380223770377497364/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/handling-different-javascript-prompts.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/2380223770377497364'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/2380223770377497364'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/handling-different-javascript-prompts.html' title='Handling different Javascript prompts using Selenium WebDriver'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-7458693826438437158</id><published>2013-09-22T22:02:00.000-07:00</published><updated>2013-09-22T22:02:23.022-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Handling Tables"/><category scheme="http://www.blogger.com/atom/ns#" term="HTML Table"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium Web Driver"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium WebDriver"/><category scheme="http://www.blogger.com/atom/ns#" term="Table columns"/><category scheme="http://www.blogger.com/atom/ns#" term="Table rows"/><title type='text'>Capturing contents of a Table using Selenium Web Driver</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Purpose: Capturing contents of a Table using Selenium Web Driver&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
Some times we may need to capture each and every value from a table while automating. Following example will help to implement the requirement. &lt;br /&gt;
&lt;br /&gt;
This example also will help us to capture nth Row &amp;amp; Column value.&lt;br /&gt;
&lt;br /&gt;
import java.util.List;&lt;br /&gt;
import org.openqa.selenium.By;&lt;br /&gt;import org.openqa.selenium.WebDriver;&lt;br /&gt;import org.openqa.selenium.WebElement;&lt;br /&gt;import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;import org.testng.annotations.AfterMethod;&lt;br /&gt;import org.testng.annotations.BeforeMethod;&lt;br /&gt;import org.testng.annotations.Test;&lt;br /&gt;
&lt;br /&gt;public class TableExample {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;public String baseURL = &quot;&lt;a href=&quot;http://accessibility.psu.edu/tablecomplexhtml&quot;&gt;http://accessibility.psu.edu/tablecomplexhtml&lt;/a&gt;&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;public WebDriver driver = new FirefoxDriver();&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;@BeforeMethod&lt;br /&gt;&amp;nbsp;&amp;nbsp;public void setup()&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;driver.get(baseURL);&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;@AfterMethod&lt;br /&gt;&amp;nbsp;&amp;nbsp;public void tear()&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;driver.quit();&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;@Test&lt;br /&gt;&amp;nbsp;&amp;nbsp;public void testTableExample()&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;List&amp;lt;WebElement&amp;gt; rows = driver.findElements(By.xpath(&quot;.//*[@id=&#39;node-281&#39;]/div/div[1]/div[2]/table/tbody/tr&quot;)); // Returns the number of Rows&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;List&amp;lt;WebElement&amp;gt; cols = driver.findElements(By.xpath(&quot;.//*[@id=&#39;node-281&#39;]/div/div[1]/div[2]/table/tbody/tr[1]/td&quot;)); // Returns the number of Columns&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Static XPath of a single TR and TD is &quot;.//*[@id=&#39;node-281&#39;]/div/div[1]/div[2]/table/tbody/tr[1]/td[1]&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// code to fetch each and every value of a Table&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;for(int rowNumber = 1; rowNumber &amp;lt;= rows.size(); rowNumber++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for(int colNumber = 1; colNumber &amp;lt;= cols.size(); colNumber++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.print(driver.findElement(By.xpath(&quot;.//*[@id=&#39;node-281&#39;]/div/div[1]/div[2]/table/tbody/tr[&quot;+rowNumber+&quot;]/td[&quot;+colNumber+&quot;]&quot;)).getText()+&quot;&amp;nbsp; &quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println(&quot;\n&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println(&quot;###############################################################################\n&quot;);&lt;br /&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// nth element value of a table &lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println(driver.findElement(By.xpath(&quot;.//*[@id=&#39;node-281&#39;]/div/div[1]/div[2]/table/tbody/tr[&quot;+rows.size()+&quot;]/td[&quot;+cols.size()+&quot;]&quot;)).getText());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/7458693826438437158/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/capturing-contents-of-table-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/7458693826438437158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/7458693826438437158'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/capturing-contents-of-table-using.html' title='Capturing contents of a Table using Selenium Web Driver'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-2700832845788510584</id><published>2013-09-18T23:58:00.001-07:00</published><updated>2013-09-18T23:58:34.530-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Action"/><category scheme="http://www.blogger.com/atom/ns#" term="Action Class"/><category scheme="http://www.blogger.com/atom/ns#" term="Action.doubleClick()"/><category scheme="http://www.blogger.com/atom/ns#" term="Action.perform()"/><category scheme="http://www.blogger.com/atom/ns#" term="doubleClick()"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="perform()"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium"/><category scheme="http://www.blogger.com/atom/ns#" term="selenium rc"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium Web Driver"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium WebDriver"/><category scheme="http://www.blogger.com/atom/ns#" term="Web Driver"/><title type='text'>Performing Mouse Double Click using Selenium Web Driver</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Perpose: Performing Mouse Double Click using Selenium Web Driver&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Some web applications may need to perform double click to fire the action. Following code will help how to implement Mouse Double Click using Selenium.&lt;br /&gt;
&lt;br /&gt;
In the following example, page contans a div and if we perform single click noting is going to happen but when we perform double click Map will be zoomed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import org.openqa.selenium.By;&lt;br /&gt;import org.openqa.selenium.WebDriver;&lt;br /&gt;import org.openqa.selenium.WebElement;&lt;br /&gt;import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;import org.openqa.selenium.interactions.Action;&lt;br /&gt;import org.openqa.selenium.interactions.Actions;&lt;br /&gt;import org.testng.annotations.AfterTest;&lt;br /&gt;import org.testng.annotations.BeforeTest;&lt;br /&gt;import org.testng.annotations.Test;&lt;br /&gt;
public class DoubleClick {&lt;br /&gt;&amp;nbsp;public String baseURL = &quot;&lt;a href=&quot;http://openlayers.org/dev/examples/click.html&quot;&gt;http://openlayers.org/dev/examples/click.html&lt;/a&gt;&quot;;&lt;br /&gt;&amp;nbsp;public WebDriver driver = new FirefoxDriver();&lt;br /&gt;&amp;nbsp;public WebElement element;&lt;br /&gt;&amp;nbsp;public String title;&lt;br /&gt;&amp;nbsp;public Actions action = new Actions(driver);&lt;br /&gt;
&amp;nbsp;@BeforeTest&lt;br /&gt;&amp;nbsp;public void launchBrowser()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.get(baseURL);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@AfterTest&lt;br /&gt;&amp;nbsp;public void closeBrowser()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.quit();&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@Test&lt;br /&gt;&amp;nbsp;public void doubleClick() throws InterruptedException&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;element = driver.findElement(By.xpath(&quot;.//*[@id=&#39;OpenLayers_Map_2_OpenLayers_ViewPort&#39;]&quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;element.click();// For single click Map will not load&lt;br /&gt;&amp;nbsp;&amp;nbsp;System.out.println(&quot;Single Click performed&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;Action doubleClick = action.doubleClick(element).build();&lt;br /&gt;&amp;nbsp;&amp;nbsp;doubleClick.perform();// After performing double click Map will load&lt;br /&gt;&amp;nbsp;&amp;nbsp;System.out.println(&quot;Double Click performed&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(10000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;doubleClick.perform();// After performing double click Map will load&lt;br /&gt;&amp;nbsp;&amp;nbsp;System.out.println(&quot;Double Click performed&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(10000);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/2700832845788510584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/performing-mouse-double-click-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/2700832845788510584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/2700832845788510584'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/performing-mouse-double-click-using.html' title='Performing Mouse Double Click using Selenium Web Driver'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-3772671394211785846</id><published>2013-09-18T03:59:00.000-07:00</published><updated>2013-09-18T03:59:32.365-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Action Class"/><category scheme="http://www.blogger.com/atom/ns#" term="CSS Drop Down Menu"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium Web Driver"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium WebDriver"/><category scheme="http://www.blogger.com/atom/ns#" term="Sub Menu"/><title type='text'>Capturing the Sub Menu values using Selenium Web Driver</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Purpose: Capturing the Sub Menu values using Selenium Web Driver&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
Some times we may need to validate the valus of Sub-menus. If static it is easy to implement but some times we may need to validate the dynamic data.&lt;br /&gt;
&lt;br /&gt;
Following code will help to accomplish this:&lt;br /&gt;
&lt;br /&gt;
import java.util.List;&lt;br /&gt;
import org.openqa.selenium.By;&lt;br /&gt;import org.openqa.selenium.WebDriver;&lt;br /&gt;import org.openqa.selenium.WebElement;&lt;br /&gt;import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;import org.openqa.selenium.interactions.Actions;&lt;br /&gt;import org.testng.annotations.AfterTest;&lt;br /&gt;import org.testng.annotations.BeforeTest;&lt;br /&gt;import org.testng.annotations.Test;&lt;br /&gt;
&lt;br /&gt;public class DropDownCSSMenu {&lt;br /&gt;
&amp;nbsp;public String baseURL = &quot;&lt;a href=&quot;http://demo.lateralcode.com/css-drop-down-menus/&quot;&gt;http://demo.lateralcode.com/css-drop-down-menus/&lt;/a&gt;&quot;;&lt;br /&gt;&amp;nbsp;public WebDriver driver = new FirefoxDriver();&lt;br /&gt;&amp;nbsp;public Actions action = new Actions(driver);&lt;br /&gt;&amp;nbsp;public List&amp;lt;WebElement&amp;gt; elements;&lt;br /&gt;&amp;nbsp;public int size;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@BeforeTest&lt;br /&gt;&amp;nbsp;public void launchBrowser()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.get(baseURL);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@AfterTest&lt;br /&gt;&amp;nbsp;public void closeBrowser()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.quit();&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@Test&lt;br /&gt;&amp;nbsp;public void test() throws InterruptedException&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;WebElement home = driver.findElement(By.linkText(&quot;Home&quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;WebElement about = driver.findElement(By.linkText(&quot;About&quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;WebElement contact = driver.findElement(By.linkText(&quot;Contact&quot;));&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;action.moveToElement(home).build().perform();//MouseOver of Menu &lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.findElement(By.xpath(&quot;//*[@id=&#39;menu&#39;]/ul/li[1]/ul/li[1]/a&quot;)).click(); //Clicking Sub Menu&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;elements = driver.findElements(By.xpath(&quot;.//*[@id=&#39;menu&#39;]/ul/li[1]/ul/li/a&quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;for (WebElement element : elements) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println(element.getText());&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;action.moveToElement(about).build().perform();//MouseOver of Menu &lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.findElement(By.xpath(&quot;//*[@id=&#39;menu&#39;]/ul/li[2]/ul/li[1]/a&quot;)).click(); //Clicking Sub Menu&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;elements = driver.findElements(By.xpath(&quot;.//*[@id=&#39;menu&#39;]/ul/li[2]/ul/li/a&quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;for (WebElement element : elements) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println(element.getText());&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;action.moveToElement(contact).build().perform();//MouseOver of Menu &lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.findElement(By.xpath(&quot;//*[@id=&#39;menu&#39;]/ul/li[3]/ul/li[1]/a&quot;)).click(); //Clicking Sub Menu&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;elements = driver.findElements(By.xpath(&quot;.//*[@id=&#39;menu&#39;]/ul/li[3]/ul/li/a&quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;for (WebElement element : elements) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;System.out.println(element.getText());&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/3772671394211785846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/capturing-sub-menu-values-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/3772671394211785846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/3772671394211785846'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/capturing-sub-menu-values-using.html' title='Capturing the Sub Menu values using Selenium Web Driver'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-5181425590852242334</id><published>2013-09-18T03:37:00.000-07:00</published><updated>2013-09-18T03:37:48.945-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Action Class"/><category scheme="http://www.blogger.com/atom/ns#" term="CSS Drop Down Menu"/><category scheme="http://www.blogger.com/atom/ns#" term="Menu"/><category scheme="http://www.blogger.com/atom/ns#" term="Mouse Mover"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium"/><category scheme="http://www.blogger.com/atom/ns#" term="Sub Menu"/><category scheme="http://www.blogger.com/atom/ns#" term="Web Driver"/><title type='text'>Clicking on CSS Drop Down sub Menu using Selenium WebDriver</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Purpose: Clicking on CSS Drop Down sub Menu using Selenium WebDriver&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Some times we encounter to test different types of Web Sites which have some dynamic features and automating such features are little bit difficult. One of such example is CSS Drop Down Menus &amp;amp; Sub-menus.&lt;br /&gt;
&lt;br /&gt;
Following code will help&amp;nbsp;to handle CSS Drop Down Menus &amp;amp; Sub-menus:&lt;br /&gt;
&lt;br /&gt;
import org.openqa.selenium.By;&lt;br /&gt;import org.openqa.selenium.WebDriver;&lt;br /&gt;import org.openqa.selenium.WebElement;&lt;br /&gt;import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;import org.openqa.selenium.interactions.Actions;&lt;br /&gt;import org.testng.annotations.AfterTest;&lt;br /&gt;import org.testng.annotations.BeforeTest;&lt;br /&gt;import org.testng.annotations.Test;&lt;br /&gt;
&lt;br /&gt;public class DropDownCSSMenu {&lt;br /&gt;
&amp;nbsp;public String baseURL = &quot;&lt;a href=&quot;http://demo.lateralcode.com/css-drop-down-menus/&quot;&gt;http://demo.lateralcode.com/css-drop-down-menus/&lt;/a&gt;&quot;;&lt;br /&gt;&amp;nbsp;public WebDriver driver = new FirefoxDriver();&lt;br /&gt;&amp;nbsp;public Actions action = new Actions(driver);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@BeforeTest&lt;br /&gt;&amp;nbsp;public void launchBrowser()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.get(baseURL);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@AfterTest&lt;br /&gt;&amp;nbsp;public void closeBrowser()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.quit();&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@Test&lt;br /&gt;&amp;nbsp;public void test() throws InterruptedException&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;WebElement home = driver.findElement(By.linkText(&quot;Home&quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;WebElement about = driver.findElement(By.linkText(&quot;About&quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;WebElement contact = driver.findElement(By.linkText(&quot;Contact&quot;));&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;action.moveToElement(home).build().perform();//MouseOver of Menu &lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.findElement(By.xpath(&quot;//*[@id=&#39;menu&#39;]/ul/li[1]/ul/li[1]/a&quot;)).click(); //Clicking Sub Menu&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;action.moveToElement(about).build().perform();//MouseOver of Menu &lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.findElement(By.xpath(&quot;//*[@id=&#39;menu&#39;]/ul/li[2]/ul/li[1]/a&quot;)).click(); //Clicking Sub Menu&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;action.moveToElement(contact).build().perform();//MouseOver of Menu &lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.findElement(By.xpath(&quot;//*[@id=&#39;menu&#39;]/ul/li[3]/ul/li[1]/a&quot;)).click(); //Clicking Sub Menu&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/5181425590852242334/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/clicking-on-css-drop-down-sub-menu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/5181425590852242334'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/5181425590852242334'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/clicking-on-css-drop-down-sub-menu.html' title='Clicking on CSS Drop Down sub Menu using Selenium WebDriver'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-8176798193712070345</id><published>2013-09-17T05:47:00.000-07:00</published><updated>2013-09-17T05:47:15.453-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Cusomized Sequence"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium WebDriver"/><category scheme="http://www.blogger.com/atom/ns#" term="Test Case Priority"/><category scheme="http://www.blogger.com/atom/ns#" term="TestNG"/><title type='text'>Executing Sequence of Selenium Test Cases in a Cusomized Sequence</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Purpose: Executing Sequence of Selenium WebDriver Test Cases in a Cusomized Sequence&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;


While automating any application we come across a situation where we need to
execute multiple test cases in a particular sequence. But when it comes to
execute the test cases they will execute randomly. In order to execute the test
cases in our pre requisite order we need to pass a parameter to @Test method
priority and a value(Lower priorities will be scheduled first). &lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;


Following code will be useful to accomplish the requirement:&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;


&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;


&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;o:p&gt;&amp;nbsp;import org.openqa.selenium.By;&lt;br /&gt;import org.openqa.selenium.WebDriver;&lt;br /&gt;import org.openqa.selenium.firefox.FirefoxDriver;&lt;br /&gt;import org.testng.annotations.AfterMethod;&lt;br /&gt;import org.testng.annotations.AfterTest;&lt;br /&gt;import org.testng.annotations.BeforeMethod;&lt;br /&gt;import org.testng.annotations.BeforeTest;&lt;br /&gt;import org.testng.annotations.Test;&lt;/o:p&gt;&lt;/div&gt;
&lt;o:p&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;br /&gt;public class OrderOfTestCase {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;public String baseURL = &quot;&lt;a href=&quot;http://www.google.com/&quot;&gt;http://www.google.com&lt;/a&gt;&quot;;&lt;br /&gt;&amp;nbsp;public WebDriver driver = new FirefoxDriver();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@BeforeTest&lt;br /&gt;&amp;nbsp;public void launchBrowser()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.get(baseURL);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@AfterTest&lt;br /&gt;&amp;nbsp;public void closeBrowser()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.quit();&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@BeforeMethod&lt;br /&gt;&amp;nbsp;public void getTitle()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;System.out.println(driver.getTitle());&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;@AfterMethod&lt;br /&gt;&amp;nbsp;public void goToPreviousPage()&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.navigate().back();&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@Test(priority = 0)&lt;br /&gt;&amp;nbsp;public void images() throws InterruptedException&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.findElement(By.linkText(&quot;Images&quot;)).click();&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;System.out.println(driver.getTitle());&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@Test(priority = 1)&lt;br /&gt;&amp;nbsp;public void maps() throws InterruptedException&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.findElement(By.linkText(&quot;Maps&quot;)).click();&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;System.out.println(driver.getTitle());&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@Test(priority = 2)&lt;br /&gt;&amp;nbsp;public void mail() throws InterruptedException&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;driver.findElement(By.linkText(&quot;Gmail&quot;)).click();&lt;br /&gt;&amp;nbsp;&amp;nbsp;Thread.sleep(3000);&lt;br /&gt;&amp;nbsp;&amp;nbsp;System.out.println(driver.getTitle());&lt;br /&gt;&amp;nbsp;}&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
}&lt;/div&gt;
&lt;/o:p&gt;&lt;br /&gt;


&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/8176798193712070345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/executing-sequence-of-selenium-test.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/8176798193712070345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/8176798193712070345'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/executing-sequence-of-selenium-test.html' title='Executing Sequence of Selenium Test Cases in a Cusomized Sequence'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-874106740686307907</id><published>2013-09-16T02:12:00.000-07:00</published><updated>2013-09-16T02:12:53.740-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="extract files"/><category scheme="http://www.blogger.com/atom/ns#" term="File.seperator"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="unzip"/><category scheme="http://www.blogger.com/atom/ns#" term="ZipInputStream"/><title type='text'>Extracting ZIP file programatically with the help of Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Purpose: Extracting ZIP file programatically with the help of Java&lt;br /&gt;
&lt;br /&gt;
Some time we may need to extract zip file and read the contents. Following code will help how to extract .zip files. I collected this program form some blog while searching and I want to share this to all through my blog.&lt;br /&gt;
&lt;br /&gt;
import java.io.File;&lt;br /&gt;import java.io.FileInputStream;&lt;br /&gt;import java.io.FileNotFoundException;&lt;br /&gt;import java.io.FileOutputStream;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;import java.util.zip.ZipEntry;&lt;br /&gt;import java.util.zip.ZipInputStream;&lt;br /&gt;
&lt;br /&gt;public class FileUnZip {&lt;br /&gt;&amp;nbsp;public static void main(String[] args)&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;unzip(&quot;D://LatestSample.zip&quot;, &quot;D://tmp&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;System.out.println(&quot;Unzip Completed&quot;);&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;public static void unzip(String zipFile,String outputPath){&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(outputPath == null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outputPath = &quot;&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outputPath+=File.separator;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(outputPath+=File.separator);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 1.0 Create output directory&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; File outputDirectory = new File(outputPath);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(outputDirectory.exists())&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outputDirectory.delete();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outputDirectory.mkdir();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 2.0 Unzip (create folders &amp;amp; copy files)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 2.1 Get zip input stream&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ZipInputStream zip = new ZipInputStream(new FileInputStream(zipFile));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ZipEntry entry = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int len;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; byte[] buffer = new byte[1024];&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // 2.2 Go over each entry &quot;file/folder&quot; in zip file&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while((entry = zip.getNextEntry()) != null){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(!entry.isDirectory()){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&quot;-&quot;+entry.getName());&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // create a new file&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; File file = new File(outputPath +entry.getName());&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // create file parent directory if does not exist&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(!new File(file.getParent()).exists())&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new File(file.getParent()).mkdirs();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // get new file output stream&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileOutputStream fos = new FileOutputStream(file); &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // copy bytes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while ((len = zip.read(buffer)) &amp;gt; 0) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fos.write(buffer, 0, len);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fos.close();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; zip.close();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }catch (FileNotFoundException e) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (IOException e) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;
}&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/874106740686307907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/extracting-zip-file-programatically.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/874106740686307907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/874106740686307907'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/extracting-zip-file-programatically.html' title='Extracting ZIP file programatically with the help of Java'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7671953244112869876.post-2104014169695988236</id><published>2013-09-11T05:16:00.000-07:00</published><updated>2013-09-11T05:16:52.087-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="adding an image to word document programatically using java"/><category scheme="http://www.blogger.com/atom/ns#" term="adding image to word"/><category scheme="http://www.blogger.com/atom/ns#" term="handling images"/><category scheme="http://www.blogger.com/atom/ns#" term="image processing"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="Word processing using java"/><title type='text'>Adding An Image to Word programatically using Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Purpose: Adding An Image to Word programatically using Java&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
Following Code will allow to add an Image to a Word file using Java from local or web based source.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import java.io.File;&lt;br /&gt;import java.io.FileNotFoundException;&lt;br /&gt;import java.io.PrintWriter;&lt;br /&gt;import word.api.interfaces.IDocument;&lt;br /&gt;import word.w2004.Document2004;&lt;br /&gt;import word.w2004.elements.BreakLine;&lt;br /&gt;import word.w2004.elements.Image;&lt;br /&gt;import word.w2004.elements.Paragraph;&lt;br /&gt;
public class AddImageToWord &lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String[] args) throws Exception&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;String img = &quot;&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;IDocument doc = new Document2004();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;doc.addEle(Paragraph.with(&quot;Image from Web &lt;a href=&quot;https://www.blogger.com/%22).create&quot;&gt;URL:&quot;).create&lt;/a&gt;());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;doc.addEle(new BreakLine(2)); //Add two break lines&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;img = Image.from_WEB_URL(&quot;&lt;a href=&quot;http://www.google.com/images/logos/ps_logo2.png%22).setHeight(%22100%22).setWidth(%22300%22).create().getContent&quot;&gt;http://www.google.com/images/logos/ps_logo2.png&quot;).setHeight(&quot;100&quot;).setWidth(&quot;300&quot;).create().getContent&lt;/a&gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;doc.addEle(img);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;doc.addEle(new BreakLine(2)); //Add two break lines&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;doc.addEle(Paragraph.with(&quot;Image from Hard Disk:&quot;).create());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;doc.addEle(new BreakLine(2)); //Add two break lines&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;String wh = Image.from_FULL_LOCAL_PATHL(&quot;D://Screen.png&quot;).getOriginalWidthHeight();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;String[] temp = wh.split(&quot;#&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;System.out.println(temp[0]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;System.out.println(temp[1]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;img = Image.from_FULL_LOCAL_PATHL(&quot;D://Screen.png&quot;).setHeight(&quot;300&quot;).setWidth(&quot;500&quot;).create().getContent();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;doc.addEle(img);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;File fileObj = new File(&quot;D://Java2word_allInOne.doc&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;PrintWriter writer = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;try {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer = new PrintWriter(fileObj);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;} catch (FileNotFoundException e) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;String myWord = doc.getContent();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;writer.println(myWord);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;writer.close();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://solutions4selenium.blogspot.com/feeds/2104014169695988236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/adding-image-to-word-programatically.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/2104014169695988236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7671953244112869876/posts/default/2104014169695988236'/><link rel='alternate' type='text/html' href='http://solutions4selenium.blogspot.com/2013/09/adding-image-to-word-programatically.html' title='Adding An Image to Word programatically using Java'/><author><name>Narasimha Raju</name><uri>http://www.blogger.com/profile/11859736999843261172</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>