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

瀏覽次數:172 次
跳到第一則未讀訊息

Stephen Cagle

未讀,
2014年10月2日 晚上7:05:462014/10/2
收件者: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

未讀,
2014年10月2日 晚上7:39:022014/10/2
收件者: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

未讀,
2014年10月3日 凌晨1:35:112014/10/3
收件者: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

未讀,
2014年10月3日 凌晨1:44:372014/10/3
收件者: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

未讀,
2014年10月3日 凌晨2:38:502014/10/3
收件者:clj-we...@googlegroups.com
This guy is trying something for chrome options:

See if that helps you.

--

Sean Corfield

未讀,
2014年10月9日 下午3:05:062014/10/9
收件者: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

未讀,
2014年10月12日 凌晨2:22:142014/10/12
收件者: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"]}})
回覆所有人
回覆作者
轉寄
0 則新訊息