Download Jar. Uses 7584K of libraries. Click here for Pure Java version (13550L/85K).
!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); }
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024390 |
Snippet name: | Headless Chrome Test using Selenium [crashes VNC session on server - trying Playwright instead] |
Eternal ID of this version: | #1024390/14 |
Text MD5: | 62d16fc8fdfae4d962fef74b572f74de |
Transpilation MD5: | 1d73ef5dc4270c22ed1f1f2d55c4576b |
Author: | stefan |
Category: | javax / networking |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-08-24 20:43:04 |
Source code size: | 1003 bytes / 28 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 332 / 981 |
Version history: | 13 change(s) |
Referenced in: | [show references] |