How do I add a ChromeOption when I (set-driver!)

172 views
Skip to first unread message

Stephen Cagle

unread,
Oct 2, 2014, 7:05:46 PM10/2/14
to clj-we...@googlegroups.com
I am attempting to get any sort of testing on a Chrome extension, and I seem to need to Instantiate ChromeOption and pass it as an argument to the WebDriver.

I am basing this off of the follwoing SO answer.

I am wondering if anyone has any familiarity with this. Is this possible to do with clj-webdriver?

Stephen Cagle

unread,
Oct 2, 2014, 7:39:02 PM10/2/14
to clj-we...@googlegroups.com
Attempting to figure out where I would do this.

I am looking at the clj-webdriver.core (line 188). I think this is where I might insert ChromeOptions. I am actually confused as to where the .newInstance method is coming from, as I don't see that in the API spec for ChromeDriver. Is this the right track, or is there an easier way.

Mayank Jain

unread,
Oct 3, 2014, 1:35:11 AM10/3/14
to clj-we...@googlegroups.com
Not sure if its the same for chrome, 

On Fri, Oct 3, 2014 at 5:09 AM, Stephen Cagle <sam...@gmail.com> wrote:
Attempting to figure out where I would do this.

I am looking at the clj-webdriver.core (line 188). I think this is where I might insert ChromeOptions. I am actually confused as to where the .newInstance method is coming from, as I don't see that in the API spec for ChromeDriver. Is this the right track, or is there an easier way.

--
You received this message because you are subscribed to the Google Groups "clj-webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clj-webdrive...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stephen Cagle

unread,
Oct 3, 2014, 1:44:37 AM10/3/14
to clj-we...@googlegroups.com
Unfortunatley,

(defn new-webdriver*
"Return a Selenium-WebDriver WebDriver instance, optionally configured to leverage a custom FirefoxProfile."
([browser-spec]
(let [{:keys [browser profile] :or {browser :firefox
profile nil}} browser-spec]
(if-not profile
(.newInstance (webdriver-drivers (keyword browser)))
(FirefoxDriver. profile)))))
It appears that profile is a firefox only thing, so I don't think that is going to work... :( 

Mayank Jain

unread,
Oct 3, 2014, 2:38:50 AM10/3/14
to clj-we...@googlegroups.com
This guy is trying something for chrome options:

See if that helps you.

--

Sean Corfield

unread,
Oct 9, 2014, 3:05:06 PM10/9/14
to clj-we...@googlegroups.com
You can do this by calling init-driver yourself on the result of new-webdriver*, as hinted at in this comment:


HTH,
Sean
signature.asc

Alistair Roche

unread,
Oct 12, 2014, 2:22:14 AM10/12/14
to clj-we...@googlegroups.com
I ran into this problem too.

If you use my fork (include [org.clojars.atroche/clj-webdriver "0.6.2"] in your dependencies) you can just do:

  (set-driver!  {:browser :chrome
                 :chrome-profile {:extensions ["/Users/aroche/Code/clj/native-messaging"]}})
Reply all
Reply to author
Forward
0 new messages