Skip to content

Instantly share code, notes, and snippets.

@kellyrob99
Created July 11, 2014 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kellyrob99/51dccff57de5427c71fe to your computer and use it in GitHub Desktop.
Save kellyrob99/51dccff57de5427c71fe to your computer and use it in GitHub Desktop.
@Grab('org.seleniumhq.selenium:selenium-firefox-driver:2.42.2')
@Grab(group='org.gebish', module='geb-core', version='0.9.3')
import com.sonatype.insight.brain.testing.functional.*
import geb.Browser
import geb.navigator.Navigator
//given the following page:
/*
<html>
<head>
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
</head>
<body>
<h1>
It works!
</h1>
<div style='display:none;'>content</div>
</body></html>
*/
Browser browser = new Browser(baseUrl: 'http://localhost/')
Browser.drive(browser) {
go 'index2.html'
def div = $('div')
assert !div.displayed
assert !div.text()
browser.js.exec('$("div").css("display","block")')
assert div.displayed
assert div.text() == 'content'
}.quit()
browser = null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment