<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Selenium - Java Archives | Selenium Webdriver Appium Complete Tutorial</title>
	<atom:link href="https://automationtesting.in/category/selenium-java/feed/" rel="self" type="application/rss+xml" />
	<link>https://automationtesting.in/category/selenium-java/</link>
	<description>Automation Testing</description>
	<lastBuildDate>Wed, 20 Jul 2022 01:44:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.2.2</generator>
	<item>
		<title>How to Capture WebElement Screenshot in Selenium Webdriver using selenium 4</title>
		<link>https://automationtesting.in/how-to-capture-webelement-screenshot-in-selenium-webdriver/</link>
					<comments>https://automationtesting.in/how-to-capture-webelement-screenshot-in-selenium-webdriver/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Sun, 15 Dec 2019 17:47:24 +0000</pubDate>
				<category><![CDATA[Selenium - Java]]></category>
		<category><![CDATA[capture full page screenshot in selenium 4]]></category>
		<category><![CDATA[capture screenshot in selenium]]></category>
		<category><![CDATA[capture screenshot using webelement]]></category>
		<category><![CDATA[capturescreenshot]]></category>
		<category><![CDATA[capturescreenshot using selenium]]></category>
		<category><![CDATA[how to capture screenshot in selenium]]></category>
		<category><![CDATA[how to capture screenshot in selenium webdriver]]></category>
		<category><![CDATA[how to capture webelement screenshot in selenium webdriver]]></category>
		<category><![CDATA[how to take screenshot in selenium]]></category>
		<category><![CDATA[how to take screenshot in selenium webdriver]]></category>
		<category><![CDATA[new features in selenium 4]]></category>
		<category><![CDATA[screenshot in selenium]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[selenium 4]]></category>
		<category><![CDATA[Selenium Webdriver]]></category>
		<category><![CDATA[take screenshot of webelement in selenium]]></category>
		<category><![CDATA[takescreenshot in selenium]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=2356</guid>

					<description><![CDATA[<p>In this blog, we will learn how to capture webelement screenshot using selenium. Till Selenium 3 we have an option that to take the screenshot for an entire webpage. From selenium 4 onwards they have introduced an option that to capture a webelement. Previously, using some third party libraries like Ashot, shutterbug to capture the [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/how-to-capture-webelement-screenshot-in-selenium-webdriver/">How to Capture WebElement Screenshot in Selenium Webdriver using selenium 4</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script><br />
(adsbygoogle = window.adsbygoogle || []).push({});<br />
</script></p>
<p>In this blog, we will learn how to capture webelement screenshot using selenium. Till Selenium 3 we have an option that to take the screenshot for an entire webpage. From selenium 4 onwards they have introduced an option that to capture a webelement. Previously, using some third party libraries like Ashot, shutterbug to capture the webelemet or webpage.</p>
<div class="post-video"><iframe loading="lazy" title="How to Capture WebElement Screenshot in Selenium Webdriver || Interview Question || Method 1" width="1165" height="874" src="https://www.youtube.com/embed/Jz2_MlVO5c8?wmode=transparent&#038;fs=1"  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
<p><script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script><br />
(adsbygoogle = window.adsbygoogle || []).push({});<br />
</script></p>
<p><strong>Pre-requisites</strong>:</p>
<ol>
<li>Add the selenium-4-alpha.jar file in your project or add the corresponding dependency is yours is a Maven project</li>
<li>in your class file, inspect the target element and store it in a webelement.</li>
<li>Now, use the regular screenshot logic method and store the value in a folder using Filehandler method.</li>
<li>Instead of driver, use the webelement reference variable to capture the screenshot of the target element instead of full webpage.</li>
</ol>
<pre class="brush: java; title: ; notranslate">
package Basics;

import java.io.File;

import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.io.FileHandler;

public class CaptureWebelementScreenshot {

public static void main(String&#x5B;] args) throws Exception {
// TODO Auto-generated method stub
WebDriver driver;
System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;E:\\Selenium-Softwares\\chromedriver.exe&quot;);
//System.setProperty(&quot;webdriver.gecko.driver&quot;, &quot;E:\\Selenium-Softwares\\geckodriver.exe&quot;);
driver=new ChromeDriver();
driver.get(&quot;http://demo.automationtesting.in/Register.html&quot;);
Thread.sleep(3000);
WebElement element = driver.findElement(By.id(&quot;imagetrgt&quot;));

File source = ((TakesScreenshot)element).getScreenshotAs(OutputType.FILE);
FileHandler.copy(source, new File(&quot;./screenshots/element.png&quot;));
Thread.sleep(3000);
driver.quit();

}

}

</pre>
<p><a href="https://www.youtube.com/watch?v=Jz2_MlVO5c8">Please watch the Youtube video for better understanding.</a><br />
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script><br />
(adsbygoogle = window.adsbygoogle || []).push({});<br />
</script></p>
<div id="themify_builder_content-2356" data-postid="2356" class="themify_builder_content themify_builder_content-2356 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/how-to-capture-webelement-screenshot-in-selenium-webdriver/">How to Capture WebElement Screenshot in Selenium Webdriver using selenium 4</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/how-to-capture-webelement-screenshot-in-selenium-webdriver/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Avoid Switch To Window in Selenium WebDriver</title>
		<link>https://automationtesting.in/how-to-avoid-switch-to-window-in-selenium-webdriver/</link>
					<comments>https://automationtesting.in/how-to-avoid-switch-to-window-in-selenium-webdriver/#respond</comments>
		
		<dc:creator><![CDATA[Krishna Sakinala]]></dc:creator>
		<pubDate>Sat, 03 Nov 2018 09:08:50 +0000</pubDate>
				<category><![CDATA[Selenium - Java]]></category>
		<category><![CDATA[JavascriptExecutor]]></category>
		<category><![CDATA[new window]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[switchtowindow]]></category>
		<category><![CDATA[tabbed window]]></category>
		<category><![CDATA[Webdriver]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=1933</guid>

					<description><![CDATA[<p>How to avoid Switch to window concept in selenium makes you switch between different windows without using “Switch to window” method. Let&#8217;s discuss in detail. In Many Real time scenarios, When we click on a link we see many of those opens in new tab or new windows. We generally use the switchtowindow concept from [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/how-to-avoid-switch-to-window-in-selenium-webdriver/">How to Avoid Switch To Window in Selenium WebDriver</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto" data-full-width-responsive="true"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<span style="font-weight: 400;">How to avoid Switch to window concept in selenium makes you switch between different windows without using “Switch to window” method. Let&#8217;s discuss in detail.</span></p>
<div class="post-video"><iframe loading="lazy" title="How to Avoid Switch To Window in Selenium WebDriver | Using JavaScriptExecutor" width="1165" height="655" src="https://www.youtube.com/embed/iKNCps4UT6o?wmode=transparent&#038;fs=1"  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
<p><span style="font-weight: 400;">In Many Real time scenarios, When we click on a link we see many of those opens in new tab or new windows. We generally use the switchtowindow concept from selenium and handle it. We need to be cautious while switching window and we should always switch back the driver focus to the old window when we need to handle the operation on the parent window. Please click this link for the example.</span></p>
<p><span style="font-weight: 400;">However, We can handle it in a different way to open the link in the same tab. We use JavaScriptExecutor to alter attributes for the DOM and we open the link in the same tab. Using JavaScriptExecutor we alter target attribute value and then we click on the link. Which makes links open in the same Tab. For navigation to back window we use navigate commands in selenium. This is a pretty easy way to handle different screens originating from the same application.</span><br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto" data-full-width-responsive="true"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<span style="font-weight: 400;">Sample Code:</span></p>
<pre class="brush: java; title: ; notranslate">
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class AvoidSwitchToWindow {

    public static void main(String&#x5B;] args) {

        WebDriverManager.chromedriver().setup();
        WebDriver driver = new ChromeDriver();

        driver.get(&quot;http://demo.automationtesting.in/Windows.html&quot;);

        String mainWindowTitle = driver.getTitle();
        System.out.println(&quot;Main Window Title is: &quot;+mainWindowTitle);

        WebElement we = driver.findElement(By.cssSelector(&quot;a&#x5B;href='http://www.sakinalium.in']&quot;));

        JavascriptExecutor js = (JavascriptExecutor)driver;
        js.executeScript(&quot;arguments&#x5B;0].setAttribute('target','_self');&quot;,we);

        we.click();

        String childWindowTitle = driver.getTitle();
        System.out.println(&quot;Child Window Title is: &quot;+childWindowTitle);

        driver.navigate().back();

        mainWindowTitle = driver.getTitle();
        System.out.println(&quot;Main Window Title is: &quot;+mainWindowTitle);
    }
}
</pre>
<p>In the above program, we changed the target attribute from _blank to _self. So, the new window will open in the same window instead of a new window.</p>
<p>Please watch the <a href="https://youtu.be/iKNCps4UT6o">YouTube video</a> for better understanding.<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto" data-full-width-responsive="true"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div id="themify_builder_content-1933" data-postid="1933" class="themify_builder_content themify_builder_content-1933 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/how-to-avoid-switch-to-window-in-selenium-webdriver/">How to Avoid Switch To Window in Selenium WebDriver</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/how-to-avoid-switch-to-window-in-selenium-webdriver/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>No More Driver EXE files for Selenium Execution &#8211; Instead Use WebDriverManager</title>
		<link>https://automationtesting.in/webdrivermanager/</link>
					<comments>https://automationtesting.in/webdrivermanager/#respond</comments>
		
		<dc:creator><![CDATA[Krishna Sakinala]]></dc:creator>
		<pubDate>Mon, 15 Oct 2018 11:54:42 +0000</pubDate>
				<category><![CDATA[Selenium - Java]]></category>
		<category><![CDATA[browser drivers]]></category>
		<category><![CDATA[chromedriver.exe]]></category>
		<category><![CDATA[geckodriver.exe]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[Selenium Webdriver]]></category>
		<category><![CDATA[webdrivermanager]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=1829</guid>

					<description><![CDATA[<p>Why do we use executable files for Launching browser using selenium? After selenium 3, We got habituated to download exe files like chrome.exe, geckodriver.exe etc. to launch browsers. All these executable files are standalone server executable files that implements JSON-wire protocol and works as a glue between the test script and Browsers. Most often, when [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/webdrivermanager/">No More Driver EXE files for Selenium Execution &#8211; Instead Use WebDriverManager</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<strong>Why do we use executable files for Launching browser using selenium?</strong></p>
<p>After selenium 3, We got habituated to download exe files like chrome.exe, geckodriver.exe etc. to launch browsers. All these executable files are standalone server executable files that implements JSON-wire protocol and works as a glue between the test script and Browsers.</p>
<p>Most often, when we have updates of our browser, we have to update exe files as well to implement JSON-wire Protocol. So, All the time We need download updated EXE files and we need to update our repository.</p>
<div class="post-video"><iframe loading="lazy" title="WebDriverManager API | Auto Download driver exe files in Selenium | Launch browser without exe" width="1165" height="655" src="https://www.youtube.com/embed/_XJgSV1j5TE?t=71s&#038;wmode=transparent&#038;fs=1"  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
<p>We have an alternate to escape from those hurdles with Webdriver Manager Library.</p>
<p><strong><a href="https://github.com/bonigarcia/webdrivermanager">Web Driver Manager</a> Reference Link:</strong></p>
<p>https://github.com/bonigarcia/webdrivermanager<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<strong>Advantages of WebdriverManager :</strong></p>
<ol>
<li>No need to download the chrome.exe,geckodriver.exe files etc..</li>
<li>No need to set driver exe file path in selenium program</li>
<li>No need to bother about the latest version of browser and exe files</li>
<li>So, no issues with browser updates and exe files</li>
</ol>
<p><strong>To start with it, add below maven dependency or download jar files from here:</strong></p>
<pre class="brush: xml; title: ; notranslate"> 
&lt;dependency&gt;
    &lt;groupId&gt;io.github.bonigarcia&lt;/groupId&gt;
    &lt;artifactId&gt;webdrivermanager&lt;/artifactId&gt;
    &lt;version&gt;3.0.0&lt;/version&gt;
    &lt;scope&gt;test&lt;/scope&gt;
&lt;/dependency&gt;
</pre>
<p><strong>Syntax:</strong></p>
<pre class="brush: plain; title: ; notranslate">
WebDriverManager.chromedriver().setup();
</pre>
<p>Above syntax will download chromedriver exe file in run time during your program. For first time it takes a while to launch your browser.</p>
<p><strong>Sample Program:</strong></p>
<pre class="brush: java; title: ; notranslate">
public class WebDriverManagerDemo
 {
	public static void main(String&#x5B;] args)
    {
		WebDriverManager.chromedriver().setup();
		WebDriver driver = new ChromeDriver();
		driver.get(&quot;https://automationtesting.in&quot;);
	}
}
</pre>
<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<strong>Is it possible to Download Particular version of Browser using WebDriverManager?</strong></p>
<p>Yes, it’s possible to download particular version using Webdrivermanager.</p>
<p><strong>Syntax:</strong></p>
<ol>
<li>chromedriver().version(&#8220;2.26&#8221;).setup()</li>
</ol>
<ul>
<li> Above syntax will download 2.26 version of chrome driver.</li>
</ul>
<ol start="2">
<li>firefoxdriver().arch32().setup()</li>
</ol>
<ul>
<li>Using Above syntax you will be able to download 32 bit Firefox driver.</li>
</ul>
<p><strong>Sample Program with ChromeDriver Version 2.26:</strong></p>
<pre class="brush: java; title: ; notranslate"> 
public class WebDriverManagerDemo
 {
	public static void main(String&#x5B;] args) 
    {
		WebDriverManager.chromedriver().version(&quot;2.26&quot;).setup();
		WebDriver driver = new ChromeDriver();
		driver.get(&quot;https://automationtesting.in&quot;);
	}
}
</pre>
<p>Above program will download the 2.26 version of chromedriver exe file and used the same to launch the browser.</p>
<p>&nbsp;</p>
<p>Please watch YouTube video for better understanding.</p>
<p>&#8211; This blog written by SUBBARAYUDU DARISIPUDI.<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div id="themify_builder_content-1829" data-postid="1829" class="themify_builder_content themify_builder_content-1829 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/webdrivermanager/">No More Driver EXE files for Selenium Execution &#8211; Instead Use WebDriverManager</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/webdrivermanager/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Handling Textboxes in Selenium</title>
		<link>https://automationtesting.in/handling-textboxes-in-selenium/</link>
					<comments>https://automationtesting.in/handling-textboxes-in-selenium/#comments</comments>
		
		<dc:creator><![CDATA[Krishna Sakinala]]></dc:creator>
		<pubDate>Mon, 01 May 2017 09:26:26 +0000</pubDate>
				<category><![CDATA[Selenium - Java]]></category>
		<category><![CDATA[Handle textbox in selenium]]></category>
		<category><![CDATA[how to handle textbox in selenium]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[input box]]></category>
		<category><![CDATA[input tag]]></category>
		<category><![CDATA[JavascriptExecutor]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[textbox]]></category>
		<category><![CDATA[textbox in selenium]]></category>
		<category><![CDATA[Webdriver]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=1747</guid>

					<description><![CDATA[<p>Handling textboxes in selenium will discuss about how to handle textboxes on a webpage. Basically a textbox is an input tag and will accept character sequence. While automating any application if you want to automate any textbox in selenium you have two types of options to enter data into the textbox. One is using sendKeys() [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/handling-textboxes-in-selenium/">Handling Textboxes in Selenium</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img src='http://automationtesting.in/wp-content/uploads/2017/05/HANDLE-TEXTBOXES-IN-SELENIUM.png'></p><p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
Handling textboxes in selenium will discuss about how to handle textboxes on a webpage. Basically a textbox is an input tag and will accept character sequence. While automating any application if you want to automate any textbox in selenium you have two types of options to enter data into the textbox. One is using <strong>sendKeys()</strong> method of selenium webdriver and another is using <a href="https://automationtesting.in/javascriptexecutor-in-selenium/">JavaScriptExecutor</a>.</p>
<div class="post-video"><iframe loading="lazy" title="Handling  Textboxes  in Selenium" width="1165" height="874" src="https://www.youtube.com/embed/VTBQPMjRoxY?wmode=transparent&#038;fs=1"  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
<p>While entering into the data we need to remember some of the points:</p>
<ol>
<li>You need to use <strong>sendKeys()</strong> method to enter data into textbox after identifying the webelement on the webpage.</li>
<li>If already a textbox contains data in it and you try to enter the data into same textbox then the data will be appended to the existing data.</li>
<li>If you want to enter the data which is already having data in it. Then you need to clear the textbox before entering data into it.</li>
<li>To clear the textbox we can use <strong>clear()</strong> method of selenium.</li>
<li>Sometimes selenium methods will not work and not able to identify the elements and not able to enter data into it. Then we can take the help of JavaScriptExecutor to enter data into the textbox.</li>
</ol>
<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
Now will see the examples for the above statements:</p>
<p>1. Use <strong>sendKeys()</strong> method to enter the data into textbox.</p>
<pre class="brush: java; highlight: [14]; title: ; notranslate">
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;

public class HandleTextbox {
    
    @Test
    public void textBox()
    {
        System.setProperty(&quot;webdriver.gecko.driver&quot;, &quot;/KRISHNA VOLUME/drivers/geckodriver&quot;);
        WebDriver driver = new FirefoxDriver();
        driver.get(&quot;http://demo.automationtesting.in/Register.html&quot;);
        driver.findElement(By.xpath(&quot;//*&#x5B;@id='basicBootstrapForm']/div&#x5B;1]/div&#x5B;1]/input&quot;)).sendKeys(&quot;Krishna&quot;);        
    }
}
</pre>
<p>2. Append data in a Textbox.</p>
<pre class="brush: java; highlight: [14,15]; title: ; notranslate">
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;

public class HandleTextbox {
    
    @Test
    public void textBox()
    {
        System.setProperty(&quot;webdriver.gecko.driver&quot;, &quot;/KRISHNA VOLUME/drivers/geckodriver&quot;);
        WebDriver driver = new FirefoxDriver();
        driver.get(&quot;http://demo.automationtesting.in/Register.html&quot;);
        driver.findElement(By.xpath(&quot;//*&#x5B;@id='basicBootstrapForm']/div&#x5B;1]/div&#x5B;1]/input&quot;)).sendKeys(&quot;Krishna&quot;);
        driver.findElement(By.xpath(&quot;//*&#x5B;@id='basicBootstrapForm']/div&#x5B;1]/div&#x5B;1]/input&quot;)).sendKeys(&quot;Sakinala&quot;);
    }
}
</pre>
<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
3. Clear the Textbox using <strong>clear()</strong> method.</p>
<pre class="brush: java; highlight: [14,15]; title: ; notranslate">
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;

public class HandleTextbox {
    
    @Test
    public void textBox()
    {
        System.setProperty(&quot;webdriver.gecko.driver&quot;, &quot;/KRISHNA VOLUME/drivers/geckodriver&quot;);
        WebDriver driver = new FirefoxDriver();
        driver.get(&quot;http://demo.automationtesting.in/Register.html&quot;);
        driver.findElement(By.xpath(&quot;//*&#x5B;@id='basicBootstrapForm']/div&#x5B;1]/div&#x5B;1]/input&quot;)).sendKeys(&quot;Krishna&quot;);
        driver.findElement(By.xpath(&quot;//*&#x5B;@id='basicBootstrapForm']/div&#x5B;1]/div&#x5B;1]/input&quot;)).clear();
    }
}
</pre>
<p>4. JavaScriptExecutor to enter data into textbox.</p>
<pre class="brush: java; highlight: [14,15]; title: ; notranslate">
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;

public class HandleTextbox {
    
    @Test
    public void textBox()
    {
        System.setProperty(&quot;webdriver.gecko.driver&quot;, &quot;/KRISHNA VOLUME/drivers/geckodriver&quot;);
        WebDriver driver = new FirefoxDriver();
        driver.get(&quot;http://demo.automationtesting.in/Register.html&quot;);
        JavascriptExecutor js = (JavascriptExecutor)driver;        
        js.executeScript(&quot;document.querySelector(\&quot;input&#x5B;placeholder='First Name']\&quot;).value='Krishna'&quot;);
    }
}
</pre>
<p>This way we can handle textboxes while automating the application using selenium webdriver.</p>
<p>Please watch YouTube video for better understanding.<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div id="themify_builder_content-1747" data-postid="1747" class="themify_builder_content themify_builder_content-1747 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/handling-textboxes-in-selenium/">Handling Textboxes in Selenium</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/handling-textboxes-in-selenium/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>JavaScriptExecutor in Selenium</title>
		<link>https://automationtesting.in/javascriptexecutor-selenium/</link>
					<comments>https://automationtesting.in/javascriptexecutor-selenium/#comments</comments>
		
		<dc:creator><![CDATA[Krishna Sakinala]]></dc:creator>
		<pubDate>Mon, 01 May 2017 06:04:18 +0000</pubDate>
				<category><![CDATA[Selenium - Java]]></category>
		<category><![CDATA[how to use javascriptexecutor]]></category>
		<category><![CDATA[how to use javascriptexecutor in selenium]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[JavascriptExecutor]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[Webdriver]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=1733</guid>

					<description><![CDATA[<p>JavaScriptExecutor is one of the interfaces in selenium. The basic advantage of JavaScriptExecutor is it provides a way to execute JavaScript in Selenium Webdriver. Sometimes locators may not work, in that case JavaScriptExecutor will helps to interact with the web elements on the particular webpage.  The reason behind this is; even selenium webdriver internally converts [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/javascriptexecutor-selenium/">JavaScriptExecutor in Selenium</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img src='http://automationtesting.in/wp-content/uploads/2017/05/JAVASCRIPTEXECUTOR-IN-SELENIUM.png'></p><p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<span style="font-weight: 400;">JavaScriptExecutor is one of the interfaces in selenium. The basic advantage of JavaScriptExecutor is it provides a way to execute <a href="https://www.javascript.com/">JavaScript</a> in Selenium Webdriver. Sometimes locators may not work, in that case JavaScriptExecutor will helps to interact with the web elements on the particular webpage.  The reason behind this is; even selenium webdriver internally converts language bindings into its equivalent JavaScript and injects into the respective browser. JavaScriptExecutor is also very useful to identify and interact with the hidden and disabled elements on the webpage.</span></p>
<div class="post-video"><iframe loading="lazy" title="JavaScript Executor  in Selenium" width="1165" height="874" src="https://www.youtube.com/embed/RZjExjrgCak?wmode=transparent&#038;fs=1"  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
<p><span style="font-weight: 400;">As JavaScriptExecutor is an interface so we can not create an object to this, for this we will type caste to driver object using below syntax:</span></p>
<pre class="brush: jscript; title: ; notranslate">
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript(javaScript, arguments);
</pre>
<p>Now we will see some of the examples below that how we can use JavaScriptExecutor to execute the JavaScript to interact with the web elements.</p>
<p><span style="font-weight: 400;">1. How to enter value into textbox:</span></p>
<pre class="brush: jscript; title: ; notranslate">
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript(&quot;document.getElementById('email').value='krishna@gmail.com'&quot;);
</pre>
<p><span style="font-weight: 400;">2. How to click a button:</span></p>
<pre class="brush: jscript; title: ; notranslate">
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript(&quot;document.querySelector('#enterimg').click()&quot;);
</pre>
<p><span style="font-weight: 400;">3. How to refresh a window:</span></p>
<pre class="brush: jscript; title: ; notranslate">
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript(&quot;history.go(0)&quot;);
</pre>
<p>4. <span style="font-weight: 400;">How to get the text of a particular web element:</span></p>
<pre class="brush: jscript; title: ; notranslate">
JavascriptExecutor js = (JavascriptExecutor)driver;
String text = js.executeScript(&quot;return document.getElementById('btn2').innerHTML&quot;).toString();
System.out.println(&quot;WebElement Text is : &quot;+ text);
</pre>
<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
5. <span style="font-weight: 400;">How to get the title of the WebPage:</span></p>
<pre class="brush: jscript; title: ; notranslate">
JavascriptExecutor js = (JavascriptExecutor)driver;
String text = js.executeScript(&quot;return document.title&quot;).toString();
System.out.println(&quot;Page Title is : &quot;+ text);
</pre>
<p>6. <span style="font-weight: 400;">How to scroll vertically for certain pixels:</span></p>
<pre class="brush: jscript; title: ; notranslate">
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript(&quot;window.scrollBy(0,500)&quot;);
</pre>
<p><span style="font-weight: 400;">The above code vertically scrolls 500 pixels towards down.</span></p>
<p>7. <span style="font-weight: 400;">How to scroll till the bottom of the web page:</span></p>
<pre class="brush: jscript; title: ; notranslate">
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript(&quot;window.scrollTo(0, document.body.scrollHeight)&quot;);
</pre>
<p>8. <span style="font-weight: 400;">How to scroll to a particular element:</span></p>
<pre class="brush: jscript; title: ; notranslate">
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript(&quot;document.querySelector('#countries').scrollIntoView()&quot;);
</pre>
<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
9. <span style="font-weight: 400;">How to navigate back to page:</span></p>
<pre class="brush: jscript; title: ; notranslate">
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript(&quot;window.history.back()&quot;);
</pre>
<p>10. <span style="font-weight: 400;">How to navigate to next page:</span></p>
<pre class="brush: jscript; title: ; notranslate">
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript(&quot;window.history.forward()&quot;);
</pre>
<p><span style="font-weight: 400;">This way we can JavaScriptExecutor to perform certain actions on a webpage if the normal selenium webdriver methods are not working.</span></p>
<p><span style="font-weight: 400;">Please watch YouTube video for better understanding.</span><br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div id="themify_builder_content-1733" data-postid="1733" class="themify_builder_content themify_builder_content-1733 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/javascriptexecutor-selenium/">JavaScriptExecutor in Selenium</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/javascriptexecutor-selenium/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>Selenium ElementNotVisibleException</title>
		<link>https://automationtesting.in/selenium-elementnotvisibleexception/</link>
					<comments>https://automationtesting.in/selenium-elementnotvisibleexception/#respond</comments>
		
		<dc:creator><![CDATA[Krishna Sakinala]]></dc:creator>
		<pubDate>Sat, 04 Feb 2017 01:37:05 +0000</pubDate>
				<category><![CDATA[Selenium - C#]]></category>
		<category><![CDATA[Selenium - Java]]></category>
		<category><![CDATA[ElementNotVisible Exception]]></category>
		<category><![CDATA[ElementNotVisibleException]]></category>
		<category><![CDATA[Exceptions in selenium]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[selenium exceptions]]></category>
		<category><![CDATA[Selenium Webdriver]]></category>
		<category><![CDATA[Webdriver]]></category>
		<category><![CDATA[webdriver exceptions]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=1316</guid>

					<description><![CDATA[<p>Selenium ElementNotVisibleException is also one of the frequent exceptions which we will face in selenium webdriver while automating any kind of application. This exception tells you that the WebElement that you are trying to interact with is not visible to the user. If the element is not visible to the user then they are not [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/selenium-elementnotvisibleexception/">Selenium ElementNotVisibleException</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
Selenium ElementNotVisibleException is also one of the frequent exceptions which we will face in selenium webdriver while automating any kind of application. This exception tells you that the WebElement that you are trying to interact with is not visible to the user. If the element is not visible to the user then they are not going to able to interact with it.</p>
<div class="post-video"><iframe loading="lazy" width="1165" height="874" src="https://www.youtube.com/embed/asFa4gjBpG0?wmode=transparent&#038;fs=1"  allowfullscreen></iframe></div>
<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p><strong>Below are the causes to face this exception:</strong></p>
<p>Thrown to indicate that although an element is present on the DOM, it is not visible, and so is not able to be interacted with. To overcome this kind of situation we need to use synchronization concept in selenium. So, add an explicit wait to wait for the correct conditions to be met before trying to interact with the element. We have an option to use wait in so many ways or conditions. Will make use of all those things depends on the situation and will try to resolve or handle these type of scenarios.</p>
<p>Sometimes if the element is there on the web page and not in the visible area then also you can find this type of exception. To overcome this situation we need to scroll to that particular web element first then you can interact with that element to resolve this type of exception. Most of the times selenium webdriver will take care of this situation that it will find the element which is not there on the visible area and it will interact with that element. But some times, if the situation comes, then we need to scroll to the particular web element or scroll in the webpage and then can interact with the required element.</p>
<p>This way we can overcome the ElementNotVisibleException in selenium webdriver.</p>
<p>Please watch the YouTube video for this blog for better understanding.<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div id="themify_builder_content-1316" data-postid="1316" class="themify_builder_content themify_builder_content-1316 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/selenium-elementnotvisibleexception/">Selenium ElementNotVisibleException</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/selenium-elementnotvisibleexception/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Selenium NoSuchWindowException</title>
		<link>https://automationtesting.in/selenium-nosuchwindowexception/</link>
					<comments>https://automationtesting.in/selenium-nosuchwindowexception/#respond</comments>
		
		<dc:creator><![CDATA[Krishna Sakinala]]></dc:creator>
		<pubDate>Mon, 12 Dec 2016 00:40:27 +0000</pubDate>
				<category><![CDATA[Selenium - C#]]></category>
		<category><![CDATA[Selenium - Java]]></category>
		<category><![CDATA[Exceptions in selenium]]></category>
		<category><![CDATA[NoSuchWindowException]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[selenium exceptions]]></category>
		<category><![CDATA[Selenium Webdriver]]></category>
		<category><![CDATA[Webdriver]]></category>
		<category><![CDATA[webdriver exceptions]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=473</guid>

					<description><![CDATA[<p>Selenium NoSuchWindowException is similar to NoSuchFrameException, this is also one of the frequent exceptions which we will face in selenium webdriver. Sometimes applications will have child windows(i.e. Separate windows) which will open when you click on any link or button. Normally if you want to automate the child windows then you need to switch to [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/selenium-nosuchwindowexception/">Selenium NoSuchWindowException</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
Selenium NoSuchWindowException is similar to NoSuchFrameException, this is also one of the frequent exceptions which we will face in selenium webdriver. Sometimes applications will have child windows(i.e. Separate windows) which will open when you click on any link or button. Normally if you want to automate the child windows then you need to switch to that window then only you can interact with the elements which are there on that window. To overcome this, we need to handle the opened windows using one of the webdriver methods called “<strong>driver.getWindowHandles()</strong>”. Once  you have this information then you can switch to the corresponding window to automate or interact with the window.</p>
<div class="post-video"><iframe loading="lazy" title="Selenium NoSuchWindowException" width="1165" height="874" src="https://www.youtube.com/embed/AKiOC67mDIs?wmode=transparent&#038;fs=1"  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
<p><strong>Below are the causes to face this exception:</strong></p>
<ol>
<li>This exception is caused because the list of windows hold by the driver.getWindowHandles() method is not up to date. One of the windows that previously existed is no longer exists; so, you can not switch to that window. To handle this we need to make sure that you are not closing a window without refreshing the available list of windows using this method.</li>
<li>The other reason behind this exception is that you may trying to switch to window before handling all the opened windows using driver.getWindowHandles() method. And we need to keep in mind that we should know which window we are trying to switch as getWindowHandles() holds all the windows which are opened. To get the main window then you can use one the webdriver methods called “<strong>driver.getWindowHandle()</strong>”. Once you have all the windows with you then you can loop through all the windows which are there in the list and we can switch to the desired window.</li>
</ol>
<p>Once you done with your work, then you need to come to the parent or default windows then only your execution will be smooth. This way can overcome the NoSuchWindowException in selenium webdriver.</p>
<p>Please watch the YouTube video for this blog for better understanding.<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div id="themify_builder_content-473" data-postid="473" class="themify_builder_content themify_builder_content-473 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/selenium-nosuchwindowexception/">Selenium NoSuchWindowException</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/selenium-nosuchwindowexception/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Selenium NoSuchFrameException</title>
		<link>https://automationtesting.in/selenium-nosuchframeexception/</link>
					<comments>https://automationtesting.in/selenium-nosuchframeexception/#respond</comments>
		
		<dc:creator><![CDATA[Krishna Sakinala]]></dc:creator>
		<pubDate>Mon, 12 Dec 2016 00:35:28 +0000</pubDate>
				<category><![CDATA[Selenium - C#]]></category>
		<category><![CDATA[Selenium - Java]]></category>
		<category><![CDATA[Exceptions in selenium]]></category>
		<category><![CDATA[NoSuchFrameException]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[selenium exceptions]]></category>
		<category><![CDATA[Selenium Webdriver]]></category>
		<category><![CDATA[Webdriver]]></category>
		<category><![CDATA[webdriver exceptions]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=465</guid>

					<description><![CDATA[<p>Selenium NoSuchFrameException will discuss about one of the frequent exceptions which we will face in selenium webdriver. You might face this kind of exception while automating the application if you have iFrames in your application. In modern applications people are using iFrames very frequently as if you want to show the information from other sources [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/selenium-nosuchframeexception/">Selenium NoSuchFrameException</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
Selenium NoSuchFrameException will discuss about one of the frequent exceptions which we will face in selenium webdriver. You might face this kind of exception while automating the application if you have iFrames in your application. In modern applications people are using iFrames very frequently as if you want to show the information from other sources then will use the frames in the application. We will face this kind of exception in different kind of scenarios. Will discuss the reasons for this issue and we will know we can overcome this issue.</p>
<div class="post-video"><iframe loading="lazy" title="Selenium NoSuchFrameException" width="1165" height="874" src="https://www.youtube.com/embed/KD7YIbYN7LE?wmode=transparent&#038;fs=1"  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
<p><strong>Below are the causes to face this exception:</strong></p>
<ol>
<li>Let&#8217;s assume in your application if you have a frame and it contains some elements (for example we will take a textbox in this scenarios) and you want to enter something into that textbox. For this we have captured the locator of the textbox and used the same in the code and everything is correct as per the logic. But after execution of the script we will find NoSuchFrameException. And best part here is selenium will tell us with the proper exception, instead if it says NoSuchElementException then it will be very difficult us to resolve these kind of scenarios.Actually the issue is, if you have frames in your application then you <strong>need to switch to that frame</strong> first and then only you will be able to interact with the elements which are there inside the frame in selenium.</li>
<li>Let&#8217;s assume one more scenario where you have a webpage with more than one frame. We will call them frame A and frame B. We will assume that we first switched to frame B to check/verify something in the frame B. If we then try to find frame A, we will get NoSuchFrameException. This is because frame A does not exist in the context of frame B.</li>
</ol>
<p>To overcome this issue is to always go back to the parent frame before trying to switch to another frame</p>
<p>If you have a frame inside a frame then you no need to go back to parent content. You can directly switch to that frame. But after completion of all the things which you want to perform inside the frames need to come out of the frames to continue further script capturing and execution.</p>
<p>You can use frame IDs or WebElements to locate the frames and then you can switch to them. You can also use frame indexes to switch to them but use this as a last option.</p>
<p>Please watch the YouTube video for this blog for better understanding.</p>
<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div id="themify_builder_content-465" data-postid="465" class="themify_builder_content themify_builder_content-465 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/selenium-nosuchframeexception/">Selenium NoSuchFrameException</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/selenium-nosuchframeexception/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Selenium NoSuchElementException</title>
		<link>https://automationtesting.in/selenium-nosuchelementexception/</link>
					<comments>https://automationtesting.in/selenium-nosuchelementexception/#respond</comments>
		
		<dc:creator><![CDATA[Krishna Sakinala]]></dc:creator>
		<pubDate>Sun, 11 Dec 2016 16:44:15 +0000</pubDate>
				<category><![CDATA[Selenium - C#]]></category>
		<category><![CDATA[Selenium - Java]]></category>
		<category><![CDATA[Exceptions in selenium]]></category>
		<category><![CDATA[ExpectedConditions]]></category>
		<category><![CDATA[NoSuchElementException]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[selenium exceptions]]></category>
		<category><![CDATA[Selenium Webdriver]]></category>
		<category><![CDATA[Synchronization]]></category>
		<category><![CDATA[Webdriver]]></category>
		<category><![CDATA[webdriver exceptions]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=459</guid>

					<description><![CDATA[<p>Selenium NoSuchElementException is the most and frequent facing exception. You will definitely find this kind of exception while automating the application. In this blog we will see what are the reasons to face this exception and how we can overcome this exception in detail. Below are the reasons to get this exception: The locator which [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/selenium-nosuchelementexception/">Selenium NoSuchElementException</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
Selenium NoSuchElementException is the most and frequent facing exception. You will definitely find this kind of exception while automating the application. In this blog we will see what are the reasons to face this exception and how we can overcome this exception in detail.</p>
<div class="post-video"><iframe loading="lazy" title="Selenim NoSuchElementException" width="1165" height="874" src="https://www.youtube.com/embed/U0cIPRus7O0?wmode=transparent&#038;fs=1"  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
<p><strong>Below are the reasons to get this exception:</strong></p>
<ol>
<li>The locator which you are using to locate the element is incorrect/changed.</li>
<li>The element which you are looking is not rendered.</li>
<li>Trying to find the element before it was rendered.</li>
</ol>
<p><strong>Locator is Incorrect/changed:</strong></p>
<p>Here we have two possibilities that the locator which you have written to identify an element may be incorrect or sometimes after writing/capturing the code, if there are any changes in the application then the locator may change. In both scenarios tool will not able to identify the element and it will throw NoSuchElementException.</p>
<p>To overcome this, we need to take the element locator which is causing this issue and validate against the application that the locator is identifying/highlighting any element on the application or not? For this we can use Firefox add-ons i.e. firebug and firepath then you place the locator in the firepath and validate the same against application that it is highlighting the element or not?</p>
<p>And sometimes if you are not navigated to a particular page after clicking on a link or button then it will cause this issue as it will look for the element to interact in the new page but actually it is not navigated to that page. But here the actual error show that it is not able to find particular element but the issue is not with that element as the page not yet navigated to that page. This kind of situation is bit tricky, but we need to find these type of issues also. Best example for this is navigating to application using login page but if the credentials are wrong then you might get this issue.</p>
<p>To overcome this issue, we can capture the screenshots for these type of scenarios and can find the issues by looking into these screenshots.</p>
<p><strong>Element Not Rendered:</strong></p>
<p>It is bit difficult to find this as something is not rendering on the application then you need to debug the code and see what could be the real issue. If something is not rendering then that is a bug in the application.</p>
<p>Here if you use the first issue resolution then it will not work as if you try to highlight the element in the application using firebug and firepath then it will not show anything in the console. But this is not an issue with the locator instead the element is not rendering on the application.</p>
<p>To overcome this issue, we can capture the screenshots for these type of scenarios and can find the issues by looking into these screenshots.<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<strong>Trying to find the element before it was rendered:</strong></p>
<p>Sometimes we are trying to interact with an element which is not yet rendered on the application. Here also we will get the same kind of issue which we saw in the above. But in the above case the element is not completely rendering, here it is rendering but taking bit more time to load. Now a days lots of modern websites use technologies such as jQuery or AngularJS, which use the JavaScript to manipulate the DOM. And Our Selenium is very fast. In many cases, it&#8217;s ready to start interacting with your website before the JavaScript has finished doing its job.</p>
<p>To overcome this, we need to think that how a manual tester will test these kind of scenarios. They will wait until the element renders on the application. So, same way we need to wait to load that particular element. For this we will use <strong>Synchronization</strong> concept i.e. we need to stop the code execution until the element renders. For this we can use <strong>ExpectedConditions</strong> class and its methods to achieve this functionality.</p>
<p>Please watch the YouTube video for this blog for better understanding.<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div id="themify_builder_content-459" data-postid="459" class="themify_builder_content themify_builder_content-459 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/selenium-nosuchelementexception/">Selenium NoSuchElementException</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/selenium-nosuchelementexception/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Selenium WebDriver Exceptions</title>
		<link>https://automationtesting.in/selenium-webdriver-exceptions/</link>
					<comments>https://automationtesting.in/selenium-webdriver-exceptions/#respond</comments>
		
		<dc:creator><![CDATA[Krishna Sakinala]]></dc:creator>
		<pubDate>Sun, 11 Dec 2016 15:44:26 +0000</pubDate>
				<category><![CDATA[Selenium - C#]]></category>
		<category><![CDATA[Selenium - Java]]></category>
		<category><![CDATA[ElementNotVisibleException]]></category>
		<category><![CDATA[Exceptions in selenium]]></category>
		<category><![CDATA[InvalidElementStateException]]></category>
		<category><![CDATA[NoSuchElementException]]></category>
		<category><![CDATA[NoSuchFrameException]]></category>
		<category><![CDATA[NoSuchWindowException]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[Selenium Webdriver]]></category>
		<category><![CDATA[SessionNotFoundException]]></category>
		<category><![CDATA[StaleElementReferenceException]]></category>
		<category><![CDATA[UnreachableBrowserException]]></category>
		<category><![CDATA[UnsupportedCommandException]]></category>
		<category><![CDATA[Webdriver]]></category>
		<category><![CDATA[webdriver exceptions]]></category>
		<guid isPermaLink="false">http://automationtesting.in/?p=454</guid>

					<description><![CDATA[<p>Selenium Webdriver exceptions will discuss about what kind of exception we will get in selenium webdriver while executing the automation scripts. An exception is an infallible statement; it will always tell you why something has gone wrong in the code. It may not always be easy to understand the exception, but it does always tell [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://automationtesting.in/selenium-webdriver-exceptions/">Selenium WebDriver Exceptions</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
Selenium Webdriver exceptions will discuss about what kind of exception we will get in selenium webdriver while executing the automation scripts. An exception is an infallible statement; it will always tell you why something has gone wrong in the code. It may not always be easy to understand the exception, but it does always tell the information about the what is wrong in the code.</p>
<p>One of the good things in selenium is while looking into the exception we will come to know what went wrong as the exception names will give some what clear picture for the error which we will face.</p>
<div class="post-video"><iframe loading="lazy" title="Selenium Webdriver Exceptions" width="1165" height="874" src="https://www.youtube.com/embed/OhokdRYeAkg?wmode=transparent&#038;fs=1"  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>
<p><strong>Below are some of the Exceptions which we will see while automating the applications:</strong></p>
<ol>
<li>NoSuchElementException</li>
<li>NoSuchFrameException</li>
<li>NoSuchWindowException</li>
<li>ElementNotVisibleException</li>
<li>StaleElementReferenceException</li>
<li>InvalidElementStateException</li>
<li>UnreachableBrowserException</li>
<li>SessionNotFoundException</li>
</ol>
<p>Now we will see briefly about these exceptions:</p>
<p><strong>NoSuchElementException:</strong></p>
<p>This is the most and frequent facing exception. You will definitely find this kind of exception while automating the application. The reason for this exception is, the element you are trying to find does not exist.</p>
<p><strong>NoSuchFrameException:</strong></p>
<p>This is also most and frequent facing exception. In modern applications people are using iFrames very frequently. When you try to find an iFrame on application and it is not exist in the application then code will throw NoSuchFrameException.</p>
<p><strong>NoSuchWindowException:</strong></p>
<p>This is also very similar to the previous exception. A Window is a browser which is opened by the webdriver or child window(i.e.another browser opened from the parent browser). When you try find a Window and that is not available at present, then the code will throw NoSuchWindowException.</p>
<p><strong>ElementNotVisibleException:</strong></p>
<p>This is also most and very frequent facing exception. This ElementNotVisibleException tells you that the WebElement that you are trying to interact with is not visible to the user.<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p><strong>StaleElementReferenceException:</strong></p>
<p>This is an exception that you will quite often see when you work with AJAX or heavy JavaScript websites, where the DOM is continually being changed. When the element is no longer attached to the DOM then you will face this exception.</p>
<p><strong>InvalidElementStateException:</strong></p>
<p>This exception you can not find very frequently. When you try to interact with any element then an unexpected popup will come but we are not sure why and what it is. An InvalidElementStateException is thrown when the WebElement that you are trying to interact with is not in a state that would allow you to perform the action that you would like to perform.</p>
<p><strong>UnreachableBrowserException:</strong></p>
<p>Sometimes you will face this type of Exception. As we know that selenium sends commands to the browser to execute and get the response back. Sometimes we will not get the response from the browser then we will get UnreachableBrowserException.</p>
<p><strong>SessionNotFoundException:</strong></p>
<p>You will not get this kind of exception frequently. But while you executing your tests and something will go wrong and will lose connection with the browser instance that you are driving. Then you will get SessionNotFoundException.</p>
<p>These are the most frequently exceptions we will face while automating any kind of application.</p>
<p>Please watch the YouTube video for this blog for better understanding.<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Responsive --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-9173866185064071" data-ad-slot="6638633547" data-ad-format="auto"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<div id="themify_builder_content-454" data-postid="454" class="themify_builder_content themify_builder_content-454 themify_builder themify_builder_front">

	</div>
<!-- /themify_builder_content --><p>The post <a rel="nofollow" href="https://automationtesting.in/selenium-webdriver-exceptions/">Selenium WebDriver Exceptions</a> appeared first on <a rel="nofollow" href="https://automationtesting.in">Selenium Webdriver Appium Complete Tutorial</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://automationtesting.in/selenium-webdriver-exceptions/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
