I'm using Selenium to test my PEGA application and am running into a specific issue with finding the button element in the harness. I have a simple data entry form page and I am able to use Selenium to populate those fields. I have no issues finding the xpath for those elements, but I am 'unable to locate the element' for my 'Next' button. The 'Next' button is part of the page harness and when use 'Live UI' I am unable to select the 'Next' button directly. Additionally, when I 'inspect element' and copy the xpath for that button, Selenium will not recognize that xpath. I have attached a screenshot of the problem and the corresponding code when I click 'inspect element'. Does anyone know why this isn't working for that specific button and what a potential work-around can be?
Even if you cannot identify the element using Live UI, you can find and element with selnium and perform the actions . I think which you are using a screen flow(Next >>) button here. If that is the case use the button(Next >>) to identify element uniquely. Example is below. I am getting div here which is child of Next >> button'r and you should be able to click on it.
Please let me know if this helps or let me know what xpath you are using in selenium to identfy button
have you added any logic related to make sure the element is present before doing click on it? also i notice that this button has this class name "Strong pzhc" is this unique ? if it is have you try to look for the element by class name instead
could you also please share the error that the console output
In general for some of the default buttons in harness, you will find only the div tags and no other button tags embedded within them. I had a similar situation and I wanted to make the button gets clicked by getting the class name. However I was unable to do so.
But if we can change the format of the button, then we will get a <div> tag with class name as the format we mentioned apart from the previous common class names like strong-pzhc etc. With this class name, I made use of document.getElementByClassName and took the first the resultant from the array as the nedded button.
If you are using Selenium with IEDriverServer, make sure that the Xpath for HTML element is unique. If the system could locate multi-elements with the given XPath, IEDriverServer will return "No element found error" while Chrome driver will return the first element.
The issue lies with the different <iframe> IDs PEGA generates for each section of the page layout. So, if you are interacting with different sections of the application then you might be in a different <iframe> ID and therefore Selenium will need instruction to 'switch to' that particular iframe...
In order to find the next button along with other elements on the page, I needed to switch to the iframe by particular ID... code below as example: