Test case 1 – adding a new post to our WordPress blog

The following test script will log into the Admin portal of our WordPress blog and add a new blog post:

@Testpublic void testAddNewPost() {    WebElement email = driver.findElement(By.id("user_login"));    WebElement pwd = driver.findElement(By.id("user_pass"));    WebElement submit = driver.findElement(By.id("wp-submit"));    email.sendKeys("admin");    pwd.sendKeys("$$SUU3$$N#");    submit.click();    // Go to AllPosts page driver.get("http://demo-blog.seleniumacademy.com/wp/wp-admin/edit.php"); // Add New Post WebElement addNewPost = driver.findElement(By.linkText("Add New")); addNewPost.click();    // Add New Post's Content    WebElement title = driver.findElement(By.id("title"));    title.click();    title.sendKeys( ...

Get Selenium WebDriver 3 Practical Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.