Selenium Webdriver
Webdriver is the latest version of Selenium. From Selenium 2.x version of series has Selenium WebDriver and RC also for backward compatibility. Webdriver has more libraries and features to work with Compared with RC. Like RC there is no need of selenium server to run if we are working with Webdriver. Webdriver libraries will directly interact with browser.
·
Webdriver is purely object oriented as compare
to Selenium RC.
·
Interacts natively with browser where as
Selenium RC is JavaScript based.
·
Webdriver supports for testing iPhone and Android
applications but Selenium RC is not supported.
·
Implements HTMLUnit driver which makes test
execution really fast.
·
Like RC supports for all the browsers and also
supports for latest version of Firefox & IE.
·
But it is complex and a bit large API when
compared to RC
·
While referring elements using xpath no need to
append “xpath=\\” like in RC
To Develop Webdriver Scripts and Execute
Same Configuration done for RC
is sufficient like
Eclipse
Java Installation
Selenium 2.x version Libraries
and these are added in Eclipse
Some of the Webdriver methods
get(“url”) – navigate to the url specified.
getTitle() - Get the title of the current browser.
getPageSource() - Get the source code of the current browser /Page .
close() - Closes the current browser.
quit() - Close all associated browsers.
getCurrentUrl()
- Get the URL of the current webpage.
getWindowHandle()-Return an handle of
the window that uniquely identifies it within this driver instance.
navigate("url")--allowing the
driver to access the browser's history and to navigate to a given URL
navigate().back()--Move back to
previous page in the browser's history.
navigate().forward()--Move to forward
page in the browser's history
navigate().refresh()--Refresh the
current page
switchTo()--Send future commands to a
different frame or window / change focus to specified window / frame
Comments
Post a Comment