adamdriscoll/selenium-powershell

installation

Petervdburg opened this issue · 4 comments

Is there a (pedantic) procedure to install version 4?

When I follow what's in the Readme, Install-Module Selenium just installs version 3, and "Import-Module "{FullPath}\selenium-powershell\Selenium.psd1"" errors out (where I suspect there's more to it than copying and running this script.

Update.
I found this:

Install-Module -Name InstallModuleFromGitHub -RequiredVersion 0.3 # Do this 1st, then
Install-ModuleFromGitHub -GitHubRepo adamdriscoll/selenium-powershell # this downloaded the zip file an unzipped into C:\Program Files\WindowsPowerShell\Modules\selenium-powershell\4.0.0

However, when I run get-installedmodule, it's missing. $env:PSModulePath looks fine.

PS C:\Users\Administrator> get-installedmodule

Version    Name                                Repository           Description                                                                                                                                                   
-------    ----                                ----------           -----------                                                                                                                                                   
0.3        InstallModuleFromGitHub             PSGallery            PowerShell module that installs modules from GitHub                                                                                                           
1.0.2.201  newtonsoft.json                     PSGallery            Serialize/Deserialize Json using Newtonsoft.json                                                                                                              
1.3.3      NuGet                               PSGallery            Create Nuget repos, Register Repos, Manage Modules and Packages with a single DSC Module.  This Module Exports 5 Resources, Nuget, PSRepo, PackageRepo, Nug...
1.0.2      PSExcel                             PSGallery            Work with Excel without installing Excel                                                                                                                                                                                                                                   

Install-Module -Name Selenium -AllowPrerelease

Used that to install '4.0.0-preview3' yesterday.

This 'works' but not conventional Import-Module "C:\Program Files\WindowsPowerShell\Modules\selenium-powershell\4.0.0\Selenium.psd1" -Force

I'm using (default) PS 5.1 on Win Server 2019 as well as Windows 10. The -AllowPrerelease requires updating of PowerShellGet to 2.2.5. After rebooting I get Install-Package : A parameter cannot be found that matches parameter name 'AllowPrereleaseVersions'.

I'd like to persevere with this, because I'm sure I'm not the only one experiencing this. I will find the solution...however, can you let us know what your environment is, please? OS, PS etc?

ok cracked it. The "pedantic" procedure to allow a straightforward Install-Module -Name Selenium -AllowPrerelease:

(Context: Windows Server & workstation by default have a simple version of PackageManagement & PowerShellGet, both at version 1.0.0.1. These wont allow the -AllowPrerelease.)

From various sources and verified, follow this sequence:

  1. Verify starting position
    get-module # PackageManagement, PowerShellGet both at version 1.0.0.1

  2. Install new versions. May have to run it twice after a PS restart to eliminate "in-use" error

Install-Module -Name PackageManagement -Repository PSGallery -Force -AllowClobber # Update NuGet as prompted
Install-Module -Name PowerShellGet -Force -Verbose -AllowClobber -RequiredVersion 2.2.5
  1. Confirm:
get-installedmodule
Import-Module PowerShellGet -RequiredVersion 2.2.5 # Now there are 2x PackageManagement, PowerShellGet versions
  1. Confirm
    Get-Module

  2. This 'should' list all Functions at version 2.2.5 but some may still be at 1.0.0.1. Need to remove 1.0.0.1.
    Get-Command -module PowershellGet

  3. Delete these folders (Recycle Bin) as they're not "installed" modules.

C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.0.0.1
C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1
C:\Program Files (x86)\WindowsPowerShell\Modules\PackageManagement\1.0.0.1
C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1
  1. Reboot machine (seems to need more that just a PS restart) and confirm the right modules and functions are loaded
get-installedmodule # Updated modules
Get-Command -module PowershellGet # Updated Functions
  1. Install PreRelease Selenium error free
    Install-Module -Name Selenium -AllowPrerelease

  2. Confirm

get-installedmodule
<#
Version              Name                                Repository           Description                                                           
-------              ----                                ----------           -----------                                                           
1.4.8.1              PackageManagement                   PSGallery            PackageManagement (a.k.a. OneGet) is a new way to discover and inst...
2.2.5                PowerShellGet                       PSGallery            PowerShell module with commands for discovering, installing, updati...
4.0.0-preview3       Selenium                            PSGallery            Web automation using the Selenium Web Driver                          
#>

`