Wednesday, July 27, 2016

Project Aardvark: Script 2, Creating and previewing a comment

// "Project Aardvark" Part 2
// This code will attempt to post an anonymous comment & preview it
// Mike Talks 18/05/2016

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class addComment {

    public static void main(String[] args) {

        // Create a new instance of the Firefox driver
        // This copies all the information about the page we've loaded into
        // the driver object

        WebDriver driver = new FirefoxDriver();
        // Open our target page ... a previous blog article
        // Print out the page title
        System.out.println("Page title is: " + driver.getTitle());

        // We need to add a small pause for loading
        driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS);
        //Switch to the frame that comments are kept in
        //Select to comment as "anonymous"
        Select select = new Select( driver.findElement("identityMenu")) );

        //Select the comment body field
        String stringComment= "This is my comment";
        WebElement element = driver.findElement("commentBodyField"));
        //Select to preview
        element = driver.findElement("postCommentPreview"));
        //Confirm page contains "Anonymous said" / Comment
        if ( driver.getPageSource().contains("Anonymous") &&
                driver.getPageSource().contains("said") )
            System.out.println("Confirmed: Anonymous said");
        if ( driver.getPageSource().contains(stringComment))
            System.out.println("Confirmed: " + stringComment);


  1. Gclub Endless monetization channel.
    G club For online gambling, today's online gambling is so easy and it's something that anyone can do. It does not matter if you are a gambler, or if you are good at playing online gambling games. You can enjoy playing online games. For playing online gambling games with websites.

    People will know that making money online is not easy, just have the Internet and love to bet on it, you can make money on the site of our online casino already. The online casino is also a provider of online gambling games. It also offers many promotions and campaigns for gamblers and VIP members to add fun and excitement to playing online gambling game Casino online. As well So your choice is to play online gambling games, so we want the option to use the service from the website.

    Playing an endless online gambling game will end up making your earnings never ending. Do not forget to join us because it will make you rich in a single night if you think to challenge or measure your own. You can also access our online casino site because the wealth is near. Gclub มือถือ