import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class PseudoElements { public static void main(String[] args) { // Instantiate a ChromeDriver class. WebDriver driver = new ChromeDriver(); // Launch Website driver.navigate().to("https://monica-official.github.io/Pseudo-Elements/sample-pseudo-element.html"); // Maximize the browser driver.manage().window().maximize(); // Scroll down the webpage by 5000 pixels // JavascriptExecutor js = (JavascriptExecutor) driver; // js.executeScript("scrollBy(0, 5000)"); String text = driver.findElement(By.cssSelector(".submitButton::before")).getText(); System.out.print(text); driver.quit(); } }