Guest User

Untitled

a guest
May 21st, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. #players names :: positions
  2. Happ = CF
  3. Bryant = 3B
  4. Rizzo = 1B
  5. Contreras = C
  6. Schwarber = LF
  7. Russell = SS
  8. Heyward = RF
  9. Baez = 2B
  10. Chatwood = P
  11.  
  12. public class DriverManager {
  13. public static WiniumDriver driver;
  14.  
  15. private String setupfile_path="C:\Users\Naveen\Desktop\winium\setup.exe";
  16. private String winium_path="http://localhost:9999";
  17. public Properties prop;
  18.  
  19.  
  20. public DriverManager() throws MalformedURLException, InterruptedException
  21. {
  22. File file = new File("config.properties");
  23.  
  24. FileInputStream fileInput = null;
  25.  
  26. try {
  27.  
  28. fileInput = new FileInputStream(file);
  29.  
  30. } catch (FileNotFoundException e) {
  31.  
  32. e.printStackTrace();
  33. }
  34.  
  35. //load properties file
  36. prop = new Properties();
  37.  
  38. try {
  39. prop.load(fileInput);
  40.  
  41. } catch (IOException e) {
  42.  
  43. e.printStackTrace();
  44. }
  45. DesktopOptions option =new DesktopOptions();
  46. option.setApplicationPath(setupfile_path);
  47. driver=new WiniumDriver(new URL(winium_path), option);
  48.  
  49.  
  50. }
  51.  
  52. public void awayTeamHitters() {
  53.  
  54. try {
  55. Thread.sleep(4000);
  56. WebElement table = driver.findElement(By.xpath(".//*[@AutomationId='lsvAwayTeamHitters1']"));
  57. List<WebElement> row= table.findElements(By.xpath("./*[contains(@LocalizedControlType, 'item')]"));
  58. int row_size = row.size();
  59. int col_size = 0;
  60. for(int i=0;i<row.size();i++)
  61. {
  62.  
  63. List<WebElement> col = row.get(i).findElements(By.xpath("./*[contains(@LocalizedControlType, 'text')]"));
  64. col_size = col.size();
  65. for(int j=3;j<=col.size();j++)
  66. {
  67. Thread.sleep(40000);
  68. String celtext = col.get(j).getAttribute("Name");
  69. System.out.println(celtext);
  70. Thread.sleep(4000);
  71.  
  72. }
  73. Thread.sleep(20000);
  74. }
  75. }
  76. catch (Exception e) {
  77. System.out.println(e);
  78. }
  79.  
  80. }
Add Comment
Please, Sign In to add comment