forked from naveenanimation20/SeleniumJavaCourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParameterTest.java
More file actions
40 lines (29 loc) · 1.16 KB
/
ParameterTest.java
File metadata and controls
40 lines (29 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.parameters;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
public class ParameterTest {
WebDriver driver;
@Test
@Parameters({ "env", "browser", "url", "emailId" })
public void yahooLoginTest(String env, String browser, String url, String emailId) {
if (browser.equals("chrome")) {
System.setProperty("webdriver.chrome.driver", "/Users/naveenkhunteta/Downloads/chromedriver");
driver = new ChromeDriver();
}else if(browser.equals("firefox")){
System.setProperty("webdriver.gecko.driver", "/Users/naveenkhunteta/Downloads/geckodriver");
driver = new FirefoxDriver();
}
driver.get(url);
driver.findElement(By.xpath("//*[@id='login-username']")).clear();
driver.findElement(By.xpath("//*[@id='login-username']")).sendKeys(emailId); // enter
// username
driver.findElement(By.xpath("//*[@id='login-signin']")).click(); // click
// on
// next
// button
}
}