Like us on Facebook

LightBlog

June 30, 2015

Run WebDriver script in Safari Browser

June 30, 2015 2
If you want to run WebDriver script in Safari. Manually we need to install the SafariDriver browser extension.

Prerequisites:

Safari 5.1+
SafariDriver browser extension.

you can download SafariDriver browser extension from below sites:

http://selenium-release.storage.googleapis.com/index.html?path=2.45/

or

There is safari driver section in selenium site.
http://docs.seleniumhq.org/download/  ---go to Safari Driver section and download the latest version of SafariDriver browser extension.

Once you download safari browser extension it will be in this format "SafariDriver.safariextz"

Double click that file or open with Safari browser. It will ask you for Installation confirmation, click Install and once installation is done you can see Webdriver Extension. Safari--Edit--Preferences.




If you see this extension then you should be able to run script in safari browser.

Once installed, writing a test for Safari is just as straightforward as using the FirefoxDriver

Below is the sample code of to run script using safari browser.





June 26, 2015

findElement vs findElements

June 26, 2015 0
findElement vs findElements
Here is the post how to use findelements...

findElement()

  1. Find the first element within the current page
  2. Returns a single WebElement.
  3.  Syntax: WebElement findElement(By by)
findElements()

  1. Find all elements within the current page.
  2. Returns List of WebElements.
  3. Syntax:  java.util.List findElements(By by)

In this scenario i will show search for restaurants and  get number of results on webpage and get ratings of each restaurant .