Skip to content

Commit

Permalink
add example remote connection (#236)
Browse files Browse the repository at this point in the history
* add example remote connection
  • Loading branch information
Uunnamed authored Jul 22, 2020
1 parent d253532 commit 16b8aee
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ after a mysteries note was produced on it.
- [Screenshots](#screenshots)
* [Screening elements](#screening-elements)
- [Using headless drivers](#using-headless-drivers)
- [Connection to remote webdriver](#connection-to-remote-webdriver)
- [Devtools: tracking HTTP requests, XHR (Ajax)](#devtools-tracking-http-requests-xhr-ajax)
- [Postmortem: auto-save artifacts in case of exception](#postmortem-auto-save-artifacts-in-case-of-exception)
- [Reading browser's logs](#reading-browsers-logs)
Expand Down Expand Up @@ -611,6 +612,33 @@ respectively:
... common actions for both versions)
```

## Connection to remote webdriver

To create a connection with an existing webdriver, you must first create the driver manually.
Example:

```clojure
;; Chrome
(def driver (create-driver :chrome {:host "127.0.0.1" :port 9515})) ;; localhost and 9515 port is default setting, use own

;; Firefox
(def driver (create-driver :firefox {:host "127.0.0.1" :port 4444})) ;; localhost and 4444 port is default setting, use own
```

Then pass the `capabilities` to the browser with `chromeOptions` or `:moz:firefoxOptions` for Chrome or Firefox respectively:

```clojure
;; Chrome
(connect-driver driver
{:capabilities
{:chromeOptions {:args ["--no-sandbox" "--headless"]}}})

;; Firefox
(connect-driver driver
{:capabilities
{:moz:firefoxOptions {:args ["--headless"]}}})
```

## Devtools: tracking HTTP requests, XHR (Ajax)

With recent updates, the library brings a great feature. Now you can trace
Expand Down

0 comments on commit 16b8aee

Please sign in to comment.