Advertisement
Guest User

Untitled

a guest
Feb 7th, 2018
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.75 KB | None | 0 0
  1. package basics;
  2.  
  3. import org.openqa.selenium.By;
  4. import org.openqa.selenium.By.ByPartialLinkText;
  5. import org.openqa.selenium.WebDriver;
  6. import org.openqa.selenium.WebElement;
  7. import org.openqa.selenium.chrome.ChromeDriver;
  8. import org.junit.After;
  9. import org.junit.Before;
  10. import org.junit.Test;
  11. import org.junit.internal.runners.JUnit38ClassRunner;
  12.  
  13.  
  14. public class sendEmail
  15. {
  16.  
  17.  
  18.    
  19.         private WebDriver wd;
  20.         private String url;
  21.         private String userName;
  22.         private String userPassword;
  23.        
  24.         @Before
  25.         public void setUp()
  26.         {
  27.             System.setProperty("webdriver.chrome.driver", "D://pobrane//chromedriver230/chromedriver.exe");
  28.             wd = new ChromeDriver();
  29.             url = "http://gmail.com";
  30.             userName = "menda999@gmail.com";
  31.             userPassword = "komenda99";
  32.            
  33.         }
  34.        
  35.         @Test
  36.         public void loginCheck() throws InterruptedException
  37.         {
  38.             wd.get(url);
  39.            
  40.             WebElement loginName = wd.findElement(By.name("identifier")); // pole login
  41.             loginName.clear();
  42.             loginName.sendKeys(userName); // Wpisz znaki z userName
  43.             Thread.sleep(3000);
  44.             wd.findElement(By.xpath("//*[@id='identifierNext']")).click(); // Kliknij w przycisk DALEJ
  45.             Thread.sleep(3000);
  46.                    
  47.            
  48.             WebElement passwordID = wd.findElement(By.name("password")); // pole password
  49.             passwordID.clear();
  50.             passwordID.sendKeys(userPassword); // Wpisz znaki z userPassword
  51.             Thread.sleep(3000);
  52.             wd.findElement(By.xpath("//*[@id=\'passwordNext\']")).click(); // Kliknij w przycisk DALEJ
  53.             Thread.sleep(5000);
  54.            
  55.             wd.findElement(By.cssSelector("//div[contains(@class, 'T-I J-J5-Ji T-I-KE L3 T-I-JW']")).click(); // Can't display new message here! ! !
  56.             Thread.sleep(5000);
  57.        
  58.        
  59.         }
  60.        
  61.        
  62.        
  63.         @After
  64.         public void tangoDown()
  65.         {
  66.             wd.close();
  67.         }
  68.    
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement