0

Below is the code for the same , Below code running fine in selenium webdriver open source framework . I want to utilise same code in Katalon studio

@Test (priority=6,description="Update Profile name") public void UpdateProfileChrome() throws Exception{

     WebElement root1 = driver.findElement(pageObjects.ndBrandBar);
     //Get root of nd-brand-bar        
     WebElement shadowRoot1 = expandRootElement(root1); 
     //Get Alerts 
     WebElement root2 = shadowRoot1.findElement(pageObjects.profileButton);
     root2.click();

     //Get User first Name input box
     WebElement profileDrawer =  shadowRoot1.findElement(pageObjects.userProfileDrawer);
     //Get root of profileDrawer
     WebElement profileDrawerRoot = expandRootElement(profileDrawer); 
     WebElement  firstNameWrapper = profileDrawerRoot.findElement(pageObjects.firstnameTextBox);
     //Get root of firstNameWrapper
     WebElement firstNameRoot = expandRootElement(firstNameWrapper); 
     WebElement inputText = firstNameRoot.findElement(pageObjects.inputTextFirstName);
     //Get root of inputText 
     WebElement inputTextBox = expandRootElement(inputText);
     WebElement EnterText = inputText.findElement(pageObjects.enterNameText);
     EnterText.clear();
     Random rand = new Random(); 
     int value = rand.nextInt(50); 
     EnterText.sendKeys("TestA"+value);
     WebElement saveButton = profileDrawerRoot.findElement(pageObjects.saveButton);
     saveButton.click();
     WebElement successMessage  = shadowRoot1.findElement(pageObjects.successMessage);
     WebDriverWait wait = new WebDriverWait(driver,pageObjects.angularSync);
     List<WebElement> success = null ;
     success = wait.until(ExpectedConditions.visibilityOfAllElements(successMessage)); 
     Assert.assertFalse(success.equals(null));
     driver.quit();     

}

//Java Script executer to locate element under shadow root
    public WebElement expandRootElement(WebElement element) {
    WebElement ele = (WebElement) ((JavascriptExecutor) driver).executeScript("return arguments[0].shadowRoot",element);
    return ele;
}
Abbas Ali Husain
  • 195
  • 2
  • 13

1 Answers1

0

You can't convert it directly/automatically. Katalon Studio has different built-in methods and UI objects are stored on different way. You should refactor your code.

plaidshirt
  • 5,189
  • 19
  • 91
  • 181