Part 9: Usages Of Javascripts In Selenium: How To Scroll Page By Page In Selenium WebDriver Using Javascript

Hello Folks, In last post, we have learnt to scroll a web page by pixels. In this post, we will see how to scroll a web page , page by page. What is page in Web page? Follow below steps: Open browser and load url “http://www.makeseleniumeasy.com/“. Wait till page is loaded. Now press Key “Page […]

Part 8: Usages Of Javascripts In Selenium: How To Scroll Web Page In Selenium WebDriver Using Javascript

Hello Folks, In last post, we learnt about methods of Javascript which are used to scroll a web page. In this post, we will see usage of those methods in selenium webdriver. Scroll web page using scrollTo method: Selenium webdriver provides an inbuilt method called executeScript to execute any javascript command. We will use same methods […]

Part 7: Usages Of Javascripts In Selenium: Difference Among ScrollBy, ScrollTo and Scroll Methods Of Javascript

Hello Folks, While automating, you may encounter issues as below: Element is not clickable, other element would receive click. Screenshot of required web element is not captured. Element is not visible while element is present in DOM. Unable to capture screen of whole web page vertically or horizontally. All these problems could be solved using […]

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 […]

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 […]

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 […]

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 […]

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); […]

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 […]

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 […]

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.