CyberArk custom CPM web plugins using Selenium.
CPM (TPC) -> (SPAWN)PowerShell Script -> PowerShell output matching prompts file -> CPM (Success/Failure)
- Copy everything to CPM installation directory (use bin folder as reference, can exclude /bin/examples)
- Edit /bin/template.ps1, /bin/Seleniumprocess.ini and /bin/Seleniumprompts.ini
- Create a platform and points prompts and process files to the one we use here.
- Test each stages in PS(PowerShell) by running "run.cmd verifypass", "run.cmd logon", "run.cmd changepass". Remember to update cpmparm.ini accordingly.
- Make sure to use the latest chrome driver that matches your chrome's version, copy it under lib folder.
- (Optional) Rename the prompt and process files.
- Inside process file, change the script path under Start Powershell script section.
- Make sure that the parameters pass to the PS script isn't missing or empty, otherwise the order of the parameters will be wrong.
- PS template include 3 sections (verifypass, changepass, logon). Can add more as needed.
- Double check all init variables in PS script are all in place.
- Make sure the dependencies path is correct in PS script
- Password generation should avoid special characters!!!
More functions can be found in webdriver.xml (in lib folder)
$ChromeDriver.FindElementById('')
$ChromeDriver.FindElementByXPath('')
$ChromeDriver.FindElementByName('')
$ChromeDriver.FindElementByClassName('')
$ChromeDriver.FindElementByCssSelector('')
$ChromeDriver.FindElementByLinkText('Welcome to Twitter!')
$ChromeDriver.FindElementByPartialLinkText('')
$ChromeDriver.FindElementByTagName('')
$ChromeDriver.FindElementById('wp-submit').Click()
$ChromeDriver.FindElementByXPath('//*[@id="main"]/div[2]/div[1]/article/h2/a').Click()
$ChromeDriver.FindElementsById('user_login').SendKeys('yourlogin@domain.com')
$ChromeDriver.FindElementByTagName('body').SendKeys([OpenQA.Selenium.Keys]::TAB + [OpenQA.Selenium.Keys]::ENTER)
#If element not found will invoke exception, so need to do it by catch
try
{
if ($ChromeDriver.FindElementByName('session[password]1').length -ne 0)
{
write-host "Password changed successfully"
}
}
catch
{
write-host "Not detecting any success prompt, checking failure pop-up"
}
Download and extract it with 7zip. Copy the .dll and .xml files with the correct .net version under lib folder.
https://www.nuget.org/packages/Selenium.WebDriver
https://sites.google.com/a/chromium.org/chromedriver/