Please check and let me know what have to change.
package SpinConnect;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import java.util.concurrent.TimeUnit;
import static org.testng.Assert.fail;
import java.util.concurrent.TimeUnit;
import org.testng.annotations.;
import static org.testng.Assert.;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
public class Test
{
private WebDriver driver;
private String baseUrl;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
private JavascriptExecutor js;
@BeforeClass(alwaysRun = true)
public static void main(String[] args)
{
WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver();
driver.get("http://182.76.43.166:9000/");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
JavascriptExecutor js = (JavascriptExecutor) driver;
}
@org.testng.annotations.Test
public void testSpinConnect() throws Exception {
driver.findElement(By.id("uname")).sendKeys("lmwrnd");
driver.findElement(By.id("pswd")).sendKeys("may@2020");
driver.findElement(By.xpath("//button[@type='submit']")).click();
driver.findElement(By.cssSelector("path")).click();
driver.findElement(By.linkText("Production")).click();
driver.findElement(By.cssSelector("path")).click();
driver.findElement(By.linkText("Reports Generate ReportsWaste Management ReportWrite LoggerExecutive ReportFavourite ListsPlant Report")).click();
driver.findElement(By.linkText("Waste Management Report")).click();
driver.findElement(By.cssSelector("path")).click();
driver.findElement(By.linkText("Analysis YBS Spindle Live StatusYBS Spindle HistoryYBS Cop AnalysisYBS Doff AnalysisPower AnalysisHealth Monitoring AnalysisAir Consumption Analysis")).click();
driver.findElement(By.linkText("YBS Doff Analysis")).click();
driver.findElement(By.xpath("(.//*[normalize-space(text()) and normalize-space(.)='Define Escalations'])[1]/preceding::*[name()='svg'][2]")).click();
driver.findElement(By.linkText("Maintenance DashboardTicket ListsAdd TicketPlace OrderERPOrdersLog Time")).click();
driver.findElement(By.linkText("Add Ticket")).click();
driver.findElement(By.xpath("(.//*[normalize-space(text()) and normalize-space(.)='Define Escalations'])[1]/preceding::*[name()='svg'][2]")).click();
driver.findElement(By.linkText("Bale Management Bale Template managementBale ReceiptsBale Test ReportsBale Stock ReportBale Distribution")).click();
driver.findElement(By.linkText("Bale Receipts")).click();
driver.findElement(By.xpath("(.//*[normalize-space(text()) and normalize-space(.)='Define Escalations'])[1]/preceding::*[name()='svg'][2]")).click();
driver.findElement(By.xpath("//p[@id='alert-dialog-slide-description']/ul/div/a/span[2]")).click();
}
@AfterClass(alwaysRun = true)
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
}
private boolean isAlertPresent() {
try {
driver.switchTo().alert();
return true;
} catch (NoAlertPresentException e) {
return false;
}
}
private String closeAlertAndGetItsText() {
try {
Alert alert = driver.switchTo().alert();
String alertText = alert.getText();
if (acceptNextAlert) {
alert.accept();
} else {
alert.dismiss();
}
return alertText;
} finally {
acceptNextAlert = true;
}
}
}
Exported script from katalon:
package com.example.Trial;
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.testng.annotations.;
import static org.testng.Assert.;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
import java.io.File;
import org.apache.commons.io.FileUtils;
public class SpinConnect {
private WebDriver driver;
private String baseUrl;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
private JavascriptExecutor js;
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
System.setProperty(“webdriver.chrome.driver”, “”);
driver = new ChromeDriver();
baseUrl = “https://www.google.com/”;
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
js = (JavascriptExecutor) driver;
}
@Test
public void testSpinConnect() throws Exception {
driver.get(“http://182.76.43.166:9000/”);
driver.findElement(By.id(“uname”)).click();
driver.findElement(By.id(“uname”)).clear();
driver.findElement(By.id(“uname”)).sendKeys(“lmwrnd”);
driver.findElement(By.id(“pswd”)).clear();
driver.findElement(By.id(“pswd”)).sendKeys(“may@2020”);
driver.findElement(By.xpath(“//button[@type=‘submit’]”)).click();
driver.findElement(By.cssSelector(“path”)).click();
driver.findElement(By.linkText(“Production”)).click();
driver.findElement(By.cssSelector(“path”)).click();
driver.findElement(By.linkText(“Reports Generate ReportsWaste Management ReportWrite LoggerExecutive ReportFavourite ListsPlant Report”)).click();
driver.findElement(By.linkText(“Waste Management Report”)).click();
driver.findElement(By.cssSelector(“path”)).click();
driver.findElement(By.linkText(“Analysis YBS Spindle Live StatusYBS Spindle HistoryYBS Cop AnalysisYBS Doff AnalysisPower AnalysisHealth Monitoring AnalysisAir Consumption Analysis”)).click();
driver.findElement(By.linkText(“YBS Doff Analysis”)).click();
driver.findElement(By.xpath(“(.//[normalize-space(text()) and normalize-space(.)=‘Define Escalations’])[1]/preceding::[name()=‘svg’][2]”)).click();
driver.findElement(By.linkText(“Maintenance DashboardTicket ListsAdd TicketPlace OrderERPOrdersLog Time”)).click();
driver.findElement(By.linkText(“Add Ticket”)).click();
driver.findElement(By.xpath(“(.//[normalize-space(text()) and normalize-space(.)=‘Define Escalations’])[1]/preceding::[name()=‘svg’][2]”)).click();
driver.findElement(By.linkText(“Bale Management Bale Template managementBale ReceiptsBale Test ReportsBale Stock ReportBale Distribution”)).click();
driver.findElement(By.linkText(“Bale Receipts”)).click();
driver.findElement(By.xpath(“(.//[normalize-space(text()) and normalize-space(.)=‘Define Escalations’])[1]/preceding::[name()=‘svg’][2]”)).click();
driver.findElement(By.xpath(“//p[@id=‘alert-dialog-slide-description’]/ul/div/a/span[2]”)).click();
}
@AfterClass(alwaysRun = true)
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!“”.equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
}
private boolean isAlertPresent() {
try {
driver.switchTo().alert();
return true;
} catch (NoAlertPresentException e) {
return false;
}
}
private String closeAlertAndGetItsText() {
try {
Alert alert = driver.switchTo().alert();
String alertText = alert.getText();
if (acceptNextAlert) {
alert.accept();
} else {
alert.dismiss();
}
return alertText;
} finally {
acceptNextAlert = true;
}
}
}
Please reply me as soon as possible.