Sunday, July 14, 2019

Automate Login in IBM Sterling WMS using Selenium Java

In IBM Sterling WMS with version 9x.  Hope it will work for lower version too using below code.

After executing below code, it will automatically open Internet Explorer browser -> Open Sterling login screen (pls change URL for your code) -> Target Username field and set as anderson -> Target Password field and set as password and then click -> Submit button which will get logged in into the Sterling application.

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

package javaselenium;
import java.awt.AWTException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;


public class InventoryAdjustment {

public static void main(String[] args) throws AWTException {   
 
    //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("anderson");

        // Set value to Password
        driver.findElement(By.name("Password")).sendKeys("password");
        driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS);
        
        // Submit the Form
        driver.findElement(By.name("btnLogin")).submit(); 
               
    }

 
}

No comments:

Post a Comment

Popular Posts