Basic To Advanced Selenium Java Full Course - Session 11 - iFrames, JSExecutor & Headless Browser
Handling iFrames: iFrame is a web page which is embedded in another web page or an HTML document embedded inside another HTML document. Different methods to handle iFrame: switchTo().frame(index) Switch to a frame using its index switchTo().frame(name) Switch to a frame using its name switchTo().frame(id) Switch to a frame using its id switchTo().frame(WebElement) Switch to a frame which is a web element switchTo().parentFrame() Switch to the parent frame of the current frame switchTo().defaultContent() Switch to the main document which contains the iframes JavaScript Executor: JavaScript is the preferred language inside the browser to interact with HTML DOM. JavaScriptExecutor is an Interface that helps to execute JavaScript through Selenium WebDriver. Methods: executeScript Executes JavaScript in the context of the currently selected frame or window. The script fragment provided will be executed as the body of an anonymous function. executeAsyncScript Executes an asynchronous piece of JavaScript in the context of the currently selected frame or window. With Asynchronous script, your page renders more quickly. Syntax: JavaScriptExecutor js = (JavaScriptExecutor) driver; js.executeScript(Script,Arguments); What is Headless browser? A headless browser is a web browser without a graphical user interface. Headless browsers provide automated control of a web page in an environment similar to popular web browsers, but are executed via a command line interface or using network communication. Advantages: Better Performance Faster Response Platform Independent Allows multi tasking Limitations: Debugging is not feasible No user interface
Download
0 formatsNo download links available.