Skip to main content

Posts

How to Download File using WebDriver

When we download file from a web page, it asks for confirmation to download along with the download location. For automating this download file process, we have to set some preferences based on the browser used. In this article, we will see file download for Firefox and Chrome separately. Download File using FirefoxDriver For firefox, we have to set the below firefox profile preferences. browser.download.dir  – The download directory browser.download.folderList  – It has to be set to 2 to make firefox use custom download directory (the above given download directory). If value is 0, it downloads the file to user’s desktop and if its 1, it uses the default Downloads folder. browser.download.manager.showWhenStarting  – Whether to show the download manager when starting download browser.helperApps.neverAsk.saveToDisk  – Never ask for saving to disk for the given file types. Using the above preferences, we can create the profile and initialize the FirefoxDriver. 1 2

TestNG with Selenium Grid

We will use the Selenium Grid with TestNG. To run the TestCases with Selenium Grid on remote machine. You need to use  RemoteWebDriver  .  What is RemoteWebDriver? RemoteWebDriver  is an implementation class of the WebDriver interface  that a test script developer can use to execute their test scripts via the  RemoteWebDriver server on a remote machine.  There are two parts to RemoteWebDriver; a server and a client The RemoteWebDriver server is a component that listens on a port for various requests from a RemoteWebDriver client. Once it receives the requests, it forwards them to any of the following: Firefox Driver, IE Driver, or Chrome Driver, whichever is asked. How can you create the Object of RemoteWebDriver ? To create the Object of RemoteWebDriver or invoke the RemoteWebDriver. We need to follow the below mentioned steps.  First you need to create the object of  DesiredCapabilities  and assign the Browser to it. Browser could be  firefox, chrome a