Hey Dwiparna,
thank you so much for not answering anymore. I regard it as rude. You
cannot ask for help and then ignore answers.
Anyway, I bumped into this in another context. Now I guess I know what
you want. It is about CSS pseudo elements, right? For example:
======================================================================
<html style="font-family: sans-serif">
<head>
<style>
label::before {
content: "some text";
}
</style>
</head>
<body>
<label for="abc"> == $0
<a target="_blank" href="/abcd">something</a></label>
</body>
</html>
======================================================================
Unfortunately Selenium (WebDriver) does not support that. Tickets
requesting support have even been closed as "won't implement". so all
you are left with is using JavaScript from within Geb like this:
======================================================================
package de.scrum_master.stackoverflow
import geb.spock.GebReportingSpec
class PesudoElementIT extends GebReportingSpec {
def "Get text from CSS pseudo-element ::before"() {
given:
go "file:///C:/my/path/dateformat-timezone.htm"
def jsCode = '''
return window
.getComputedStyle(document.querySelector('label'),'::before')
.getPropertyValue('content')
'''
when:
def pseudoElementContent = js.exec(jsCode)[1..-2]
then:
pseudoElementContent == "some text"
}
}
======================================================================
BTW, if you are wondering why you need "[1..-2]", it is because the text
is returned with surrounding double quotes which need to be cut off in
order to get just the text content.
Regards
Alexander Kriegisch schrieb am 22.03.2018 08:03:
> Your sample is neither valid HTML nor valid CSS. Would you mind giving a real
> example?
>
>