PrivateFunctions/Get-Puppeteer_NavigateNewBrowserPageToLink.ps1
<#
.SYNOPSIS This function returns the Node JS Puppeteer code for navigating a new browser page to a link. #> function Get-Puppeteer_NavigateNewBrowserPageToLink { [CmdletBinding(PositionalBinding=$true)] [OutputType([String])] param ( # The link to navigate the new browser page to. [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String]$link ) # Generate the code $code = @" const page = await browser.newPage(); await page.goto('%link%'); await page.setViewport(chromeBrowserOptions.defaultViewport) "@ $code = $code -replace "%link%", $link # Return the code return $code } |