selenium-sdk ~master
Browser automation with WebDriver lifecycle, element interaction, JavaScript execution, and multi-browser support.
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
Selenium-SDK
Selenium-SDK is a D library for browser automation via the WebDriver protocol. It manages driver lifecycle, element interaction, JavaScript execution, and browser options without requiring external language bindings.
Features
- Driver Lifecycle: Start, stop, and auto-detect WebDriver executables on
PATHfor Chrome, Firefox, Edge, and Safari. - Navigation: Navigate, go back/forward, refresh, and read page title and URL.
- Element Search: Find single or multiple elements by CSS selector, XPath, tag name, or name. Search globally or within an existing element.
- Element Interaction: Click, send keys, clear, submit, read text and attributes, and check enabled or displayed state.
- JavaScript Execution: Execute arbitrary scripts with typed return values.
- Browser Options: Configure all browsers using their
Browserclasses, (ie:Chrome). - Window Management: Maximize, resize, enumerate handles, and close windows.
Usage
dub add selenium-sdk
Install a WebDriver server and ensure it is on your PATH (e.g. chromedriver, geckodriver, msedgedriver, or safaridriver).
Driver Lifecycle
Driver.start auto-detects the executable on PATH if you do not provide one.
import selenium.driver;
Driver driver = Driver.start();
scope (exit) driver.stop();
Pin to a specific browser:
import selenium.driver;
import selenium.browser.chrome : Chrome;
Driver driver = Driver.start(new Chrome());
Navigation
driver.go("https://example.com");
writeln(driver.title);
writeln(driver.url);
driver.back();
driver.forward();
driver.refresh();
Finding Elements
import selenium.driver;
import selenium.element : By;
Element button = driver.find(By.css("#submit"));
Element[] items = driver.findAll(By.xpath("//div[@class='item']"));
// Search inside an element
Element form = driver.find(By.tagName("form"));
Element input = form.find(By.css("input[name='username']"));
Interacting With Elements
input.click();
input.sendKeys("hello");
input.clear();
input.submit();
writeln(input.text);
writeln(input.attribute("placeholder"));
writeln(input.enabled);
writeln(input.displayed);
JavaScript Execution
int result = driver.execute!int("return arguments[0] + arguments[1];");
Window Management
import selenium.element : Size;
driver.maximize();
driver.windowSize = Size(1920, 1080);
string[] handles = driver.windowHandles();
driver.close();
License
Selenium-SDK is licensed under AGPL-3.0.
- ~master released a day ago
- cetio/selenium-sdk
- AGPL-3.0
- Copyright © 2026, cet
- Authors:
- Dependencies:
- conductor
- Versions:
-
Show all 2 versions1.0.0 2026-Jun-14 ~master 2026-Jun-14 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
0 downloads total
-
- Score:
- 0.1
- Short URL:
- selenium-sdk.dub.pm