Java Context
In Selenium, we have a Webdriver Interface and there are lot of classes that implement this interface.
So let us first try to understand this interface.
What is inside this WebDriver Interface?
Important methods declared inside this interface are -
Now let us take a look at different constructors for ChromeDriver.
Now let us try to understand the significance of these classes.
Capabilities are used to manage the browser attributes. For example - we can set the browser name, version, platform using capabilities.
ChromeDriverService is used to manage the chrome server (exe). Finally, ChromeOptions are used to set the options specific to the chrome browser like adding extensions, setting the binary path etc.
Constructors for other classes also take similar arguments as mentioned above.
Capabilities used by Selenium Server
You can find more information on the link - https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities.
What do you think on above selenium topic. Please provide your inputs and comments. You can write to me at reply2sagar@gmail.com
In Selenium, we have a Webdriver Interface and there are lot of classes that implement this interface.
So let us first try to understand this interface.
What is inside this WebDriver Interface?
Important methods declared inside this interface are -
- get
- findElement
- getTitle
- getPageSource....etc
The classes that implement this interface are given below.
- ChromeDriver
- EventFiringWebDriver
- FirefoxDriver
- HtmlUnitDriver
- InternetExplorerDriver
- OperaDriver
- RemoteWebDriver
- SafariDriver
Now let us take a look at different constructors for ChromeDriver.
- ChromeDriver()
- ChromeDriver(Capabilities capabilities)
- ChromeDriver(ChromeDriverService service)
- ChromeDriver(ChromeDriverService service, Capabilities capabilities)
- ChromeDriver(ChromeDriverService service, ChromeOptions options)
- ChromeDriver(ChromeOptions options)
As you can see, in Java Selenium API, we have 6 constructors for the ChromeDriver class.
The first constructor takes no arguments. But rest of them are taking the arguments as mentioned below.
- Capabilities
- ChromeDriverService
- ChromeOptions
Now let us try to understand the significance of these classes.
Capabilities are used to manage the browser attributes. For example - we can set the browser name, version, platform using capabilities.
ChromeDriverService is used to manage the chrome server (exe). Finally, ChromeOptions are used to set the options specific to the chrome browser like adding extensions, setting the binary path etc.
Constructors for other classes also take similar arguments as mentioned above.
Capabilities used by Selenium Server
- browserName - chrome|firefox|internet explorer|htmlunit|android|iPhone|iPad|opera|safari
- version
- platform - WINDOWS|MAC|LINUX|UNIX|ANDROID
Some other important Capabilities
- acceptSslCerts
- nativeEvents
- proxy
IE specific Capabilities
- ignoreZoomSetting
- ie.ensureCleanSession
Firefox specific Capabilities
- firefox_binary
What do you think on above selenium topic. Please provide your inputs and comments. You can write to me at reply2sagar@gmail.com
Excellent stuff
ReplyDelete