1+ # Check 1 - Google Chrome
2+ # region
3+
4+ # Chrome path
5+ $ChromePath = " $SystemDrive \Program Files\Google\Chrome\Application\chrome.exe"
6+
7+ # if statment to test-path of Chrome
8+ if (Test-Path - Path $ChromePath ) {
9+ # Do nothing
10+ }
11+
12+ else {
13+ Write-Output " [!] Chrome is not installed on this system."
14+ Write-Output " [!] LikeParser requires Chrome to function properly."
15+ Write-Output " [!] Script execution has been canceled."
16+ $LoadControlFlag = " fail"
17+ }
18+
19+
20+ # endregion
21+
22+ # Check 2 - Selenium PowerShell Module
23+ # region
24+ # check if selenium is installed on the system
25+ $ModuleCheck = Get-Module - Name Selenium - ListAvailable
26+
27+ # if statment to check the output of the execution
28+ if ($ModuleCheck ) {
29+ # Do nothing
30+ }
31+
32+ else {
33+ # Install Selenium module
34+ Install-Module - Name Selenium - Force
35+ Write-Output " [!] The Selenium PowerShell module was not detected and has now been successfully installed."
36+ Write-Output " [!] If the script does not function as expected, please restart your computer and try again."
37+
38+ }
39+
40+ # Import the Selenium module
41+ Import-Module - Name Selenium
42+ # endregion
43+
44+ # Check 3 - ImportExcel PowerShell Module
45+ # region
46+ # check if ImportExcel is installed on the system
47+ $ModuleCheck = Get-Module - Name ImportExcel - ListAvailable
48+
49+ # if statment to check the output of the execution
50+ if ($ModuleCheck ) {
51+ # Do nothing
52+ }
53+
54+ else {
55+ # Install ImportExcel module
56+ Install-Module - Name ImportExcel - Force
57+ Write-Output " [!] The ImportExcel PowerShell module was not detected and has now been successfully installed."
58+ Write-Output " [!] If the script does not function as expected, please restart your computer and try again."
59+
60+ }
61+
62+ # Import the ImportExcel module
63+ Import-Module - Name ImportExcel
64+ # endregion
65+
66+ # Check Chrome browser versions
67+ $ChromeVersion = (Get-Item " $SystemDrive \Program Files\Google\Chrome\Application\chrome.exe" ).VersionInfo.ProductVersion
68+ $ChromeVersion = $ChromeVersion -replace ' \..*' , ' '
69+
70+ # Check Chrome driver version
71+ $ChromeDriveVersion = (Get-Item " $RunPath \ChromeDriverWin64\chromedriver.exe" ).VersionInfo.FileVersion
72+ $ChromeDriveVersion = $ChromeDriveVersion -replace ' \..*' , ' '
73+
74+ # if version are the same do:
75+ if ($ChromeVersion -eq $ChromeDriveVersion ) {
76+ # do nothing
77+ }
78+
79+ # if versions are not the same do:
80+ else {
81+ Write-Output " "
82+ Write-Output " [!] Chrome browser version is $ChromeVersion but your Chrome driver version is $ChromeDriveVersion "
83+ Write-Output " [!] Please download the matching Chrome driver for your Chrome browser"
84+ Write-Output " [!] And save it under $RunPath \ChromeDriverWin64\"
85+ Write-Output " [!] URL to download: https://getwebdriver.com/"
86+ Write-Output " "
87+ $LoadControlFlag = " fail"
88+
89+
90+ }
0 commit comments