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

Suggestion for the library to run in Jenkins #193

Closed
AnithaSyed opened this issue May 4, 2021 · 11 comments · Fixed by #294
Closed

Suggestion for the library to run in Jenkins #193

AnithaSyed opened this issue May 4, 2021 · 11 comments · Fixed by #294

Comments

@AnithaSyed
Copy link

Hi I have raised the issues about the error raisng by library with the Jenkins or any other DEVOPS tools
I have found that selenium is using "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" to check the version
So I suggest add this one path also to check for the browser version along with your stand user path.
This may solve the DEVOP tools problem and give the library more scope.

@SergeyPirogov
Copy link
Owner

@AnithaSyed ok, open a PR for this

@AnithaSyed
Copy link
Author

AnithaSyed commented May 5, 2021

@SergeyPirogov Thanks for the reply
Actually i am new to all this and I didn't know how to raise the PR
So I am provinding the code snip which I found useful to find chrme version and U can use this to add to the code.

from win32com.client import Dispatch

def get_version_via_com(filename):
parser = Dispatch("Scripting.FileSystemObject")
try:
version = parser.GetFileVersion(filename)
except Exception:
return None
return version

paths = [r"C:\Program Files\Google\Chrome\Application\chrome.exe",
r"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"]
version = list(filter(None, [get_version_via_com(p) for p in paths]))[0]
print(version)

@SergeyPirogov
Copy link
Owner

Will wait for a PR from someone

@krishna3008
Copy link

krishna3008 commented May 25, 2021

@SergeyPirogov I am facing the same issue and I have seen the suggestion is made for the google chrome
Please made these same changes for the all the drivers to check the system path also if possible, to check the valid browsers if user path is not accessable

@aleksandr-kotlyar
Copy link
Collaborator

@SergeyPirogov i have read stackoverflow and their solutions recommend to check disk C program files. I don't trust this solution but I went to the Java webdrivermanager library to look how they search the installations and they do the same on Java.
Take a look https://github.com/bonigarcia/webdrivermanager/blob/master/src/main/resources/commands.properties
I have saved a copy below:

commands.properties
# Commands database
# This file contains the commands to be executed in the shell in order to detect the version of evergreen browsers
# (Chrome, Firefox, Opera, Edge, Chromium) in different operating systems (Windows, Linux, Mac OS)

# Chrome
command.chrome.windows.01=cmd.exe /C wmic datafile where name="%PROGRAMFILES(X86):\=\\%\\Google\\Chrome\\Application\\chrome.exe" get Version /value
command.chrome.windows.02=cmd.exe /C wmic datafile where name="%LOCALAPPDATA:\=\\%\\Google\\Chrome\\Application\\chrome.exe" get Version /value
command.chrome.windows.03=cmd.exe /C wmic datafile where name="%PROGRAMFILES:\=\\%\\Google\\Chrome\\Application\\chrome.exe" get Version /value
command.chrome.windows.04=REG QUERY HKCU\Software\Google\Chrome\BLBeacon /v version

command.chrome.linux.01=google-chrome --version

command.chrome.mac.01=/Applications/Google Chrome.app/Contents/MacOS/Google Chrome --version


# Firefox
command.firefox.windows.01=cmd.exe /C wmic datafile where name="%PROGRAMFILES:\=\\%\\Mozilla Firefox\\firefox.exe" get Version /value
command.firefox.windows.02=cmd.exe /C wmic datafile where name="%PROGRAMFILES(X86):\=\\%\\Mozilla Firefox\\firefox.exe" get Version /value
command.firefox.windows.03=REG QUERY "HKCU\Software\Mozilla\Mozilla Firefox" /v CurrentVersion

command.firefox.linux.01=firefox -v

command.firefox.mac.01=/Applications/Firefox.app/Contents/MacOS/firefox -v


# Edge
command.edge.windows.01=cmd.exe /C wmic datafile where name="%PROGRAMFILES(X86):\=\\%\\Microsoft\\Edge\\Application\\msedge.exe" get Version /value
command.edge.windows.02=cmd.exe /C wmic datafile where name="%PROGRAMFILES:\=\\%\\Microsoft\\Edge\\Application\\msedge.exe" get Version /value
command.edge.windows.03=REG QUERY HKCU\Software\Microsoft\Edge\BLBeacon /v version

command.edge.linux.01=microsoft-edge --version

command.edge.mac.01=/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge -version


# Opera
command.opera.windows.01=cmd.exe /C wmic datafile where name="%LOCALAPPDATA:\=\\%\\Programs\\Opera\\launcher.exe" get Version /value
command.opera.windows.02=cmd.exe /C wmic datafile where name="%PROGRAMFILES:\=\\%\\Programs\\Opera\\launcher.exe" get Version /value
command.opera.windows.03=cmd.exe /C wmic datafile where name="%LOCALAPPDATA:\=\\%\\Opera\\launcher.exe" get Version /value
command.opera.windows.04=cmd.exe /C wmic datafile where name="%PROGRAMFILES:\=\\%\\Opera\\launcher.exe" get Version /value

command.opera.linux.01=opera --version

command.opera.mac.01=/Applications/Opera.app/Contents/MacOS/Opera --version


# Chromium
command.chromium.windows.01=cmd.exe /C wmic datafile where name="%LOCALAPPDATA:\=\\%\\Chromium\\Application\\chrome.exe" get Version /value
command.chromium.windows.02=cmd.exe /C wmic datafile where name="%PROGRAMFILES(X86):\=\\%\\Chromium\\Application\\chrome.exe" get Version /value
command.chromium.windows.03=cmd.exe /C wmic datafile where name="%PROGRAMFILES:\=\\%\\Chromium\\Application\\chrome.exe" get Version /value
command.chromium.windows.04=REG QUERY HKCU\Software\Chromium\BLBeacon /v version

command.chromium.linux.01=chromium-browser --version
command.chromium.linux.02=chromium --version

command.chromium.mac.01=/Applications/Chromium.app/Contents/MacOS/Chromium --version

# Safari
command.safari.mac.01=/Applications/Safari.app/Contents/MacOS/Safari --version

May be we should

  • copy it to python webdriver_manager OR
  • continue fight for the proper installations of browser on the machines OR
  • make API to providing browser path for checking version for people who don't use traditional way of browser installation.

@SergeyPirogov what do you think? I prefer the API variant - and let the users to setup it on their own code.

@krishna3008
Copy link

@SergeyPirogov , @aleksandr-kotlyar

I suggest to use these type of paths in case of you traditional method is failed to retrieve the version since Java is using this as their default.
This will be help to add as a backup to people who mostly use the DEVOPS, since they want to use in many other places which we may or not consider.
I suggest this mainly because of some people are using firewalls which may block them to install in a traditional way you are saying @aleksandr-kotlyar

@krishna3008
Copy link

Hi Is anyone looked into this issue?

@SergeyPirogov
Copy link
Owner

What is DEVOPS tools, I don’t understand

@krishna3008
Copy link

krishna3008 commented Oct 10, 2021

What is DEVOPS tools, I don’t understand

Jenkins, maaven, azure pipelines etc.,

There is a Discussion on #213

@AnithaSyed
Copy link
Author

@aleksandr-kotlyar
I updated to 3.5.2 as suggested in the above resolution and
I passed the version as '94.0.992.38'

but I am getting below error


File "C:\Users\qjq2g6\Anaconda3\lib\site-packages\debugpy\_vendored\pydevd\_pydev_bundle\pydev_umd.py", line 167, in runfile
  execfile(filename, namespace)

File "C:\Users\qjq2g6\Anaconda3\lib\site-packages\debugpy\_vendored\pydevd\_pydev_imps\_pydev_execfile.py", line 25, in execfile
  exec(compile(contents + "\n", file, 'exec'), glob, loc)

File "C:/Users/qjq2g6/OneDrive - Aptiv/Desktop/Remote_work/EdgeTest/Edge.py", line 45, in <module>
  driver = webdriver.Edge(service = Service(EdgeChromiumDriverManager('94.0').install()), options = chrome_options)

File "C:\Users\qjq2g6\Anaconda3\lib\site-packages\webdriver_manager\microsoft.py", line 50, in __init__
  super().__init__(path, log_level, print_first_line, cache_valid_range)

File "C:\Users\qjq2g6\Anaconda3\lib\site-packages\webdriver_manager\manager.py", line 13, in __init__
  log("====== WebDriver manager ======", level=log_level)

File "C:\Users\qjq2g6\Anaconda3\lib\site-packages\webdriver_manager\logger.py", line 25, in log
  _init_logger(level, name, first_line, formatter)

File "C:\Users\qjq2g6\Anaconda3\lib\site-packages\webdriver_manager\logger.py", line 19, in _init_logger
  _logger.setLevel(level)

File "C:\Users\qjq2g6\Anaconda3\lib\logging\__init__.py", line 1421, in setLevel
  self.level = _checkLevel(level)

File "C:\Users\qjq2g6\Anaconda3\lib\logging\__init__.py", line 201, in _checkLevel
  raise TypeError("Level not an integer or a valid string: %r" % level)

TypeError: Level not an integer or a valid string: None

@aleksandr-kotlyar
Copy link
Collaborator

aleksandr-kotlyar commented Feb 2, 2022

@AnithaSyed I will try take a look at it on this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants