<?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-3098408025786606497</id><updated>2024-08-29T02:50:16.212-07:00</updated><title type='text'>Webdrivers</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://selenium-webdrivers.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3098408025786606497/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://selenium-webdrivers.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>https://ramganga1.blogspot.com/</name><uri>http://www.blogger.com/profile/02680032026122797206</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>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3098408025786606497.post-4807764139783629798</id><published>2012-09-07T07:46:00.000-07:00</published><updated>2012-09-07T07:46:20.541-07:00</updated><title type='text'>How to minise and Maximise window using selenium webdrivers ?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
1) To Maximise the browser , the Java code using selenium webdriver is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; driver.manage().window().maximize();&lt;br /&gt;
&lt;br /&gt;
However to&amp;nbsp;minimize&amp;nbsp;the browser is not as easy as&amp;nbsp;maximize:&lt;br /&gt;
&lt;br /&gt;
2) To Mininise the browser, we can make use of&amp;nbsp;&amp;nbsp;&#39;setSize&#39;&amp;nbsp;method:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; Dimension dd = new Dimension(1024, 768);&lt;br /&gt;
&amp;nbsp; &amp;nbsp;driver.manage().window().setSize(dd);&lt;br /&gt;
&lt;br /&gt;
Other way around using Robot class:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3098408025786606497/posts/default/4807764139783629798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3098408025786606497/posts/default/4807764139783629798'/><link rel='alternate' type='text/html' href='http://selenium-webdrivers.blogspot.com/2012/09/how-to-minise-and-maximise-window-using.html' title='How to minise and Maximise window using selenium webdrivers ?'/><author><name>https://ramganga1.blogspot.com/</name><uri>http://www.blogger.com/profile/02680032026122797206</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></entry><entry><id>tag:blogger.com,1999:blog-3098408025786606497.post-4389751642303032669</id><published>2012-09-07T01:22:00.000-07:00</published><updated>2012-09-07T05:19:52.154-07:00</updated><title type='text'>Verify if element exists in HTML page using WebDriver&#39;s findelements</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
It is easy to determine if the HTML elements exists or not.&lt;br /&gt;
&lt;div&gt;
I will show you by giving an example:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Below is the HTML code:&lt;/div&gt;
&lt;div&gt;
&amp;lt;html&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp;&amp;lt;a href=&quot;http://www.you-should.com&quot;&amp;gt;Visit you-should.com&amp;lt;/a&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/body&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/html&amp;gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now we need to find out link if &amp;nbsp;&amp;lt;a href....&amp;gt; &amp;nbsp;exists or not.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So our webdriver code in java would be::&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;if(driver.findElements(By.xpath(&quot;/html/body/div/a&quot;)).size()!=0)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
From the above code we determine if the followung element size is happened to be zero or not. If its not zero then the link element exists and the condition throws true value else false value is returned.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Similarly we can find out for other elements of the HTML page.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3098408025786606497/posts/default/4389751642303032669'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3098408025786606497/posts/default/4389751642303032669'/><link rel='alternate' type='text/html' href='http://selenium-webdrivers.blogspot.com/2012/09/verify-if-html-element-exists-using.html' title='Verify if element exists in HTML page using WebDriver&#39;s findelements'/><author><name>https://ramganga1.blogspot.com/</name><uri>http://www.blogger.com/profile/02680032026122797206</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></entry><entry><id>tag:blogger.com,1999:blog-3098408025786606497.post-6976801482981364868</id><published>2012-09-06T07:29:00.000-07:00</published><updated>2012-09-07T01:10:12.499-07:00</updated><title type='text'>Using webdriver&#39;s findElements in parsing images of same class</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;&lt;i&gt;Below is the HTML code for the images to be parsed from webdriver:&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;nodeLabel &quot; role=&quot;presentation&quot;&gt;
&lt;span aria-expanded=&quot;true&quot; class=&quot;nodeLabelBox repTarget &quot; role=&quot;treeitem&quot;&gt;&amp;lt;&lt;span class=&quot;nodeTag &quot;&gt;div&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;class&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;thumb&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeBracket editable insertBefore &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;nodeChildBox &quot; role=&quot;group&quot;&gt;
&lt;div class=&quot;nodeBox containerNodeBox open&quot; role=&quot;presentation&quot;&gt;
&lt;div class=&quot;nodeLabel &quot; role=&quot;presentation&quot;&gt;
&lt;div class=&quot;twisty &quot; role=&quot;presentation&quot;&gt;
&lt;/div&gt;
&lt;span aria-expanded=&quot;true&quot; class=&quot;nodeLabelBox repTarget &quot; role=&quot;treeitem&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;span class=&quot;nodeTag &quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;title&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;title1&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;rel&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;bookmark&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;href&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;http://you-should.com/&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeBracket editable insertBefore &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;nodeChildBox &quot; role=&quot;group&quot;&gt;
&lt;div class=&quot;nodeBox emptyNodeBox selected&quot; role=&quot;presentation&quot;&gt;
&lt;div class=&quot;nodeLabel &quot; role=&quot;presentation&quot;&gt;
&lt;span class=&quot;nodeLabelBox repTarget &quot; role=&quot;treeitem&quot;&gt;&amp;lt;&lt;span class=&quot;nodeTag &quot;&gt;img&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;class&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;attachment-medium&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;width&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;168&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;height&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;164&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;title&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;Facebook&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;alt&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;Logo of Facebook&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;src&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;...../facebook.jpg&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeBracket editable insertBefore &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;nodeCloseLabel &quot; role=&quot;presentation&quot;&gt;
&lt;span class=&quot;nodeCloseLabelBox repTarget &quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/&lt;span class=&quot;nodeTag &quot;&gt;a&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;nodeCloseLabel &quot; role=&quot;presentation&quot;&gt;
&lt;span class=&quot;nodeCloseLabelBox repTarget &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;nodeCloseLabel &quot; role=&quot;presentation&quot;&gt;
&lt;span class=&quot;nodeCloseLabelBox repTarget &quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;nodeLabel &quot; role=&quot;presentation&quot;&gt;
&lt;span class=&quot;nodeCloseLabelBox repTarget &quot;&gt;&lt;span aria-expanded=&quot;true&quot; class=&quot;nodeLabelBox repTarget &quot; role=&quot;treeitem&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;&lt;span class=&quot;nodeTag &quot;&gt;a&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;title&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;title1&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;rel&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;bookmark&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;href&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;http://google.com&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeBracket editable insertBefore &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;nodeCloseLabelBox repTarget &quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;nodeChildBox &quot; role=&quot;group&quot;&gt;
&lt;div class=&quot;nodeBox emptyNodeBox selected&quot; role=&quot;presentation&quot;&gt;
&lt;div class=&quot;nodeLabel &quot; role=&quot;presentation&quot;&gt;
&lt;span class=&quot;nodeCloseLabelBox repTarget &quot;&gt;&lt;span class=&quot;nodeLabelBox repTarget &quot; role=&quot;treeitem&quot;&gt;&amp;lt;&lt;span class=&quot;nodeTag &quot;&gt;img&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;class&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;attachment-medium&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;width&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;168&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;height&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;164&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;title&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;Facebook1&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;alt&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;Facebook Face&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeAttr editGroup &quot;&gt;&amp;nbsp;&lt;span class=&quot;nodeName editable &quot;&gt;src&lt;/span&gt;=&quot;&lt;span class=&quot;nodeValue editable &quot;&gt;../facebook1.jpg&lt;/span&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nodeBracket editable insertBefore &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;span class=&quot;nodeCloseLabelBox repTarget &quot;&gt;
&lt;/span&gt;
&lt;div class=&quot;nodeCloseLabel &quot; role=&quot;presentation&quot;&gt;
&lt;span class=&quot;nodeCloseLabelBox repTarget &quot;&gt;&lt;span class=&quot;nodeCloseLabelBox repTarget &quot;&gt;&amp;lt;/&lt;span class=&quot;nodeTag &quot;&gt;a&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;nodeCloseLabelBox repTarget &quot;&gt;
&lt;div class=&quot;nodeCloseLabel &quot; role=&quot;presentation&quot;&gt;
&lt;span class=&quot;nodeCloseLabelBox repTarget &quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;
&lt;b&gt;&lt;i&gt;I have created a class&amp;nbsp;Checkimage and then use the following&amp;nbsp;Java code to parse the above HTML image file.&amp;nbsp;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
1.&amp;nbsp;public class Checkimage {&lt;br /&gt;
2. &amp;nbsp;WebElement myDynamicElement ;&lt;br /&gt;
3. &amp;nbsp; WebDriver driver ;&lt;br /&gt;
4. &amp;nbsp; WebElement SingleElement;&lt;br /&gt;
5. &amp;nbsp; &amp;nbsp;Int Count;&lt;br /&gt;
6. &amp;nbsp; public void IfImageExists()&lt;br /&gt;
7. &amp;nbsp; {&lt;br /&gt;
8. &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;driver = new FirefoxDriver();&lt;br /&gt;
9. &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;driver.get(&quot;&lt;i&gt;http://you-should.com&lt;/i&gt;&quot;);&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
10. &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;List&amp;lt;WebElement&amp;gt; myDynamicElement=driver.findElements(By.className(&quot;attachment-medium&quot;));&lt;br /&gt;
11. &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp;for (int i =0; i&amp;lt; myDynamicElement.size(); i++ )&lt;br /&gt;
12 &amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
13. &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;SingleElement = myDynamicElement.get(i);&lt;br /&gt;
14 &amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;String alt = SingleElement.getAttribute(&quot;Alt&quot;);&lt;br /&gt;
15. &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;int x = 0;&lt;br /&gt;
16. &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;br /&gt;
17. &amp;nbsp;&amp;nbsp;Count =&amp;nbsp;myDynamicElement.size() ; // Here count of the images is made.&lt;br /&gt;
18. &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
19. &amp;nbsp; public static void main(String[]args) {&lt;br /&gt;
20. &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Checkimage cim = new Checkimage();&lt;br /&gt;
21. &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cim.IfImageExists();&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
22. &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
23. }&lt;br /&gt;
&lt;br /&gt;
Step17 is calculating the number of images in the Count string.&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3098408025786606497/posts/default/6976801482981364868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3098408025786606497/posts/default/6976801482981364868'/><link rel='alternate' type='text/html' href='http://selenium-webdrivers.blogspot.com/2012/09/using-webdrivers-findelements-in.html' title='Using webdriver&#39;s findElements in parsing images of same class'/><author><name>https://ramganga1.blogspot.com/</name><uri>http://www.blogger.com/profile/02680032026122797206</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></entry><entry><id>tag:blogger.com,1999:blog-3098408025786606497.post-8505112541553200650</id><published>2012-07-04T02:07:00.003-07:00</published><updated>2012-07-04T02:23:14.081-07:00</updated><title type='text'>How to Find HTML ID attribute though class attribute in webdrivers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Below is the HTML snippet for example:&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;div&gt;
&amp;lt;html&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;lt;input type=&quot;text&quot; id =&quot;txtSearch&quot; class=&quot;classSearch&quot;&amp;gt; Find the ID &amp;lt;/input&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/body&amp;gt;&lt;/div&gt;
&lt;div&gt;
&amp;lt;/html&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now to apply search through the elements of the above snippet code, following lines of code in webdrivers to extract the ID attribute value just through classname:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; 1. &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;WebDriver driver = new FirefoxDriver();&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp;2. &amp;nbsp; &amp;nbsp; &lt;b&gt;JavascriptExecutor js = (JavascriptExecutor) driver;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp;3. &amp;nbsp; &amp;nbsp;&lt;b&gt;&amp;nbsp;WebElement we = driver.findElement(By.className(&quot;classSearch&quot;));&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp;4. &amp;nbsp; &amp;nbsp;&lt;b&gt; String Idvalue= (String)js.executeScript(&quot;return arguments[0].id&quot;, we); &lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The &#39;&lt;b&gt;Idvalue&#39;&amp;nbsp;&lt;/b&gt;which is of stringtype will get the ID value which is &quot;&lt;b&gt;txtSearch&lt;/b&gt;&#39; in our example.&lt;br /&gt;
&lt;br /&gt;
Similarly we can extract other values like tagname where just replace &quot;&lt;b&gt;arguments[0].id&quot;&lt;/b&gt; to &quot;&lt;b&gt;arguments[0].tagname&quot;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3098408025786606497/posts/default/8505112541553200650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3098408025786606497/posts/default/8505112541553200650'/><link rel='alternate' type='text/html' href='http://selenium-webdrivers.blogspot.com/2012/07/to-find-id-though-classname-in.html' title='How to Find HTML ID attribute though class attribute in webdrivers'/><author><name>https://ramganga1.blogspot.com/</name><uri>http://www.blogger.com/profile/02680032026122797206</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></entry></feed>