Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> -->
  3. <suite name="Suite" parallel="classes" thread-count="2">
  4.  
  5. <test name="NavigationTest">
  6. <classes>
  7. <class name="Test1" />
  8. <class name="Test2" />
  9. </classes>
  10. </test>
  11. </suite>
  12.  
  13. public class Test1 {
  14.  
  15. loginToUserPage(strUserName, strPassword);
  16. }
  17.  
  18. public class Test2{
  19.  
  20. loginToUserPage(strUserName, strPassword);
  21. }
  22.  
  23.  
  24. public class Test3
  25. {
  26. public void loginToUserPage(String strUserName,String strPassword)
  27. {
  28. webdriverCommon.windowMaximise();
  29. webdriverCommon.sendElement(CommonRepo.userName_Edit, strUserName);
  30. webdriverCommon.sendElement(CommonRepo.password_Edit, strPassword);
  31. webdriverCommon.clickElement(CommonRepo.logginButton_buttton);
  32.  
  33. }
  34. }
  35.  
  36. public class TestBase {
  37.  
  38. protected WebDriver driver;
  39. protected String baseUrl = "http://example.com/";
  40. protected String hubUrl = "http://localhost:4444/wd/hub";
  41.  
  42. @Before
  43. public void setUp() throws Exception{
  44. try {
  45. DesiredCapabilities capability = DesiredCapabilities.chrome();
  46. driver = new RemoteWebDriver(new URL(hubUrl), capability);
  47. }
  48. catch (Exception e){
  49. System.setProperty("webdriver.chrome.driver", "C:\Selenium\chromedriver.exe");
  50. driver = new ChromeDriver();
  51. }
  52. driver.manage().deleteAllCookies();
  53. driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
  54. }
  55.  
  56. @After
  57. public void tearDown() throws Exception{
  58. driver.quit();
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement