Created
September 28, 2016 15:46
-
-
Save chrisparnin/e3ee1a96c681f12ae11246cfe3225182 to your computer and use it in GitHub Desktop.
Revisions
-
chrisparnin revised this gist
Sep 28, 2016 . 1 changed file with 38 additions and 38 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,39 +1,39 @@ @Test public void postMessage() { driver.get("https://csc510-fall16.slack.com/"); // Wait until page loads and we can see a sign in button. WebDriverWait wait = new WebDriverWait(driver, 30); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("signin_btn"))); // Find email and password fields. WebElement email = driver.findElement(By.id("email")); WebElement pw = driver.findElement(By.id("password")); // Type in our test user login info. email.sendKeys("[email protected]"); pw.sendKeys("****"); // Click WebElement signin = driver.findElement(By.id("signin_btn")); signin.click(); // Wait until we go to general channel. wait.until(ExpectedConditions.titleContains("general")); // Switch to #bots channel and wait for it to load. driver.get("https://csc510-fall16.slack.com/messages/bots"); wait.until(ExpectedConditions.titleContains("bots")); // Type something WebElement messageBot = driver.findElement(By.id("message-input")); messageBot.sendKeys("hello world, from Selenium"); messageBot.sendKeys(Keys.RETURN); wait.withTimeout(3, TimeUnit.SECONDS).ignoring(StaleElementReferenceException.class); WebElement msg = driver.findElement( By.xpath("//span[@class='message_body' and text() = 'hello world, from Selenium']")); assertNotNull(msg); } -
chrisparnin created this gist
Sep 28, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ @Test public void postMessage() { driver.get("https://csc510-fall16.slack.com/"); // Wait until page loads and we can see a sign in button. WebDriverWait wait = new WebDriverWait(driver, 30); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("signin_btn"))); // Find email and password fields. WebElement email = driver.findElement(By.id("email")); WebElement pw = driver.findElement(By.id("password")); // Type in our test user login info. email.sendKeys("[email protected]"); pw.sendKeys("****"); // Click WebElement signin = driver.findElement(By.id("signin_btn")); signin.click(); // Wait until we go to general channel. wait.until(ExpectedConditions.titleContains("general")); // Switch to #bots channel and wait for it to load. driver.get("https://csc510-fall16.slack.com/messages/bots"); wait.until(ExpectedConditions.titleContains("bots")); // Type something WebElement messageBot = driver.findElement(By.id("message-input")); messageBot.sendKeys("hello world, from Selenium"); messageBot.sendKeys(Keys.RETURN); wait.withTimeout(3, TimeUnit.SECONDS).ignoring(StaleElementReferenceException.class); WebElement msg = driver.findElement( By.xpath("//span[@class='message_body' and text() = 'hello world, from Selenium']")); assertNotNull(msg); }