github.com/ysbaddaden/selenium-webdriver-crystal

Selenium Webdriver client

57 stars
0 dependents
License: Apache-2.0

Nothing has been indexed for 0.3.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  selenium:
    github: ysbaddaden/selenium-webdriver-crystal
    version: ~> 0.3.0

Then run:

shards install

shard.yml

No shard.yml has been indexed for 0.3.0. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

# Selenium::Webdriver

Selenium Webdriver bindings for the Crystal programming language.

WARNING: this shard initialy implemented the now obsolete
[JsonWireProtocol](https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol),
but should be compatible with the
[W3C Webdriver](https://w3c.github.io/webdriver/webdriver-spec.html) spec.

Known working combinations are Selenium 2.48.2 and Firefox 34 (JSONWireProtocol),
as well as Selenium 3.5.3, Firefox 55 and the now required Geckodriver 0.18.0
(W3C Webdriver).


## Usage

Only the Remote driver is available, so you need to download the release
[Selenium Standalone Server](http://docs.seleniumhq.org/download/) then start
it (adjust the version):

```
$ java -jar selenium-server-standalone-2.48.2.jar
```

You may now start a session, which will launch a browser, and start interacting
with it:

```crystal
require "selenium/webdriver"

capabilities = {
  browserName: "firefox",
  platform: "ANY"
}
driver = Selenium::Webdriver.new
session = Selenium::Session.new(driver, capabilities)

session.url = "http://crystal-lang.org/api"
pp session.url # => "http://crystal-lang.org/api"

input = session.find_element(:css, "input[type=search]")
input.send_keys("Client")
sleep 1

types_list = session.find_element(:id, "types-list")
types = types_list.find_elements(:css, "li:not([class~='hide'])")
pp count = types.size # => 5

session.stop
```


## Reference

- [JSON Wire Protocol](https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol)
- [W3C Webdriver](https://w3c.github.io/webdriver/webdriver-spec.html)


## License

Distributed under the [Apache License, Version 2.0](https://opensource.org/licenses/Apache-2.0)


## Author

- Julien Portalier — @ysbaddaden