Skip to content

Add seleniummanager examples with filesystem download explanations #1519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions website_and_docs/content/documentation/selenium_manager.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,68 @@ edge can only be installed in Windows with administrator permissions

Therefore, administrator permissions are required to install Edge in Windows automatically through Selenium Manager, and Edge is eventually installed in the usual program files folder (e.g., `C:\Program Files (x86)\Microsoft\Edge`).

## Example WebDriver Code

These are provided in C# but similar code would work for other languages.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really do not want to do single language examples. Things got bad when everything was java 😂

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough - it'll take me some time to cobble together other languages, but I'll probably be able to borrow some sample code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure any of the code examples are necessary. They are literally duplicating what we have in our getting started with Selenium section.


If you want to use ChromeDriver for the version currently installed on your machine, then you can run:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is just a normal code execution. Feels weird to put code that shows starting a driver here because there is nothing explicitly Selenium Manager related.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point was to drive home the point that the manager is operating in the background and make it clearer that normal driver execution is using the Selenium Manager. While this article says that, I felt it was challenging to understand as someone who has been having to manage driver metadata in a professional capacity.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it were up to me this whole page would be much shorter. We don't spend much time walking through implementation of any other feature. It's all supposed to just work in the background.

I'm not sure how to help people more if they can't read the first thing on the page: 😦

Selenium Manager is a command-line tool implemented in Rust that provides automated driver and browser management for Selenium. Selenium bindings use this tool by default, so you do not need to download it or add anything to your code or do anything else to use it.

Like, if we need to put that disclaimer in more places on the page, I'd be more in favor of that than just writing code that is the equivalent of "ignore this, just use Selenium like normal and it works"


```
using OpenQA.Selenium.Chrome;

namespace drivermanagertest
{
class Program
{
static void Main(string[] args)
{
var driverOptions = new ChromeOptions();
var driver = new ChromeDriver(driverOptions);
driver.Navigate().GoToUrl("https://example.com");
driver.Quit();
}
}
}
```

When executed on a Windows x64 machine with Chrome version 119.x installed then SeleniumManager would generate the following directory structure and files in the `~/.cache/selenium` directory:

```
se-metadata.json
chromedriver/win64/119.0.6045.105/chromedriver.exe
```

If you wanted to use an older version of Chrome, let's say 117, then you can run:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a duplicate of what is in line 51?


```
using OpenQA.Selenium.Chrome;

namespace drivermanagertest
{
class Program
{
static void Main(string[] args)
{
var driverOptions = new ChromeOptions();
var driver = new ChromeDriver(driverOptions);
driverOptions.BrowserVersion = "117";
driver.Navigate().GoToUrl("https://example.com");
driver.Quit();
}
}
}
```

When executed on a Windows x64 machine then SeleniumManager would generate the following directory structure and files in the `~/.cache/selenium` directory:

```
se-metadata.json
chromedriver/win64/117.0.5938.149/chromedriver.exe
chrome/win64/117.0.5938.149 # The Chrome for Testing browser files are present here
```

Selenium Manager in both cases uses the available Browsers, Drivers, and requested Versions to determine what is necessary and obtains the files from remote locations. Reruns would use the cached files as explained fruther on.

## Configuration
***TL;DR:*** *Selenium Manager should work silently and transparently for most users. Nevertheless, there are scenarios (e.g., to specify a custom cache path or setup globally a proxy) where custom configuration can be required.*

Expand Down