Advertisement
Guest User

Untitled

a guest
Sep 27th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. public class pojDataSource {
  2.  
  3. private static WebElement element = null;
  4. private static List<WebElement> elements = null;
  5.  
  6. public static WebElement txt_UserName(WebDriver driver){
  7. driver.findElement(By.id("txtUserName")).clear();
  8. element = driver.findElement(By.id("txtUserName"));
  9. return element;
  10. }
  11.  
  12. public static WebElement txt_Password(WebDriver driver){
  13. driver.findElement(By.id("txtPassword")).clear();
  14. element = driver.findElement(By.id("txtPassword"));
  15. return element;
  16. }
  17. }
  18.  
  19. public class clsConstant {
  20. public static final String URL = "http://localhost:1234/";
  21. public static final String Username = "username";
  22. public static final String Password = "password";
  23. }
  24.  
  25. public class ModuleTest {
  26.  
  27. public RemoteWebDriver mDriver = null;
  28. public DesiredCapabilities mCapability = new DesiredCapabilities() ;
  29. public WebElement mWebElement = null;
  30. public String mBaseURL = clsConstant.URL;
  31. public static clsExcelSampleData mAddConnectorXls;
  32.  
  33. @Test
  34. public void beforeMethod() throws Exception {
  35.  
  36. WebDriverWait wdw =null;
  37. mCapability.setCapability("platform", org.openqa.selenium.Platform.WINDOWS);
  38. mCapability = DesiredCapabilities.firefox();
  39. mCapability.setVersion("45.0.2");
  40. mDriver = new RemoteWebDriver(new URL("http://127.0.0.1:4444/wd/hub/"), mCapability);
  41. mDriver.get(mBaseURL);
  42. mDriver.manage().window().maximize();
  43. pojDataSource.txt_UserName(mDriver).sendKeys(clsConstant.Username ) ;
  44. pojDataSource.txt_Password(mDriver).sendKeys(clsConstant.Password ) ;
  45. pojDataSource.btn_LogIn(mDriver).click();
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement