DZone
AI Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > AI Zone > How to Build a Simple Twitter Bot Without Code

How to Build a Simple Twitter Bot Without Code

You don't need to understand the intricacies of software development or APIs to build a bot. In this post, learn how to build a tweeting bot without writing any code!

Matthew Casperson user avatar by
Matthew Casperson
·
Oct. 03, 17 · AI Zone · Tutorial
Like (1)
Save
Tweet
2.63K Views

Join the DZone community and get the full member experience.

Join For Free

Have you ever thought that it would be cool to automate web apps like Twitter, but you are not a developer and don't have any use for things like APIs? What if I told you that it is possible to automate the sending of a tweet in just 20 lines?

This is an example of an Iridium test. Iridium is a tool used to test and automate web applications, and here, it has been used to log into Twitter and send a tweet:

Feature: Post a Twitter message
  Scenario: Configure aliases and input speed
    When I set the alias mappings
      | Username | .js-username-field |
      | Password | .js-password-field |
      | Log in | button.submit |
      | Tweet box | tweet-box-home-timeline |
      | Tweet | .js-tweet-btn |
    And I set the default keystroke delay to "0" milliseconds

  Scenario: Log In
    Given I open the page "https://twitter.com/login"
    And I populate the "Username" textbox with "your_username"
    And I populate the "Password" textbox with "your_password"
    And I click the "Log in" button

  Scenario: Send Tweet
    Then I populate the "Tweet box" textbox with "This is a tweet"
    And I click the "Tweet" button

Although this is a very simple example of what Iridium can do, it does highlight how easy it is to automate web apps like Twitter without writing any code. Iridium uses a plain English syntax to describe the interaction with a web app and abstracts away the code that is usually required to interact with a browser in an automated fashion.

And running tests is as easy as writing them. All you need to install Java 8, download this WebStart file (right-click the link and save the file), and run it. Iridium will be downloaded and the test script will be run.

Actually, the script will fail because the test script that is being launched does not have a valid Twitter username and password in it. This line of the WebStart file determines the test to be run:

<property name="javaws.testSource" value="https://raw.githubusercontent.com/mcasperson/IridiumTwitterTest/master/twitter.feature"/>

To see the test run against your own Twitter account, you will need to download the file from here, edit it to include your own Twitter credentials, and then update the location of the test in the WebStart file to point to your local copy. For example, you might save the feature file to your desktop and reference it like this:

<property name="javaws.testSource" value="/Users/matthewcasperson/Desktop/twitter.feature"/>

If you are interested in writing end-to-end tests like the one shown above, check out the Iridium documentation, and take a look at the course on Udemy. Iridium itself is a free and open source project on GitHub.

twitter Twitter bot Testing Build (game engine)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • What Is Lean Software Development
  • Suspicious Sortings in Unity, ASP.NET Core, and More
  • What Are Cookies in Servlets?
  • Why to Implement GitOps into Your Kubernetes CI/CD Pipelines

Comments

AI Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo