The following test script will log into our WordPress blog and delete an existing post:
@Testpublic void testDeleteAPost() { 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"); // Click on the post to be deleted WebElement post = driver.findElement(By.linkText("My First Post")); post.click(); // Delete Post WebElement publish = driver.findElement(By.linkText("Move to Trash")); publish.click();}
The following ...