I wan to be able to select the contents of the following script tag.
<script type="text/javascript" class="sample">
/* <![CDATA[ */
var test = {};
test.hey = 1;
/* ]]> */
</script>
Running $(".sample").text() in geb results in an empty string. Is there a way to access the plain text script contents?
Not familiar with the framework you mentioned but it is possible that
$(".sample").text()returns an empty string because the code within the<script>tag is not a visible piece of HTML. As mentioned in this SO post try using either$(".sample").html().This of course is assuming that the gebish framework API supports a
.html()method on the object. You could find something equivalent in the API docs if this solution does not work.