Sunday, July 14, 2019

Automate Inbound Shipment Confirmation in IBM Sterling using Selenium Java

Steps involved in Inbound Shipment Confirmation:

1. Open Internet Explorer Browser (IBM Sterling works fine in this Browser)
2. Open Login Screen
3. Input Username and Password to Login
4. Click Login form
5. Open Inbound Shipment Console (Out of the Box screen)
6. Input Seller, Buyer
7. Click "Create Shipment" button to Create the Shipment
8. Scroll down bit to Input Item Details to create Item into the Shipment
9. Input ItemID, ProductClass and Quantity
10. Save the Shipment
11. Confirm the Shipment

package javaselenium;
import java.awt.AWTException;
import java.awt.Robot;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.Select;

public class InboundShipmentConfirmation {

public static void main(String[] args) throws AWTException {
   
Robot robot = new Robot();

    // Creating a driver object referencing WebDriver interface
        WebDriver driver;
        
        // Setting the webdriver.ie.driver property to its executable's location
        System.setProperty("webdriver.ie.driver", "C:\\Driver\\IEDriverServer.exe");

        // Instantiating driver object
        driver = new InternetExplorerDriver();
        
        // Using get() method to open a webpage
        driver.get("http://localhost:7001/smcfs/console/login.jsp");
        
        // Maximizes the browser window
    driver.manage().window().maximize() ;
        
        // Set value to Username
        driver.findElement(By.name("UserId")).sendKeys("testuser");

        // Set value to Password
        driver.findElement(By.name("Password")).sendKeys("testuser");
        driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS);
        
        // Submit the Form
        driver.findElement(By.name("btnLogin")).submit(); 
        
        // Delay for 3 seconds
        robot.delay(3000);
        
        // Open Inbound Shipment Console
        driver.get("http://localhost:7001/smcfs/console/poshipment.detail?CurrentDetailViewID=YOMD7332");
        
        // Set Seller
        driver.findElement(By.name("xml:/Shipment/@SellerOrganizationCode")).sendKeys("KEDT");

        // Set Buyer
        driver.findElement(By.name("xml:/Shipment/@BuyerOrganizationCode")).sendKeys("EMEJE");

        // Create Shipment
        driver.findElement(By.xpath("//*[@type='button' and @class='button']")).click();     
        
        // Delay for 2 seconds
        robot.delay(2000);

        // Scroll the window 
        JavascriptExecutor js = (JavascriptExecutor) driver;  
      js.executeScript("window.scrollTo(0, 200)");

        // Add Item Details
      driver.findElement(By.name("xml:/Shipment/ShipmentLines/ShipmentLine_1/@ItemID")).sendKeys("XXJEF00003");
      Select selectProdClass = new Select(driver.findElement(By.name("xml:/Shipment/ShipmentLines/ShipmentLine_1/@ProductClass")));
      selectProdClass.selectByVisibleText("Y001");
      Select selectUOM = new Select(driver.findElement(By.name("xml:/Shipment/ShipmentLines/ShipmentLine_1/@UnitOfMeasure")));
      selectUOM.selectByVisibleText("EACH");
        driver.findElement(By.name("xml:/Shipment/ShipmentLines/ShipmentLine_1/@Quantity")).sendKeys("10");

        // Save Shipment
        driver.findElement(By.xpath("//*[@type='button' and @class='button']")).click();
        
        // Delay for 2 seconds
        robot.delay(2000);

        // Confirm Shipment
        driver.findElement(By.id("scbutton2")).click(); 
               
    }


}

No comments:

Post a Comment

Popular Posts