Git Product home page Git Product logo

webplugin-powershell-chrome's Introduction

CyberArk-WebPlugin-Powershell-Selenium-Chrome

CyberArk custom CPM web plugins using Selenium.

Process Flow:

CPM (TPC) -> (SPAWN)PowerShell Script -> PowerShell output matching prompts file -> CPM (Success/Failure)

What to do

  1. Copy everything to CPM installation directory (use bin folder as reference, can exclude /bin/examples)
  2. Edit /bin/template.ps1, /bin/Seleniumprocess.ini and /bin/Seleniumprompts.ini
  3. Create a platform and points prompts and process files to the one we use here.
  4. Test each stages in PS(PowerShell) by running "run.cmd verifypass", "run.cmd logon", "run.cmd changepass". Remember to update cpmparm.ini accordingly.

Things to note

  1. Make sure to use the latest chrome driver that matches your chrome's version, copy it under lib folder.
  2. (Optional) Rename the prompt and process files.
  3. Inside process file, change the script path under Start Powershell script section.
  4. Make sure that the parameters pass to the PS script isn't missing or empty, otherwise the order of the parameters will be wrong.
  5. PS template include 3 sections (verifypass, changepass, logon). Can add more as needed.
  6. Double check all init variables in PS script are all in place.
  7. Make sure the dependencies path is correct in PS script
  8. Password generation should avoid special characters!!!

Commonly used functions

More functions can be found in webdriver.xml (in lib folder)

Input selection
$ChromeDriver.FindElementById('')
$ChromeDriver.FindElementByXPath('')
$ChromeDriver.FindElementByName('')
$ChromeDriver.FindElementByClassName('')
Other options
$ChromeDriver.FindElementByCssSelector('')
$ChromeDriver.FindElementByLinkText('Welcome to Twitter!')
$ChromeDriver.FindElementByPartialLinkText('')
$ChromeDriver.FindElementByTagName('')
Button
$ChromeDriver.FindElementById('wp-submit').Click()
$ChromeDriver.FindElementByXPath('//*[@id="main"]/div[2]/div[1]/article/h2/a').Click()
SendKeys
$ChromeDriver.FindElementsById('user_login').SendKeys('[email protected]')
Send ENTER or TAB (Start by locating an element, use 'body' if not able to find any element)
$ChromeDriver.FindElementByTagName('body').SendKeys([OpenQA.Selenium.Keys]::TAB + [OpenQA.Selenium.Keys]::ENTER)
Verify if element exists
#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"
}
		

Drivers

Selenium

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

Chrome

https://sites.google.com/a/chromium.org/chromedriver/

webplugin-powershell-chrome's People

Contributors

junhong0902 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.