Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Given I open the browser and access this URL
- When I enter the "<Username>" and "<Password>"
- Then I am able to login
- WebDriver driver = null;
- String url;
- @Given("^I open the browser and access this URL$")
- public void navigateToUrl() throws Throwable{
- System.setProperty("webdriver.chrome.driver", "");
- driver = new ChromeDriver();
- url = DataTable.getDataTableValue(0, 2, 2);
- driver.get(url);
- driver.manage().window().maximize();
- }
- @When("^I enter the "([^"]*)" and "([^"]*)"$")
- public void enterCredentials(String userName, String password ) throws Throwable {
- userName = DataTable.getDataTableValue(0, 1, 1);
- password = DataTable.getDataTableValue(0, 1, 2);
- driver.findElement(By.id("username")).sendKeys(userName);
- driver.findElement(By.id("password")).sendKeys(password);
- }
- @Then("^I am able to login$")
- public void clickLoginButton() throws Throwable {
- driver.findElement(By.id("Login")).click();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement