How to verify if data selected on one page is displayed on another page

Hi,

How to verify if name of some manager that is selected on one page is displayed on another page? That name also can be changed.

Thanks

1 Like

Retrieve the name on the first page. then assert the same name on second page

3 Likes

Hi @aleksandra.sulejmano,

Welcome to our community. Glad to hear from you.

In your case, you can use WebUI.getText() in the first page then verify/assert on the second using verifyMatch(). Hope this can help

1 Like

If you are trying to get the Manager’s name from a <select> tag, then you can do it several ways (you can google that). Here might be one way you can:

import org.openqa.selenium.By as By;
import org.openqa.selenium.Keys as Keys;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.WebDriver as WebDriver;
import org.openqa.selenium.WebElement as WebElement;
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory;

WebDriver driver = DriverFactory.getWebDriver()

Select mgrAssigned = new Select(driver.findElement(By.xpath("//select[@name='AssignedTo']")));
"get the managers name"
def mgrName = mgrAssigned.getFirstSelectedOption().getText();

//move to next page blah blah
WebUI.waitForPageLoad(10)

WebUI.verifyMatch(mgrName, WebUI.getAttribute(findTestObject('...'),"value"), false)
// or if you want to select the manager's name on this page 
WebUI.selectOptionByLabel(findTestObject('myPage/select...'), mgrName, false)
// or if you want to verify the manager's name was selected in another drop-down list
WebUI.verifyOptionSelectedByLabel(findTestObject('myPage/select...'), mgrName, false, 10)
And with a Test Object:
import org.openqa.selenium.support.ui.Select as Select;

Select mgrAssigned = new Select(WebUI.findWebElement(findTestObject('myPage/select...'));
"get the managers name"
def mgrName = mgrAssigned.getFirstSelectedOption().getText();

//move to next page blah blah
WebUI.waitForPageLoad(10)

WebUI.verifyMatch(mgrName, WebUI.getAttribute(findTestObject('...'),"value"), false)
// or if you want to select the manager's name on this page 
WebUI.selectOptionByLabel(findTestObject('myPage/select...'), mgrName, false)
// or if you want to verify the manager's name was selected in another drop-down list
WebUI.verifyOptionSelectedByLabel(findTestObject('myPage/select...'), mgrName, false, 10)
3 Likes

@aleksandra.sulejmano can you confirm

Thanks for the detailed explanation!

Hi @aleksandra.sulejmano,

Please try and let us know if any works. Mark solution if yes. Thank you