selenium chromium webdriver code example
Example 1: selenium webdriver python
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()
Example 2: what is webdriver in selenium
WebDriver:
WebDriver object represents the browser in Selenium.
Using this object you can control the Web browser.
It is an interface of the org.openqa.selenium.* package.
Upon instantiating the implementations of this class
the browser will be launched.
FirefoxDrive, ChromeDriver,
InternetExplorerDriver, SafariDriver, OperaDriver,
HtmlUnitDriver, RemoteWebDriver are few
implementations of the WebDriver Interface.