Discussion
Pegasystems Inc.
IN
Last activity: 16 Mar 2018 6:26 EDT
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.
- Follow the Product Support Community's Community Rules of Engagement
- 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!
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
CIBC
CA
What's the general approach to building Selenium test suites - that you recommend for Pega?
Pegasystems Inc.
IN
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.
Price Watechouse Coopers Advisory
DE
We are using Pega Pipeline Manager on PRPC 7.3
How do we integrate the Selenium testing in our Pega CI/CD pipeline ?
Thanks!
Pegasystems Inc.
IN
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!
CIBC
CA
Any suggestions on tooling/approaches around creating page object models for Pega UIs?
Pegasystems Inc.
IN
Hi,
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.
Hi,
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.
Citizens Financial Group
US
How do i start with selenium automation? is there any documentation around it?
-
Maureen Tjin Karan Kalimuthu Carlo Bohle
Pegasystems Inc.
IN
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.
http://www.absofttrainings.com/selenium-training-v5-starting-with-selenium-webdriver/#v1
http://www.absofttrainings.com/selenium-training-v5-starting-with-selenium-webdriver/#v2
Charles Schwab
US
I have to do selenium automation on for a CD pipeline. IS there an approach document. We are using 7.31 .
Pegasystems Inc.
IN
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.
Price Watechouse Coopers Advisory
DE
Thanks a lot, Swetha!
Price Watechouse Coopers Advisory
DE
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?
Pegasystems Inc.
IN
Hi,
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.
GE Healthcare
PL
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
JPMC
IN
Hi swetha can you please brief page object model and its advantages.
Pegasystems Inc.
IN
Hi,
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.
-
Avijit Chattopadhyay
GE Healthcare
PL
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?
Pegasystems Inc.
IN
Hi,
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
String currentDir = System.getProperty("user.dir"); // Gets the current working directory location
currentDir = currentDir.concat("\\Data\\");
currentDir = (currentDir.concat(filename)).concat(".csv"); // Set the current directory location till filename.extension
WebElement uploadFile = Webdriver.findElement(INPUT_FILE_LINK); // Find the search box to enter the path to upload the file
uploadFile.sendKeys(currentDir); // Pass the current directory path till the file name.
Mican Technologies Inc
US
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.
Pegasystems Inc.
IN
Hi,
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
Corporation Service Company
US
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?
$x('//input[@type="file"]')
(2) [input#$PpyAttachmentPage$ppxAttachName, input#$PD_pxRenderPosts_pa1666267926730868pz$ppyFileName.file-upload]
Pegasystems Inc.
IN
Hi,
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();
GE Healthcare
PL
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:
"(//yourXpath)[1]"
Please remember that there is no "0" element, so first one found would have [1], second one would have [2]... etc.
Pegasystems Inc.
IN
Hi,
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.
Infosys
IN
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.
Pegasystems Inc.
IN
Hi,
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.
Incessant Technologies
AU
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"))
Pegasystems Inc.
IN
Hi,
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.
-
CHIH MIN HON
Updated: 15 Mar 2018 8:09 EDT
Nokia Technologies
US
Swetha,
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
Pegasystems Inc.
IN
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.
-
CHIH MIN HON
ACCENTURE INDIA PRIVATE LIMITED
IN
How to expose the data-test-id element in end user portal. Currently it is displayed only in Live UI.
Pegasystems Inc.
IN
To get the Test ID’s in HTML, add the role PegaRULES:TestID to your access group.
-
CHIH MIN HON
Incessant Technologies
AU
Hi
I am attaching the xml code, could you please have a look.
Thanks
Amiya
Pegasystems Inc.
IN
Hi,
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.
driver.findElement(By.id("LocalityPostcode")).sendKeys("");
Pegasystems Inc.
IN
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!!! :)
Regards,