Step used to achieve:
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. Identify the hyperlink using link text and click it
package javaselenium;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
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 {
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();
driver.findElement(By.linkText("Search-by-XRXXFL2207")).click();
}
}
No comments:
Post a Comment