Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection to remote webdriver #218

Closed
OStrekalovsky opened this issue Aug 9, 2019 · 9 comments · Fixed by #236
Closed

Connection to remote webdriver #218

OStrekalovsky opened this issue Aug 9, 2019 · 9 comments · Fixed by #236
Assignees

Comments

@OStrekalovsky
Copy link

I can't find information or example how to connect to remote webdriver.
It seems that this library always tries to execute webdriver binary on the local system.
But if i want to make tests in docker (for example with selenoid) it should just send requests to remote machine without calling to local executable.

Could you add an example of such use case in documentation?

@OStrekalovsky OStrekalovsky changed the title Connecttion to remote webdriver Connection to remote webdriver Aug 9, 2019
@gmp26
Copy link

gmp26 commented Aug 12, 2019

We would also find this useful. Although maybe what's needed is an interface to a selenium java webdriver https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java, and perhaps that is callable directly.

@OStrekalovsky
Copy link
Author

OStrekalovsky commented Aug 28, 2019

Usage of the org.openqa.selenium.remote RemoteWebDriver is important because it has a capability to upload file which is not located on the same machine where the browser starts (for example in the case of usage of selenoid) - LocalFileDetector.
I was able to patch the library so that it did not try to start the local webdriver process, but when trying to upload a file in the tests, which is located on the machine where the tests are running, but not accessible to the machine where the browser is running, I get an error that the driver cannot access the file. It is understandable, because it is on another machine.
Look at https://github.com/komcrad/webdriver/blob/master/src/webdriver/core.clj for usage of the RemoteWebDriver

@igrishaev
Copy link
Collaborator

@OStrekalovsky You're able to connect to a remote driver with ease. Please take a look at the connect-driver function. I'll update README with an example later.

@OStrekalovsky
Copy link
Author

OStrekalovsky commented Aug 29, 2019

@OStrekalovsky You're able to connect to a remote driver with ease. Please take a look at the connect-driver function. I'll update README with an example later.

Your example with org.openqa.selenium.remote RemoteWebDriver would be very useful, because the remote driver needs to be properly initializated (i need a capability to specify full URL to remote driver with non empty root path, for example, and initializated LocalFileDetector). IMHO, doing this bypassing boot-driver function can cause problems and inconsitency in driver configuration.

@Menthalion
Copy link

Menthalion commented Nov 6, 2019

@igrishaev To say you can connect with ease is a bit of an overstatement. Have used a lot of selenium in other libraries (jruby java, python, clj-webdriver), but I haven't found a way in half a day of trying how to use connect-driver to connect to a Selenium hub in this one. That example would help a lot.

@au-phiware
Copy link

au-phiware commented Jun 5, 2020

An example would be greatly appreciated. When I attempt to use connect-driver I get the following error:

boot.user=> (connect-driver driver {:capabilities {}})

clojure.lang.ExceptionInfo: throw+: {:response "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n 
 <meta charset=\"UTF-8\">\n  <link rel=\"stylesheet\" type=\"text/css\" href=\"/assets/display
helpservlet.css\" media=\"all\"/>\n  <link href=\"/assets/favicon.ico\" rel=\"icon\" type=\"im
age/x-icon\" />\n  <script src=\"/assets/jquery-3.1.1.min.js\" type=\"text/javascript\"></scri
pt>\n  <script src=\"/assets/displayhelpservlet.js\" type=\"text/javascript\"></script>\n  <sc
ript type=\"text/javascript\">\n    var json = Object.freeze('{\"consoleLink\": \"\\u002fwd\\u
002fhub\",\"type\": \"Grid Node\",\"class\": \"org.openqa.grid.web.servlet.DisplayHelpHandler$
DisplayHelpServletConfig\",\"version\": \"3.141.59\"}');\n  </script>\n</head>\n<body>\n\n<div
 id=\"content\">\n  <div id=\"help-heading\">\n    <h1><span id=\"logo\"></span></h1>\n    <h2
>Selenium <span class=\"se-type\"></span>&nbsp;v.<span class=\"se-version\"></span></h2>\n  </
div>\n\n  <div id=\"content-body\">\n    <p>\n      Whoops! The URL specified routes to this h
elp page.\n    </p>\n    <p>\n      For more information about Selenium <span class=\"se-type\
"></span> please see the\n      <a class=\"se-docs\">docs</a> and/or visit the <a class=\"se-w
iki\">wiki</a>.\n      <span id=\"console-item\">\n        Or perhaps you are looking for the 
Selenium <span class=\"se-type\"></span> <a class=\"se-console\">console</a>.\n      </span>\n
    </p>\n    <p>\n      Happy Testing!\n    </p>\n  </div>\n\n  <div>\n    <footer id=\"help-
footer\">\n      Selenium is made possible through the efforts of our open source community, c
ontributions from\n      these <a href=\"https://github.com/SeleniumHQ/selenium/blob/master/AU
THORS\">people</a>, and our\n      <a href=\"http://www.seleniumhq.org/sponsors/\">sponsors</a
>.\n   </footer>\n  </div>\n </div>\n\n</body>\n</html>", :path "session", :payload {:desiredC
apabilities {}}, :method :post, :type :etaoin/http-error, :port 5555, :host "172.18.0.5", :sta
tus 404, :driver {:type :chrome, :host "172.18.0.5", :port 5555, :url "http://172.18.0.5:5555"
, :locator "xpath", :capabilities {}}}

I also tried connecting to the selenium hub, but to no avail:

boot.user=> (connect-driver driver)

clojure.lang.ExceptionInfo: throw+: {:response "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n 
 <meta charset=\"UTF-8\">\n  <link rel=\"stylesheet\" type=\"text/css\" href=\"/assets/display
helpservlet.css\" media=\"all\"/>\n  <link href=\"/assets/favicon.ico\" rel=\"icon\" type=\"im
age/x-icon\" />\n  <script src=\"/assets/jquery-3.1.1.min.js\" type=\"text/javascript\"></scri
pt>\n  <script src=\"/assets/displayhelpservlet.js\" type=\"text/javascript\"></script>\n  <sc
ript type=\"text/javascript\">\n    var json = Object.freeze('{\"consoleLink\": \"\\u002fgrid\
\u002fconsole\",\"type\": \"Grid Hub\",\"class\": \"org.openqa.grid.web.servlet.DisplayHelpHan
dler$DisplayHelpServletConfig\",\"version\": \"3.141.59\"}');\n  </script>\n</head>\n<body>\n\
n<div id=\"content\">\n  <div id=\"help-heading\">\n    <h1><span id=\"logo\"></span></h1>\n  
  <h2>Selenium <span class=\"se-type\"></span>&nbsp;v.<span class=\"se-version\"></span></h2>\
n  </div>\n\n  <div id=\"content-body\">\n    <p>\n      Whoops! The URL specified routes to t
his help page.\n    </p>\n    <p>\n      For more information about Selenium <span class=\"se-
type\"></span> please see the\n      <a class=\"se-docs\">docs</a> and/or visit the <a class=\
"se-wiki\">wiki</a>.\n      <span id=\"console-item\">\n        Or perhaps you are looking for
 the Selenium <span class=\"se-type\"></span> <a class=\"se-console\">console</a>.\n      </sp
an>\n    </p>\n    <p>\n      Happy Testing!\n    </p>\n  </div>\n\n  <div>\n    <footer id=\"
help-footer\">\n      Selenium is made possible through the efforts of our open source communi
ty, contributions from\n      these <a href=\"https://github.com/SeleniumHQ/selenium/blob/mast
er/AUTHORS\">people</a>, and our\n      <a href=\"http://www.seleniumhq.org/sponsors/\">sponso
rs</a>.\n   </footer>\n  </div>\n </div>\n\n</body>\n</html>", :path "session", :payload {:des
iredCapabilities {}}, :method :post, :type :etaoin/http-error, :port 4444, :host "172.18.0.6",
 :status 404, :driver {:type :chrome, :host "172.18.0.6", :port 4444, :url "http://172.18.0.6:
4444/wd/hub", :locator "xpath", :capabilities nil}}

@Uunnamed
Copy link
Contributor

Uunnamed commented Jul 20, 2020

@OStrekalovsky

Example:

(connect-driver driver {:capabilities {:chromeOptions {:args ["--no-sandbox"]}}})

@igrishaev
Copy link
Collaborator

Thanks Alex, it would be nice to add this into Readme.

@igrishaev
Copy link
Collaborator

@OStrekalovsky now there is an example in readme file, you're welcome to check it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants