Skip to content
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

Include version number in extracted path #78

Closed
wants to merge 1 commit into from

Conversation

Artur-
Copy link

@Artur- Artur- commented Jan 27, 2018

Fixes #26

@Artur-
Copy link
Author

Artur- commented Apr 13, 2018

Friendly ping.

This PR would help to make sure you are always using the version you think you are using.

Copy link
Contributor

@mpkorstanje mpkorstanje left a comment

Choose a reason for hiding this comment

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

This is pretty neat! Code looks good to me.

@mpkorstanje
Copy link
Contributor

@Ardesco I think this is worth adding.

@Ardesco
Copy link
Owner

Ardesco commented Apr 13, 2018

The code used to do this ages ago. It was removed because you ended up with loads of different driver versions downloaded to your file path that never got cleared out.

They weren't cleared out because when the RepositoryMap.xml is updated people rarely keep the old driver version in there so you don't have any history. You can't just delete the directory/parent directory you are downloading to because it's not guaranteed to only be used by this plugin because it can be configured to point anywhere.

It also adds more complexity to the code to try and be a good citizen and clear out old driver versions you are aware about but no longer want to have.

There are more problems:

  • There is nothing to guarantee that the characters used as a version are sensible characters that work as a file path (:poop: is a perfectly valid version name).
  • There is no guarantee that people actually update the version number when they change the driver binary download location and hash.

The more sensible solution will be something along the lines of writing a version.txt showing what you think the version is based on the version in the RepositoryMap.xml

@Artur-
Copy link
Author

Artur- commented Apr 14, 2018

Alright. I don't see why it is a problem though that old versions would be kept around unless you go and delete them manually. My ~/.m2 folder is full of old versions of libs I do not actively use. If it becomes a problem, I go and delete them and they are redownloaded if still needed by some build. Maybe I am using the plugin in a different way than you but I don't see why it should even try to remove old versions.

@Ardesco
Copy link
Owner

Ardesco commented Apr 14, 2018

Assuming we don't care about cleanup you still have the rest of the problems noted above. Remember there is no guarantee that the version number used actually relates to the version of the binary you are downloading.

We could save the binaries to a folder that matches the hash of the file, that would guarantee that the binary in the folder is the expected one, but a file hash isn't very meaningful.

I find that giving people wrong information is worse than not providing information at all, this PR will provide people with information that can quite easily be wrong.

You will know what version of a driver binary is used when you run your tests anyway, thanks to output like this:

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.lazerycode.selenium.tests.GoogleExampleIT
 
Local Operating System: MAC OS X
Local Architecture: x86_64
Selected Browser: firefox
Connecting to Selenium Grid: false
 
1523714359544	geckodriver	INFO	geckodriver 0.20.0
1523714359550	geckodriver	INFO	Listening on 127.0.0.1:34501
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.lazerycode.selenium.tests.GoogleExampleIT
 
Local Operating System: MAC OS X
Local Architecture: x86_64
Selected Browser: chrome
Connecting to Selenium Grid: false
 
Starting ChromeDriver 2.37.544337 (8c0344a12e552148c185f7d5117db1f28d6c9e85) on port 1136
Only local connections are allowed.
Apr 14, 2018 3:00:16 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS

I agree that your solution would work in a happy path scenario. However I think it would cause more confusion in the long run and I would expect to see bugs raised along the lines of:

Chromedriver version 2.35 was downloaded but it's using Chromedriver version 2.42 in my tests!!!

If you can convince me otherwise and provide code to mitigate the listed problems I'll happily look at it again, we are in danger of adding complex code into the codebase that provides very little utility though.

@enver-haase
Copy link

Whatever goes in the extracted path, I would like to be able to propagate this to Java/Selenium when it is executing. Currently I am setting
<webdriver.chrome.driver>/path/to/binary</webdriver.chrome.driver> manually in in the failsafe-plugin configuration.

And already this is hard to make OS independent, as the Java code needs to know about the path choices of this plugin here. Better to propagate it somehow, e.g. use
${os.name} and such properties instead of "linux" / "osx" .

@Ardesco
Copy link
Owner

Ardesco commented Jul 31, 2019

Discussion for the extracted path is in comments for #89

@Artur- Artur- closed this Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Track currently used version of driver
4 participants