<?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-9098310426410205563</id><updated>2025-01-13T06:27:10.542-08:00</updated><category term="CSS Locator"/><category term="Check checkbox"/><category term="Handling pop ups/alert/confirmations/prompts in Selenium"/><category term="Javascript Popup handling Using Selenium-WebDriver"/><category term="Keys"/><category term="Listbox"/><category term="Listbox multiple selection"/><category term="Multiple CSS Locator"/><category term="Multiselect"/><category term="Selenium Listbox selection"/><category term="Selenium Locator"/><category term="Selenium WebDriver SendKeys"/><category term="Sending Key combination in WebDriver"/><category term="Uncheck checkbox"/><category term="WebDriver Popup Handling"/><category term="WebDriver checkbox"/><category term="click method"/><category term="isSelected"/><category term="org.openqa.selenium.Keys"/><title type='text'>Selenium Codes - Web Browser Automation</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://seleniumcodes.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9098310426410205563/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://seleniumcodes.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Asiq Ahamed</name><uri>http://www.blogger.com/profile/10131060151146448324</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>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9098310426410205563.post-1593771647323923092</id><published>2011-11-11T21:53:00.000-08:00</published><updated>2011-11-20T07:32:26.440-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSS Locator"/><category scheme="http://www.blogger.com/atom/ns#" term="Multiple CSS Locator"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium Locator"/><title type='text'>How to locate an element with multiple CSS classes?</title><content type='html'>&lt;span&gt;Consider if multiple classes are applied to an element, then how to identify it using CSS locator?&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span&gt;See the below HTML element is applied with three CSS classes (i.e. fac, important &amp; cls).&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span&gt;&lt;font color=&#39;blue&#39;&gt;&amp;lt;font class=&quot;fac important cls&quot;&amp;gt;MULTI CSS&amp;lt;/font&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span&gt;This element can be identified using CSS locator with all the three classes as given below:&lt;/span&gt;&lt;br&gt;&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;String strText1;&lt;br /&gt;strText1=selenium.getText(&quot;css=font.fac&amp;&amp;font.important&amp;&amp;font.cls&quot;);//Multi CSS&lt;br /&gt;System.out.println(strText1);&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://seleniumcodes.blogspot.com/feeds/1593771647323923092/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://seleniumcodes.blogspot.com/2011/11/css-locator-for-multiple-classes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9098310426410205563/posts/default/1593771647323923092'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9098310426410205563/posts/default/1593771647323923092'/><link rel='alternate' type='text/html' href='http://seleniumcodes.blogspot.com/2011/11/css-locator-for-multiple-classes.html' title='How to locate an element with multiple CSS classes?'/><author><name>Unknown</name><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-9098310426410205563.post-615970655652234479</id><published>2011-10-25T04:52:00.000-07:00</published><updated>2011-10-25T05:14:51.889-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Keys"/><category scheme="http://www.blogger.com/atom/ns#" term="org.openqa.selenium.Keys"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium WebDriver SendKeys"/><category scheme="http://www.blogger.com/atom/ns#" term="Sending Key combination in WebDriver"/><title type='text'>Sending KeyStrokes</title><content type='html'>&lt;span&gt;Sending key combination using Selenium-WebDriver&lt;/span&gt;&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;&lt;br /&gt;public void fn_sendKeys() {&lt;br /&gt;String strURL;&lt;br /&gt;WebElement txtGoogle;&lt;br /&gt;WebDriver firefox=new FirefoxDriver();&lt;br /&gt;&lt;br /&gt;strURL=&quot;www.google.com&quot;&lt;br /&gt;firefox.get(strURL);&lt;br /&gt;txtGoogle=firefox.findElement(By.name(&quot;q&quot;));&lt;br /&gt;&lt;br /&gt;txtGoogle.sendKeys(Keys.CONTROL,&quot;G&quot;);//Sending Ctrl+G key combination&lt;br /&gt;}&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://seleniumcodes.blogspot.com/feeds/615970655652234479/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://seleniumcodes.blogspot.com/2011/10/sending-keystrokes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9098310426410205563/posts/default/615970655652234479'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9098310426410205563/posts/default/615970655652234479'/><link rel='alternate' type='text/html' href='http://seleniumcodes.blogspot.com/2011/10/sending-keystrokes.html' title='Sending KeyStrokes'/><author><name>Asiq Ahamed</name><uri>http://www.blogger.com/profile/10131060151146448324</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-9098310426410205563.post-4490311577342085166</id><published>2011-10-24T10:03:00.000-07:00</published><updated>2011-11-11T23:10:12.422-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Check checkbox"/><category scheme="http://www.blogger.com/atom/ns#" term="click method"/><category scheme="http://www.blogger.com/atom/ns#" term="isSelected"/><category scheme="http://www.blogger.com/atom/ns#" term="Uncheck checkbox"/><category scheme="http://www.blogger.com/atom/ns#" term="WebDriver checkbox"/><title type='text'>Checking and Unchecking Web Checkbox</title><content type='html'>We can use the below methods to check or uncheck web checkbox.&lt;br /&gt;&lt;br /&gt;&lt;pre name=&quot;code&quot; class=&quot;java&quot;&gt;&lt;br /&gt;//Checking&lt;br /&gt;public void CheckingChkbox(WebElement chkbx1){&lt;br /&gt;boolean checkstatus;&lt;br /&gt;checkstatus=chkbx1.isSelected();&lt;br /&gt;if (checkstatus==true){&lt;br /&gt;System.out.println(&quot;Checkbox is already checked&quot;);  &lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;chkbx1.click();&lt;br /&gt;System.out.println(&quot;Checked the checkbox&quot;);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;//Unchecking &lt;br /&gt;public void UnCheckingChkbox(WebElement chkbx1){&lt;br /&gt;boolean checkstatus;&lt;br /&gt;checkstatus=chkbx1.isSelected();&lt;br /&gt;if (checkstatus==true) {&lt;br /&gt;chkbx1.click();&lt;br /&gt;System.out.println(&quot;Checkbox is unchecked&quot;);&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;System.out.println(&quot;Checkbox is already unchecked&quot;); &lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://seleniumcodes.blogspot.com/feeds/4490311577342085166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://seleniumcodes.blogspot.com/2011/10/checking-and-unchecking-checkbox.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9098310426410205563/posts/default/4490311577342085166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9098310426410205563/posts/default/4490311577342085166'/><link rel='alternate' type='text/html' href='http://seleniumcodes.blogspot.com/2011/10/checking-and-unchecking-checkbox.html' title='Checking and Unchecking Web Checkbox'/><author><name>Unknown</name><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-9098310426410205563.post-1143203351894918152</id><published>2011-10-20T10:11:00.000-07:00</published><updated>2011-10-20T10:27:10.109-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Listbox"/><category scheme="http://www.blogger.com/atom/ns#" term="Listbox multiple selection"/><category scheme="http://www.blogger.com/atom/ns#" term="Multiselect"/><category scheme="http://www.blogger.com/atom/ns#" term="Selenium Listbox selection"/><title type='text'>Selecting Multiple Items in Listbox</title><content type='html'>&lt;span&gt;Selecting multiple HTML Listbox&#39;s options&lt;/span&gt;&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;&lt;br /&gt;String strURL;&lt;br /&gt;strURL=&quot;URL&quot;;&lt;br /&gt;&lt;br /&gt;WebDriver firefoxDriver=new FirefoxDriver();  &lt;br /&gt;firefoxDriver.get(strURL);&lt;br /&gt;&lt;br /&gt;WebElement list1;  &lt;br /&gt;list1=firefoxDriver.findElement(By.name(&quot;lst&quot;));  &lt;br /&gt;&lt;br /&gt;List&amp;lt;WebElement&amp;gt; lstOptions=list1.findElements(By.tagName(&quot;option&quot;));  &lt;br /&gt;list1.sendKeys(Keys.CONTROL);  &lt;br /&gt;lstOptions.get(0).click();//Selects the first option.  &lt;br /&gt;lstOptions.get(1).click();//Selects the second option. &lt;br /&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://seleniumcodes.blogspot.com/feeds/1143203351894918152/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://seleniumcodes.blogspot.com/2011/10/selecting-multiple-items-in-listbox.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9098310426410205563/posts/default/1143203351894918152'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9098310426410205563/posts/default/1143203351894918152'/><link rel='alternate' type='text/html' href='http://seleniumcodes.blogspot.com/2011/10/selecting-multiple-items-in-listbox.html' title='Selecting Multiple Items in Listbox'/><author><name>Asiq Ahamed</name><uri>http://www.blogger.com/profile/10131060151146448324</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>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9098310426410205563.post-4706195409059858619</id><published>2011-10-18T10:27:00.000-07:00</published><updated>2011-10-18T12:04:47.775-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Handling pop ups/alert/confirmations/prompts in Selenium"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript Popup handling Using Selenium-WebDriver"/><category scheme="http://www.blogger.com/atom/ns#" term="WebDriver Popup Handling"/><title type='text'>Handling Javascript Popups Using Selenium-WebDriver</title><content type='html'>&lt;span&gt;We can use the below methods to handle Javascript popups.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span STYLE=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;i&gt;# accept()&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;This method can be used to click &#39;OK&#39; button in a popup&lt;/span&gt;&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;&lt;br /&gt;WebDriver firefoxDriver=new FirefoxDriver();&lt;br /&gt;Alert alert = firefoxDriver.switchTo().alert();//Creating object for Alert class&lt;br /&gt;alert.accept();//Clicking OK button&lt;br /&gt;&lt;/pre&gt;&lt;br&gt;&lt;span STYLE=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;i&gt;# dismiss()&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;Canceling popup using dismiss method&lt;/span&gt;&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;&lt;br /&gt;WebDriver firefoxDriver=new FirefoxDriver();&lt;br /&gt;Alert alert = firefoxDriver.switchTo().alert();&lt;br /&gt;alert.dismiss();//Canceling the popup&lt;br /&gt;&lt;/pre&gt;&lt;br&gt;&lt;span STYLE=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;i&gt;# getText()&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br&gt;&lt;span&gt;Getting popup text&lt;/span&gt;&lt;pre class=&quot;java&quot; name=&quot;code&quot;&gt;&lt;br /&gt;String strAlertText;&lt;br /&gt;WebDriver firefoxDriver=new FirefoxDriver();&lt;br /&gt;Alert alert = firefoxDriver.switchTo().alert();&lt;br /&gt;strAlertText=alert.getText();//This line retrieves text from popup. &lt;br /&gt;System.out.println(strAlertText);&lt;br /&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://seleniumcodes.blogspot.com/feeds/4706195409059858619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://seleniumcodes.blogspot.com/2011/10/sample-post.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9098310426410205563/posts/default/4706195409059858619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9098310426410205563/posts/default/4706195409059858619'/><link rel='alternate' type='text/html' href='http://seleniumcodes.blogspot.com/2011/10/sample-post.html' title='Handling Javascript Popups Using Selenium-WebDriver'/><author><name>Asiq Ahamed</name><uri>http://www.blogger.com/profile/10131060151146448324</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></feed>