Ask the Expert - Selenium Automation with Swetha Korukonda

Join Swetha in this month's Ask the Expert session on Selenium Automation!

Meet Swetha Korukonda: Swetha Korukonda works as a Quality Analyst at Pegasystems. Swetha has been involved in test automation since 4 years and handles responsibilites of application quality in Marketing for Communications.

Message from Swetha: I'm happy to take your questions about automating test cases in Selenium, page object model and finding the best identifier for the UI elements.

Ask the Expert Rules

  • This is not a Live Chat - Swetha will reply to your questions over the course of this two-week event
  • Questions should be clearly and succinctly expressed
  • Questions should be of interest to many others in the audience
  • Have fun!

Group Tags


Keep up to date on this post and subscribe to comments

March 6, 2018 - 11:39am

What's the general approach to building Selenium test suites - that you recommend for Pega?

March 7, 2018 - 4:23am
Response to MattT234

Test cases can be dependent to each other or may have to be executed in a certain order in a test suit. 
TestNg gives us the capability to manage the test execution.

In TestNG framework,  create an xml file to handle multiple test class where you can configure your test run, 
set test dependency, include or exclude any test, method, class or package and set priority etc.

March 7, 2018 - 5:57am
Response to SwethaKorukonda

We are using Pega Pipeline Manager on PRPC 7.3

How do we integrate the Selenium testing in our Pega CI/CD pipeline ?


March 7, 2018 - 9:10am
Response to AndrewT5

Hi Andrew!

Thanks for your question! I believe that our expert has answered your question in the comments below. Please take a look and let us know back here in case you have additional questions!

Lochana | Community Moderator | Pegasystems Inc.

March 7, 2018 - 9:09am
Response to SwethaKorukonda

Any suggestions on tooling/approaches around creating page object models for Pega UIs?

March 8, 2018 - 4:19am
Response to MattT234


Let me explain the approach of page object model with a simple example of a user logging in to web application and verifying the UI element text on the welcome page.

1) Let's consider two pages here, Login page and the Welcome Page . Start by creating two class files, It's always preferred to give the class name same as web page name, so in this case class name will be Loginpage.java and Welcomepage.java and define the web elements on the page.

Say Login page has,

1. UserName textbox
2. Password textbox
3. Sign in Button

And Welcome page has,
1. WelcomeHeader Label

2) Define the possible actions on the web elements (objects) as abstract methods in the respective class files.

1. For Textbox :  set text
2. For Button : Click, get text on button.
3.   For Label: get Text

3) Create an implementation class and define the methods will perform this actions.

4) Now, its time to create business logic which can be reusable, Create and page (class file) and page object to call the above methods.



March 6, 2018 - 4:45pm

How do i start with selenium automation?  is there any documentation around it?

March 7, 2018 - 4:22am
Response to PavanD

Selenium is primarily  used for automating web applications, but it is certainly not limited to just that.

There are many external links available to start with Selenium IDE or web driver automation.
Please find below some links may be helpful.




March 6, 2018 - 5:00pm

I have to do selenium automation on for a CD pipeline. IS there an approach document. We are using 7.31 .


March 7, 2018 - 7:13am
Response to DUTTSH3775

You can set up a continuous integration and delivery (CI/CD) pipeline that uses a Pega repository in which you can store and test
software and Jenkins server can be used to perform operations on your software. As of now, we dont have support for Selenium script automation
for CI/CD pipeline. However, you can configure an automation server with REST services to automatically run unit tests from Jenkins.

March 7, 2018 - 3:24pm
Response to SwethaKorukonda

Thanks a lot, Swetha!

March 7, 2018 - 3:27pm
Response to SwethaKorukonda

Is there a way to delegate creation of automated Pega acceptance tests to the business users?  Any framework  that would lket the business users to record their actions in Pega and then play back checking the reasults? Any experiences from Your projects perhaps?

March 8, 2018 - 7:01am
Response to AndrewT5


Could you please brief more on delegation of creating tests.
I did not had this experience in the project before, however Cucumber tool allows to write acceptance tests in easily readable and understandable format (plain English) to Business users. Feature files serve as good documents as well ,by seeing the feature file a user should be able to understand the intent behind the scenario and what the test is all about. Selenium IDE is a record and playback tool which can be used for simple web application automation purpose.

March 13, 2018 - 4:02am
Response to AndrewT5

Hello Andrew,

you can ask the business users to write the scenarios in Gherkin language (Given/When/Then)

Then you can work on test automation that will execute those scenarios

For Java language there is Cucumber as Swetha mentioned or you can try with JBehave http://jbehave.org/reference/stable/parametrised-scenarios.html


March 7, 2018 - 11:24am

Hi swetha can you please brief page object model and its advantages.

March 8, 2018 - 4:02am
Response to SrimannarayanaK


POM (Page Object Model) is a design pattern to create Object Repository for web UI elements that can be implemented using Selenium web driver.

Corresponding page class is created for each web page in the application in this model.

This Page class will find the Web Elements of that web page and also contains Page methods which perform operations on those elements.

Advantages :

1) Under this model, operations and flows in the UI are separated from verification.

2) Object repository is independent of test cases, so we can reuse the same object repository for a different methods.
In future, if there is a change in the one web element, we need to make the change in just 1 class file instead of multiple different scripts.

3) It helps in functional encapsulation, low maintenance and low redundancy.


March 8, 2018 - 5:58am

Hello Swetha!

I have a question about uploading and downloading files - we have this functionality of Pega and we are using it in our projects. Can you help me with some ideas about the approach to such scenarios? The most problematic part is that we are using Jenkins as a CI and build manager for our automation project.

For example downloading a file - even if I had it working locally I can click to download and verify my local download location that the file actualy was downloaded there, but when I run same scenario on Jenkins server, I do not know what should be the path to verify that the file was downloaded there. Have you ever tried to automate such scenarios? 

March 8, 2018 - 7:19am
Response to MateuszC


Hope you will copy the project folder in the Jenkins server.
You can create a Sample folder named Data in your existing project and download and upload the file from that location.

Please find sample code snipped below which might be helpful for you

  1. String currentDir = System.getProperty("user.dir"); // Gets the current working directory location
  2. currentDir = currentDir.concat("\\Data\\");
  3. currentDir = (currentDir.concat(filename)).concat(".csv"); // Set the current directory location till filename.extension
  4. WebElement uploadFile = Webdriver.findElement(INPUT_FILE_LINK); // Find the search box to enter the path to upload the file
  5. uploadFile.sendKeys(currentDir); // Pass the current directory path till the file name.


March 8, 2018 - 12:07pm

Hi Swetha

this is regarding dynamic layouts and grids, for example if we have a grid repeating in a frame multiple times, can we set unique key/id for the grid? currently we see name which is same for all grids.

March 9, 2018 - 7:22am
Response to RajaRManneti


If you are trying to find the unique attribute of each grid in a repeating layout, you can find the stable parent element (reference element) of the grid and find child element based on its index of occurrence.

You can find with a parametrized Xpath from parent element.

To support more on this, could you provide the html structure of the grid

March 9, 2018 - 3:45pm

Hi Swetha,

My understanding is that the Attach File(s) modal dialog box is a standard Pega component. Do you have a recommendation on how to set focus on the dialog box's input type=file element from within a script of Selenium commands? My objective is to have an automated process upload a file to that input element. In my script I have successfully accessed the dialog box's CloseModal, Cancel and Attach command buttons but the script cannot find the input type=file element.

When executed in the console, the XPath command below returns two input elements of type=file. Can you tell me which one is the element a file should be uploaded to and how to set focus on that element?


(2) [input#$PpyAttachmentPage$ppxAttachName, input#$PD_pxRenderPosts_pa1666267926730868pz$ppyFileName.file-upload]

March 12, 2018 - 12:13pm
Response to DanB2381


If there are multiple elements with found with the Xpath , then we can let the code to perform the action on correct element using

driver.findElements(INPUT_FILE_LINK).get(0) or driver.findElements(INPUT_FILE_LINK).get(1) .

As you mentioned there are two elements with type=file, please debug the code by pointing to each element once to find the correct one.

And regarding the set focus, as your objective is to upload the file, hope you might need to enter the file path in the input element.

So you can use sendKeys() function (WebElement.sendKeys()) which tries find an input tag box to enter some information, but if you want to set Focus

then you can use line like below for input elements.

new Actions(driver).moveToElement(WebElement).click().perform();


March 13, 2018 - 3:21am
Response to SwethaKorukonda

also when you have Xpath returning multiple elements you can select the one you like using parenthesis around your expression and then index like this:


Please remember that there is no "0" element, so first one found would have [1], second one would have [2]... etc.

March 13, 2018 - 5:33am
Response to MateuszC


Quick clarification here, findElements() method returns array of web elements of data type List (List<WebElement>) for which index starts with 0 not 1. And yes, we also use (Xpath)[1]  with starting index 1 however if we define a web element as such it can decrease the chances of reusability.

March 14, 2018 - 7:29am

Hi Swetha,

Would like to know your approach/design strategy in terms of building automation frameworks other than page object framework where we don't have UI ready and need to build a generic framework at the enterprise level. Do you have any suggestions?

Also could you please share us your experience in using data-test-id in identifying the locators during script executions. Many times we have extracted data-test-id  but the execution of scripts are consistent only when LiveUI is enabled.


March 15, 2018 - 3:58am
Response to KarthikB3628


There are different design approaches available like Strategy Design pattern, Page Factory with in Page object etc..
Each has its own pros and cons.

As you have mentioned to want to have a generic framework, you may need to analyse the type of test scenarios that needs to be automated.You can initially start with creating the interface files where a abstract methods and place holder elements can be defined. And based on your test scenario we can follow the implementation approach of those interfaces accordingly.

LiveUI is used to just parse the DOM structure , enabling it should not impact the identification of elements. Could you check the frame id of element is getting changed or constant for the particular element. Also, can you try putting some wait in the script before finding the element, just to check if the controls are taking time to load. 

March 14, 2018 - 11:15pm

Hi Swetha, I identifying atext box with Id , also tried using xpath both method not able to locate the element while executing the script, I have thread sleep for 9 sec before executing this line. Is there any reason in have an answer.

xpath   //*[@class='sectionDivStyle']/descendant::input[@id='LocalityPostcode']

id   //driver.findElement(By.id("LocalityPostcode"))



March 15, 2018 - 4:03am


Could you check if more than one element is visible in DOM for the xpath mentioned. 

Also it is not recommended to use Thread.sleep , instead we can use wait (implicit / explicit) methods.
Example of explicit wait:  wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(""))) 

Is it possible to share the html code of the page so i can debug more.

March 15, 2018 - 8:10am


What is recommended automation tool for application built on PEGA? Two options were provided by our vendor Selinium and HPULF. I was also told HPULF is recommended for PEGA products.


Malathi Tummalapalli

March 16, 2018 - 6:22am
Response to MalathiT

Hi ,

We can use  Telerik, selenium or any other automation tool, i am currently using selenium for the pega application,
if we have to automate the web based application, we can choose selenium as its open-source features help to script own extensions that makes it easy to develop customized actions and even manipulate at an advanced level.

March 15, 2018 - 8:10am

How to expose the data-test-id element in end user portal. Currently it is displayed only in Live UI.

March 16, 2018 - 6:13am
Response to KarthikeyanR3983

To get the Test ID’s in HTML, add the role PegaRULES:TestID to your access group.

March 15, 2018 - 6:20pm



I am attaching the xml code, could you please have a look.




March 16, 2018 - 6:10am


Xml used to carry data unlike html designed to display data.

I have saved the attached file as .html and able to find the element with id locator and used sendKeys() method for providing the text in the input tag. 


March 16, 2018 - 6:26am

Thank you for the great Ask the Expert session!!! I will be closing this discussion today but please continue asking your questions by create new posts on our community!

@SwethaKorukonda Thank you for being our expert!! You are amazing!!! :)


Lochana | Community Moderator | Pegasystems Inc.