from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
chrome_driver_path = Service(
"C:Developmentchromedriver_win32chromedriver.exe")
driver = webdriver.Chrome(service=chrome_driver_path)
URL = "https://en.wikipedia.org/wiki/Main_Page"
driver.get(URL)
articles = driver.find_element(By.XPATH, '//*[@id="articlecount"]/a[1]')
print(articles.text)
driver.quit()
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.
var cap = ((RemoteWebDriver)driver).Capabilities;
var browserName = cap["browserName"].ToString();