Part 6: Usages Of Javascripts In Selenium: Locating WebElements Using JavaScript Commands

Hello Folks, In this post, We will learn about javascript commands which we can use to locate a web element on web page. When to use javascript commands to locate web element? We already have enough locators in Selenium webdriver, which help us in identifying web elements on a web page. But sometimes, these locating strategies … Continue reading Part 6: Usages Of Javascripts In Selenium: Locating WebElements Using JavaScript Commands

Part 5: Usages Of Javascripts In Selenium: Understanding Method executeAsyncScript Of JavascriptExecutor

Hello folks, In last post we have learnt about executeScript methods of JavascriptExecutor interface. There is another method called executeAsyncScript in JavascriptExecutor interface which is not frequently used. But we must be aware about it usage so that we can use whenever required. First let's learn what is Synchronous and Asynchronous? In very simple words, Synchronous = Blocking … Continue reading Part 5: Usages Of Javascripts In Selenium: Understanding Method executeAsyncScript Of JavascriptExecutor

Part 4: Usages Of Javascripts In Selenium: Understanding Method executeScript Of JavascriptExecutor

Hello folks, In this post, we will learn about method executeScript of JavascriptExecutor interface. JavascriptExecutor interface provides two methods to execute JavaScript commands. executeScript : To execute synchronized JavaScript script commands executeAsyncScript: To execute asynchronous JavaScript commands We will learn about "executeScript " method in this post. Synatx: java.lang.Object executeScript(java.lang.String script,java.lang.Object... args) As per selenium doc, above method executes JavaScript in the context of … Continue reading Part 4: Usages Of Javascripts In Selenium: Understanding Method executeScript Of JavascriptExecutor

Part 3: Usages Of Javascripts In Selenium: Problem You Might Face While Executing Javascript Commands In Selenium

Hello Folks, In this post, I will explain a problem which beginner in selenium may encounter and you don't know how to resolve it. I have also faced the same issue and after lot of googling , I found the solution. When you try to execute any javascript command, you might see error message as … Continue reading Part 3: Usages Of Javascripts In Selenium: Problem You Might Face While Executing Javascript Commands In Selenium

Part 2: Usages Of Javascripts In Selenium: How To Run Javascript Commands In Selenium

Hello folks, In previous post, we have learnt why do we need javascript in Selenium webdriver.  In this post we will learn how to run javascript commands in selenium webdriver. Selenium people provides an interface named "JavascriptExecutor", which provides declaration of two methods as below: Object executeScript(String arg0, Object... arg1); Object executeAsyncScript(String arg0, Object... arg1); … Continue reading Part 2: Usages Of Javascripts In Selenium: How To Run Javascript Commands In Selenium

Part 1: Usages Of Javascripts In Selenium: Why We Need Javascript Commands In Selenium

Hello Folks, We will see series of posts on Usage of JavaScripts in Selenium. Let's start with basics. What is JavaScript? Definition from JS offical website: "JavaScript ("JS" for short) is a full-fledged dynamic programming language that, when applied to an HTML document, can provide dynamic interactivity on websites." I hope you should be aware of basic js. If not, you can … Continue reading Part 1: Usages Of Javascripts In Selenium: Why We Need Javascript Commands In Selenium

Why Do We Up cast Browser Driver Class Object To WebDriver?

Hello Folks, In this post, we will learn about a frequently asked interview question in selenium that "Why we upcast a browser driver class object to WebDriver type?". OR, Why do we write as below: WebDriver driver= new FirefoxDriver(); WebDriver driver= new ChromeDriver (); Why not as below: FirefoxDriver driver= new FirefoxDriver(); ChromeDriver driver= new ChromeDriver (); Let's … Continue reading Why Do We Up cast Browser Driver Class Object To WebDriver?