Download Jar. Uses 7584K of libraries. Click here for Pure Java version (13550L/85K).
1 | !7 |
2 | |
3 | lib 1400217 // selenium |
4 | |
5 | import org.openqa.selenium.WebDriver; |
6 | import org.openqa.selenium.By; |
7 | import org.openqa.selenium.TakesScreenshot; |
8 | import org.openqa.selenium.OutputType; |
9 | import org.openqa.selenium.chrome.*; |
10 | |
11 | p-exp { |
12 | // Init chromedriver |
13 | File chromeDriverPath = userDir("dev/chromedriver/chromedriver"); |
14 | assertFileExists(chromeDriverPath); |
15 | System.setProperty("webdriver.chrome.driver", f2s(chromeDriverPath)); |
16 | new ChromeOptions options; |
17 | options.addArguments("--headless", "--disable-gpu", "--ignore-certificate-errors"); |
18 | if (isRoot()) options.addArguments("--no-sandbox"); |
19 | WebDriver driver = new ChromeDriver(options); |
20 | |
21 | driver.get("https://agi.blue"); |
22 | driver.findElement(By.xpath("//input[@name='q']")).sendKeys("hello"); |
23 | driver.findElement(By.xpath("//input[@value='Ask']")).click(); |
24 | |
25 | print("New URL: " + driver.getCurrentUrl()); |
26 | File screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); |
27 | showImage(screenshot); |
28 | } |
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: | 335 / 987 |
Version history: | 13 change(s) |
Referenced in: | [show references] |