!7 lib 1400217 // selenium import org.openqa.selenium.WebDriver; import org.openqa.selenium.By; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.OutputType; import org.openqa.selenium.chrome.*; p-exp { // Init chromedriver File chromeDriverPath = userDir("dev/chromedriver/chromedriver"); assertFileExists(chromeDriverPath); System.setProperty("webdriver.chrome.driver", f2s(chromeDriverPath)); new ChromeOptions options; options.addArguments("--headless", "--disable-gpu", "--ignore-certificate-errors"); if (isRoot()) options.addArguments("--no-sandbox"); WebDriver driver = new ChromeDriver(options); driver.get("https://agi.blue"); driver.findElement(By.xpath("//input[@name='q']")).sendKeys("hello"); driver.findElement(By.xpath("//input[@value='Ask']")).click(); print("New URL: " + driver.getCurrentUrl()); File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); showImage(screenshot); }