From 16b8aee5541c5629835c2399adf855a6fcb0606a Mon Sep 17 00:00:00 2001 From: "Alex.Shi" Date: Wed, 22 Jul 2020 09:41:07 +0300 Subject: [PATCH] add example remote connection (#236) * add example remote connection --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index e13dec72..9a70e5fa 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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