A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://seleniumhq.github.io/selenium/docs/api/dotnet/webdriver/OpenQA.Selenium.WebDriver.html below:

Class WebDriver

Class WebDriver
Namespace
OpenQA.Selenium
Assembly
WebDriver.dll

A base class representing a driver for a web browser.

public class WebDriver : IWebDriver, IDisposable, ISearchContext, IJavaScriptExecutor, IFindsElement, ITakesScreenshot, ISupportsPrint, IActionExecutor, IAllowsFileDetection, IHasCapabilities, IHasCommandExecutor, IHasSessionId, ICustomDriverCommandExecutor, IHasVirtualAuthenticator
Inheritance

WebDriver

Implements
Derived
Inherited Members
Extension Methods
Constructors WebDriver(ICommandExecutor, ICapabilities)

Initializes a new instance of the WebDriver class.

protected WebDriver(ICommandExecutor executor, ICapabilities capabilities)
Parameters
executor ICommandExecutor

The ICommandExecutor object used to execute commands.

capabilities ICapabilities

The ICapabilities object used to configure the driver session.

Fields DefaultCommandTimeout

The default command timeout for HTTP requests in a RemoteWebDriver instance.

protected static readonly TimeSpan DefaultCommandTimeout
Field Value
TimeSpan
Properties AuthenticatorId

Gets the cached virtual authenticator ID, or null if no authenticator ID is set.

public string? AuthenticatorId { get; }
Property Value
string
Capabilities

Gets the ICapabilities that the driver session was created with, which may be different from those requested.

public ICapabilities Capabilities { get; }
Property Value
ICapabilities
CommandExecutor

Gets the ICommandExecutor which executes commands for this driver.

public ICommandExecutor CommandExecutor { get; }
Property Value
ICommandExecutor
CurrentWindowHandle

Gets the current window handle, which is an opaque handle to this window that uniquely identifies it within this driver instance.

public string CurrentWindowHandle { get; }
Property Value
string
ElementFactory

Gets or sets the factory object used to create instances of WebElement or its subclasses.

protected WebElementFactory ElementFactory { get; set; }
Property Value
WebElementFactory
Exceptions
ArgumentNullException

If value is set to null.

FileDetector

Gets or sets the IFileDetector responsible for detecting sequences of keystrokes representing file paths and names.

public virtual IFileDetector FileDetector { get; set; }
Property Value
IFileDetector
Exceptions
ArgumentNullException

If value is set to null.

IsActionExecutor

Gets a value indicating whether this object is a valid action executor.

public bool IsActionExecutor { get; }
Property Value
bool
PageSource

Gets the source of the page last loaded by the browser.

public string PageSource { get; }
Property Value
string
SessionId

Gets the SessionId for the current session of this driver.

public SessionId SessionId { get; }
Property Value
SessionId
Title

Gets the title of the current browser window.

public string Title { get; }
Property Value
string
Url

Gets or sets the URL the browser is currently displaying.

public string Url { get; set; }
Property Value
string
See Also
WindowHandles

Gets the window handles of open browser windows.

public ReadOnlyCollection<string> WindowHandles { get; }
Property Value
ReadOnlyCollection<string>
Methods AddCredential(Credential)

Add a credential to the Virtual Authenticator/

public void AddCredential(Credential credential)
Parameters
credential Credential

The credential to be stored in the Virtual Authenticator

Exceptions
ArgumentNullException

If credential is null.

InvalidOperationException

If a Virtual Authenticator has not been added yet.

AddVirtualAuthenticator(VirtualAuthenticatorOptions)

Creates a Virtual Authenticator.

public string AddVirtualAuthenticator(VirtualAuthenticatorOptions options)
Parameters
options VirtualAuthenticatorOptions

Virtual Authenticator Options.

Returns
string

Authenticator id as string

Exceptions
ArgumentNullException

If options is null.

Close()

Closes the Browser

Dispose()

Dispose the WebDriver Instance

Dispose(bool)

Stops the client from running

protected virtual void Dispose(bool disposing)
Parameters
disposing bool

if its in the process of disposing

Execute(string, Dictionary<string, object>?)

Executes a command with this driver.

protected virtual Response Execute(string driverCommandToExecute, Dictionary<string, object>? parameters)
Parameters
driverCommandToExecute string

A DriverCommand value representing the command to execute.

parameters Dictionary<string, object>

A Dictionary<TKey, TValue> containing the names and values of the parameters of the command.

Returns
Response

A Response containing information about the success or failure of the command and any data returned by the command.

Exceptions
ArgumentNullException

If driverCommandToExecute is null.

ExecuteAsync(string, Dictionary<string, object>?)

Executes a command with this driver.

protected virtual Task<Response> ExecuteAsync(string driverCommandToExecute, Dictionary<string, object>? parameters)
Parameters
driverCommandToExecute string

A DriverCommand value representing the command to execute.

parameters Dictionary<string, object>

A Dictionary<TKey, TValue> containing the names and values of the parameters of the command.

Returns
Task<Response>

A Response containing information about the success or failure of the command and any data returned by the command.

Exceptions
ArgumentNullException

If driverCommandToExecute is null.

ExecuteAsyncScript(string, params object?[]?)

Executes JavaScript "asynchronously" in the context of the currently selected frame or window, executing the callback function specified as the last argument in the list of arguments.

public object? ExecuteAsyncScript(string script, params object?[]? args)
Parameters
script string

The JavaScript code to execute.

args object[]

The arguments to the script.

Returns
object

The value returned by the script.

ExecuteCustomDriverCommand(string, Dictionary<string, object>)

Executes a command with this driver.

public object? ExecuteCustomDriverCommand(string driverCommandToExecute, Dictionary<string, object> parameters)
Parameters
driverCommandToExecute string

The name of the command to execute. The command name must be registered with the command executor, and must not be a command name known to this driver type.

parameters Dictionary<string, object>

A Dictionary<TKey, TValue> containing the names and values of the parameters of the command.

Returns
object

A Response containing information about the success or failure of the command and any data returned by the command.

Exceptions
WebDriverException

The command returned an exceptional value.

ExecuteScript(PinnedScript, params object?[]?)

Executes JavaScript in the context of the currently selected frame or window

public object? ExecuteScript(PinnedScript script, params object?[]? args)
Parameters
script PinnedScript

A PinnedScript object containing the JavaScript code to execute.

args object[]

The arguments to the script.

Returns
object

The value returned by the script.

Exceptions
ArgumentNullException

If script is null.

ExecuteScript(string, params object?[]?)

Executes JavaScript in the context of the currently selected frame or window

public object? ExecuteScript(string script, params object?[]? args)
Parameters
script string

The JavaScript code to execute.

args object[]

The arguments to the script.

Returns
object

The value returned by the script.

ExecuteScriptCommand(string, string, params object?[]?)

Executes JavaScript in the context of the currently selected frame or window using a specific command.

protected object? ExecuteScriptCommand(string script, string commandName, params object?[]? args)
Parameters
script string

The JavaScript code to execute.

commandName string

The name of the command to execute.

args object[]

The arguments to the script.

Returns
object

The value returned by the script.

FindElement(By)

Finds the first element in the page that matches the By object

public IWebElement FindElement(By by)
Parameters
by By

By mechanism to find the object

Returns
IWebElement

IWebElement object so that you can interact with that object

Examples
IWebDriver driver = new InternetExplorerDriver();
IWebElement elem = driver.FindElement(By.Name("q"));
Exceptions
ArgumentNullException

If by is null.

FindElement(string, string)

Finds an element matching the given mechanism and value.

public virtual IWebElement FindElement(string mechanism, string value)
Parameters
mechanism string

The mechanism by which to find the element.

value string

The value to use to search for the element.

Returns
IWebElement

The first IWebElement matching the given criteria.

FindElements(By)

Finds the elements on the page by using the By object and returns a ReadOnlyCollection of the Elements on the page

public ReadOnlyCollection<IWebElement> FindElements(By by)
Parameters
by By

By mechanism to find the element

Returns
ReadOnlyCollection<IWebElement>

ReadOnlyCollection of IWebElement

Examples
IWebDriver driver = new InternetExplorerDriver();
ReadOnlyCollection<IWebElement> classList = driver.FindElements(By.ClassName("class"));
FindElements(string, string)

Finds all elements matching the given mechanism and value.

public virtual ReadOnlyCollection<IWebElement> FindElements(string mechanism, string value)
Parameters
mechanism string

The mechanism by which to find the elements.

value string

The value to use to search for the elements.

Returns
ReadOnlyCollection<IWebElement>

A collection of all of the IWebElements matching the given criteria.

GetCapabilitiesDictionary(ICapabilities)

Gets the capabilities as a dictionary.

protected virtual Dictionary<string, object> GetCapabilitiesDictionary(ICapabilities capabilitiesToConvert)
Parameters
capabilitiesToConvert ICapabilities

The dictionary to return.

Returns
Dictionary<string, object>

A Dictionary consisting of the capabilities requested.

Exceptions
ArgumentNullException

If capabilitiesToConvert is null.

GetCredentials()

Retrieves all the credentials stored in the Virtual Authenticator

public List<Credential> GetCredentials()
Returns
List<Credential>

List of credentials

Exceptions
InvalidOperationException

If a Virtual Authenticator has not been added yet.

GetScreenshot()

Gets a Screenshot object representing the image of the page on the screen.

public Screenshot GetScreenshot()
Returns
Screenshot

A Screenshot object containing the image.

Manage()

Instructs the driver to change its settings.

Returns
IOptions

An IOptions object allowing the user to change the settings of the driver.

Navigate()

Instructs the driver to navigate the browser to another location.

public INavigation Navigate()
Returns
INavigation

An INavigation object allowing the user to access the browser's history and to navigate to a given URL.

PerformActions(IList<ActionSequence>)

Performs the specified list of actions with this action executor.

public void PerformActions(IList<ActionSequence> actionSequenceList)
Parameters
actionSequenceList IList<ActionSequence>

The list of action sequences to perform.

Print(PrintOptions)

Gets a PrintDocument object representing a PDF-formatted print representation of the page.

public PrintDocument Print(PrintOptions printOptions)
Parameters
printOptions PrintOptions

A PrintOptions object describing the options of the printed document.

Returns
PrintDocument

The PrintDocument object containing the PDF-formatted print representation of the page.

Exceptions
ArgumentNullException

If printOptions is null.

Quit()

Close the Browser and Dispose of WebDriver

RegisterCustomDriverCommand(string, CommandInfo?)

Registers a command to be executed with this driver instance.

public bool RegisterCustomDriverCommand(string commandName, CommandInfo? commandInfo)
Parameters
commandName string

The unique name of the command to register.

commandInfo CommandInfo

The CommandInfo object describing the command.

Returns
bool

true if the command was registered; otherwise, false.

RegisterCustomDriverCommands(IReadOnlyDictionary<string, CommandInfo>)

Registers a set of commands to be executed with this driver instance.

public void RegisterCustomDriverCommands(IReadOnlyDictionary<string, CommandInfo> commands)
Parameters
commands IReadOnlyDictionary<string, CommandInfo>

An IReadOnlyDictionary<TKey, TValue> where the keys are the names of the commands to register, and the values are the CommandInfo objects describing the commands.

RegisterInternalDriverCommand(string, CommandInfo?)

Registers a command to be executed with this driver instance as an internally known driver command.

protected bool RegisterInternalDriverCommand(string commandName, CommandInfo? commandInfo)
Parameters
commandName string

The unique name of the command to register.

commandInfo CommandInfo

The CommandInfo object describing the command.

Returns
bool

true if the command was registered; otherwise, false.

RemoveAllCredentials()

Removes all the credentials stored in the Virtual Authenticator.

public void RemoveAllCredentials()
Exceptions
InvalidOperationException

If a Virtual Authenticator has not been added yet.

RemoveCredential(byte[])

Removes the credential identified by the credentialId from the Virtual Authenticator.

public void RemoveCredential(byte[] credentialId)
Parameters
credentialId byte[]

The id as byte array that uniquely identifies a credential

Exceptions
ArgumentNullException

If credentialId is null.

InvalidOperationException

If a Virtual Authenticator has not been added yet.

RemoveCredential(string)

Removes the credential identified by the credentialId from the Virtual Authenticator.

public void RemoveCredential(string credentialId)
Parameters
credentialId string

The id as string that uniquely identifies a credential

Exceptions
ArgumentNullException

If credentialId is null.

InvalidOperationException

If a Virtual Authenticator has not been added yet.

RemoveVirtualAuthenticator(string)

Removes the Virtual Authenticator

public void RemoveVirtualAuthenticator(string authenticatorId)
Parameters
authenticatorId string

Id as string that uniquely identifies a Virtual Authenticator.

Exceptions
ArgumentNullException

If authenticatorId is null.

ResetInputState()

Resets the input state of the action executor.

public void ResetInputState()
SetUserVerified(bool)

Sets the isUserVerified property for the Virtual Authenticator.

public void SetUserVerified(bool verified)
Parameters
verified bool

The boolean value representing value to be set

StartSession(ICapabilities)

Starts a session with the driver

protected void StartSession(ICapabilities capabilities)
Parameters
capabilities ICapabilities

Capabilities of the browser

SwitchTo()

Method to give you access to switch frames and windows

public ITargetLocator SwitchTo()
Returns
ITargetLocator

Returns an Object that allows you to Switch Frames and Windows

Examples
IWebDriver driver = new InternetExplorerDriver();
driver.SwitchTo().Frame("FrameName");

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4