-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
base: trunk
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
|
||
If you want to use ChromeDriver for the version currently installed on your machine, then you can run: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: 😦
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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.* | ||
|
||
|
There was a problem hiding this comment.
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 😂
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.