Functions/Get-Puppeteer_EnterTextIntoSelector.ps1
<#
.SYNOPSIS This function returns the Node JS Puppeteer code for typing text into a selector on a browser page. #> function Get-Puppeteer_EnterTextIntoSelector { [CmdletBinding(PositionalBinding=$true)] [OutputType([String])] param ( # The name of the selector. [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String]$selectorName, # The text to enter. [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String]$text ) # Generate the code $code = @" selector = '%selectorName%'; await page.waitForSelector(selector); await page.type(selector, '%text%'); "@ $code = $code -replace "%selectorName%", $selectorName $code = $code -replace "%text%", $text # Return the code return $code } |