Advertisement
ArCiGo

Sample

Oct 12th, 2019
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.04 KB | None | 0 0
  1. package com.qalabs.javabasics.spotify.components.signup;
  2.  
  3. import org.openqa.selenium.support.ui.ExpectedConditions;
  4. import utils.Log;
  5.  
  6. import java.util.ArrayList;
  7. import java.util.List;
  8.  
  9. public class sample {
  10.  
  11.     public List<String> getSpotifySignUpFormErrors() {
  12.         List<String> errors = null;
  13.  
  14.         try {
  15.             wait.until(ExpectedConditions.visibilityOf(getEmailErrorMessageElement()));
  16.             if(getEmailErrorMessageElement().getText().length() > 0) {
  17.                 errors = new ArrayList<String>() {{
  18.                     add(getEmailErrorMessageElement().getText());
  19.                 }};
  20.             }
  21.         } catch(Exception ex) {
  22.             Log.error(ex.toString());
  23.         }
  24.  
  25.         try {
  26.             wait.until(ExpectedConditions.visibilityOf(getConfirmEmailErrorMessageElement()));
  27.             if(getConfirmEmailErrorMessageElement().getText().length() > 0) {
  28.                 errors = new ArrayList<String>() {{
  29.                     add(getConfirmEmailErrorMessageElement().getText());
  30.                 }};
  31.             }
  32.         } catch (Exception ex) {
  33.             Log.error(ex.toString());
  34.         }
  35.  
  36.         try {
  37.             wait.until(ExpectedConditions.visibilityOf(getPasswordErrorMessageElement()));
  38.             if(getPasswordErrorMessageElement().getText().length() > 0) {
  39.                 errors = new ArrayList<String>() {{
  40.                     add(getPasswordErrorMessageElement().getText());
  41.                 }};
  42.             }
  43.         } catch (Exception ex) {
  44.             Log.error(ex.toString());
  45.         }
  46.  
  47.         try {
  48.             wait.until(ExpectedConditions.visibilityOf(getNameErrorMessageElement()));
  49.             if(getNameErrorMessageElement().getText().length() > 0) {
  50.                 errors = new ArrayList<String>() {{
  51.                     add(getNameErrorMessageElement().getText());
  52.                 }};
  53.             }
  54.         } catch(Exception ex) {
  55.             Log.error(ex.toString());
  56.         }
  57.  
  58.         try {
  59.             wait.until(ExpectedConditions.visibilityOf(getDayErrorMessageElement()));
  60.             if(getDayErrorMessageElement().getText().length() > 0) {
  61.                 errors = new ArrayList<String>() {{
  62.                     add(getDayErrorMessageElement().getText());
  63.                 }};
  64.             }
  65.         } catch (Exception ex) {
  66.             Log.error(ex.toString());
  67.         }
  68.  
  69.         try {
  70.             wait.until(ExpectedConditions.visibilityOf(getMonthErrorMessageElement()));
  71.             if(getMonthErrorMessageElement().getText().length() > 0) {
  72.                 errors = new ArrayList<String>() {{
  73.                     add(getMonthErrorMessageElement().getText());
  74.                 }};
  75.             }
  76.         } catch (Exception ex) {
  77.             Log.error(ex.toString());
  78.         }
  79.  
  80.         try {
  81.             wait.until(ExpectedConditions.visibilityOf(getYearErrorMessageElement()));
  82.             if(getYearErrorMessageElement().getText().length() > 0) {
  83.                 errors = new ArrayList<String>() {{
  84.                     add(getYearErrorMessageElement().getText());
  85.                 }};
  86.             }
  87.         } catch(Exception ex) {
  88.             Log.error(ex.toString());
  89.         }
  90.  
  91.         try {
  92.             wait.until(ExpectedConditions.visibilityOf(getGenderErrorMessageElement()));
  93.             if(getGenderErrorMessageElement().getText().length() > 0) {
  94.                 errors = new ArrayList<String>() {{
  95.                     add(getGenderErrorMessageElement().getText());
  96.                 }};
  97.             }
  98.         } catch (Exception ex) {
  99.             Log.error(ex.toString());
  100.         }
  101.  
  102.         try {
  103.             wait.until(ExpectedConditions.visibilityOf(getCaptchaErrorMessageElement()));
  104.             if(getCaptchaErrorMessageElement().getText().length() > 0) {
  105.                 errors = new ArrayList<String>() {{
  106.                     add(getCaptchaErrorMessageElement().getText());
  107.                 }};
  108.             }
  109.         } catch (Exception ex) {
  110.             Log.error(ex.toString());
  111.         }
  112.  
  113.         return errors;
  114.     }
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement