Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9116313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:38:34+00:00 2026-06-17T04:38:34+00:00

Being a beginner in GEB testing, I am trying to run a simple login

  • 0

Being a beginner in GEB testing, I am trying to run a simple login program in Intellij. Could you please help me run this test in Intellij? My question is what selections should I make in the edit configurations page? Please help. This example is from the book of geb.

import geb.Browser

Browser.drive {
  go "http://google.com/ncr"

  // make sure we actually got to the page
  assert title == "Google"

  // enter wikipedia into the search field
  $("input", name: "q").value("wikipedia")

  // wait for the change to results page to happen
  // (google updates the page dynamically without a new request)
  waitFor { title.endsWith("Google Search") }

  // is the first link to wikipedia?
  def firstLink = $("li.g", 0).find("a.l")
  assert firstLink.text() == "Wikipedia"

  // click the link 
  firstLink.click()

  // wait for Google's javascript to redirect to Wikipedia
  waitFor { title == "Wikipedia" }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:38:35+00:00Added an answer on June 17, 2026 at 4:38 am

    If you are running this in IntelliJ you should be able to run this as a JUnit test (ctrl+F10). Make sure that this is inside of a Class and in a method.

    For ease of syntax, it would be good to use Spock as your BDD framework (include the library in your project; if using Maven, follow the guide on the site but update to Spock 0.7-groovy-2.0 and Geb 0.9.0-RC-1 for the latest libraries

    If you want to switch from straight JUnit to Spock (keep in mind you should use JUnit as a silent library) then your test case looks like this:

      def "show off the awesomeness of google"() {
        given:
        go "http://google.com/ncr"
    
        expect: "make sure we actually got to the page"
        title == "Google"
    
        when: "enter wikipedia into the search field"
        $("input", name: "q").value("wikipedia")
    
        then: "wait for the change to results page to happen and (google updates the page dynamically without a new request)"
        waitFor { title.endsWith("Google Search") }
        // is the first link to wikipedia?
        def firstLink = $("li.g", 0).find("a.l")
    
        and:
        firstLink.text() == "Wikipedia"
    
        when: "click the link"
        firstLink.click()
    
        then: "wait for Google's javascript to redirect to Wikipedia"
        waitFor { title == "Wikipedia" }
    }
    

    Just remember: Ctrl + F10 (best key shorcut for a test in IntelliJ!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to do the Birthday Program in python. Being a beginner in Python, I
being a beginner i m trying to develop a very simple service using express
Please forgive me for being a complete beginner: I am trying to log into
Sorry in advance for this being such a beginner question. Here are the steps
[Edit] Solved, small mistake done by me being an ant beginner. In the test
Beginner question . . . I want to run a boolean test on a
Being a beginner C/C++ programmer, I am having to spend several hours, trying to
Being a beginner of using Django, i am trying to add some module for
being a regex beginner, I need some help writing a regex. It should match
Python beginner here, so I apologize if this question has a simple answer. (I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.