- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
Our community just got stronger! Explore new identity security resources, connect with experts, and discover more ways to learn and collaborate.
06-06-2023 01:25 AM
I see an added demand in our organisation to add web portals via PSM connectors.
however, as I do not want to make a dedicated connection component for every type of portal, I am wondering if it is possible to make conditional statements in the webform.
I see several portals using a form to input credentials and submit by clicking a button.
there are only few differentiations like:
for instance in different login forms:
"id=username" vs "id=email" vs "name=enter name"
or button is represented as
"id=loginButton" vs "id=submit"
now I have something like this in my webform:
username>{Username}
password>{Password}
loginButton>(Button)
in above example I like to do something like:
if "username" or "email" is found (as id/type/name), then enter {username}
in this way I can make one connection component that is capable of handling more than one type of portal.
The documentation is not clear in this for me.
06-06-2023 05:01 AM
With Xpath selectors you can write a selector that matches one of multiple possible elements on the page.
For example, your scenario with 2 differently named buttons, could be represented as:
//button[@id="loginButton" or @id="submit"] > (Button)(SearchBy=Xpath)Selenium will click the first element it finds. You can even reference an object which is not clickable (like a heading), which will then act as a fallback, so CPM/PSM doesn't throw an error if the first element is not found.
06-06-2023 04:39 AM
HI @Arie Hoogendoorn ,
you have to consider the two aspects in managing an account: the login and, more importantly, the Password.
It becomes really complicated to create a single component that can handle the two aspects. If you are referring exclusively to the connection you could try to implement a custom connection component with Autoit but I strongly advise against it.
CyberArk provides the Plugin Generator Utility to facilitate these activities.
Nino
06-06-2023 05:01 AM
With Xpath selectors you can write a selector that matches one of multiple possible elements on the page.
For example, your scenario with 2 differently named buttons, could be represented as:
//button[@id="loginButton" or @id="submit"] > (Button)(SearchBy=Xpath)Selenium will click the first element it finds. You can even reference an object which is not clickable (like a heading), which will then act as a fallback, so CPM/PSM doesn't throw an error if the first element is not found.
06-06-2023 08:02 AM
And also there is an improved version of the PSM/CPM web apps plugin framework in development at CyberArk, which will actually allow you to use if-else scenarios and more complex conditionals, similarly to the one described in the original question.
06-06-2023 08:08 AM
that sounds really interesting.....but at this moment in time cannot wait for that 😉
your initial answer was exactly what I needed. going to experiment with it.
06-07-2023 06:27 AM
@Bernhard Brückler
with your answer I got a bit further....already able to logon on three distict (small different elements) portals.
However, now I think I have a situation that does somehow not map with the clicking.
following is now in the webform:
//*^[@id="Log_On" or @id="loginButton" or type="submit"^]>(Button)(searchby=xpath)
I think because of the element difference this does not work. (input vs button element?)
Do you or someone else know an alternative?
working click element poral1
<input type="submit" id="Log_On" value="Aanmelden" class="custombutton login_page">
non working click element portal2
<button type="submit" class="btn btn-raised btn-primary pull-right">Aanmelden</button>
06-07-2023 07:08 AM
"type" needs to have an @ before it.
If you quickly want to test if an Xpath selector is working, you can open Chrome (on the CPM or your workstation, but not on PSM because the hardening would get in your way), open the developer tools, go into the elements tab, and press Ctrl-F to search. In the search field, you can enter the Xpath selector (for example: //*[@id="Log_On" or @id="loginButton" or @type="submit"]) and Chrome should highlight all matching elements.
06-07-2023 07:14 AM
😅 why didn't I/we see this....Thanks for this new tip.
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!

