Reputation: 31
I have a solution for a particular problem using Selenium Webdriver in Java environment, so the code in java and I want to put it in Katalon at script mode that runs groovy language and the code provided below contains selenium commands like findElements with. size() to count the elements in a panel which I did not find an equivalent for it in Katalon and also the code containing a casting from integer to string.
String changingselec = "";
int lastChildIndex = driver.findElements(By.cssSelector("body > app > div > manage-corr-app > div > div.flex-5.work-area-large > manage-user-recipient-groups > div > div.panel")).size();
changingselec = driver.findElement(By.cssSelector("body > app > div > manage-corr-app > div > div.flex-5.work-area-large > manage-user-recipient-groups > div > div.panel:nth-child(" + Integer.toString(lastChildIndex) + ")")).getText();
System.out.println(changingselec);
Upvotes: 1
Views: 358
Reputation: 8444
Before using the Selenium commands you will need to switch driver, use this (for Chrome):
WebDriver driver = new ChromeDriver()
DriverFactory.changeWebDriver(driver)
// Continue with Selenium code...
Upvotes: 1