native events enabled?

765 views
Skip to first unread message

Andrew

unread,
Dec 12, 2012, 3:09:50 PM12/12/12
to clj-we...@googlegroups.com
Is there a way to start a new driver with native events enabled? 

Mayank Jain

unread,
Dec 12, 2012, 3:15:13 PM12/12/12
to clj-we...@googlegroups.com
What exactly is a native event btw?


On Thu, Dec 13, 2012 at 1:39 AM, Andrew <ach...@gmail.com> wrote:
Is there a way to start a new driver with native events enabled? 



--
Regards,
Mayank.

Andrew

unread,
Dec 12, 2012, 3:21:29 PM12/12/12
to clj-we...@googlegroups.com
One of the advantages of Selenium WebDriver over Selenium RC is supposed to be that the browser is driven with native events vs injected javascript. But whenever I start a driver, I see Native Events Enabled: false. 

Mayank Jain

unread,
Dec 12, 2012, 3:32:58 PM12/12/12
to clj-we...@googlegroups.com
Does this help?

>(require '[clj-webdriver.taxi :as taxi]
               '[clj-webdriver.firefox :as ff])

> (taxi/set-driver! {:browser-name :firefox
                                                     :profile (doto (ff/new-profile)
                                                                         (ff/enable-native-events true))})
#clj_webdriver.driver.Driver{:webdriver #<Title: , URL: about:blank, Browser: firefox, Version: 17.0.1, JS Enabled: true, Native Events Enabled: true, Object: FirefoxDriver: firefox on LINUX (88e20021-e091-4f75-ad70-de55f273caee)>, :capabilities nil, :cache-spec {:cache nil}, :actions #<Actions org.openqa.selenium.interactions.Actions@12efc0ee>}


For reference:
[1] : https://github.com/semperos/clj-webdriver/blob/master/src/clj_webdriver/firefox.clj#L39
[2] : https://github.com/semperos/clj-webdriver/wiki/Firefox-Support
--
Regards,
Mayank.

Andrew

unread,
Dec 12, 2012, 3:53:22 PM12/12/12
to clj-we...@googlegroups.com
Hmm. What should I do differently?

(wd/new-driver
  {:browser :firefox
   :profile (doto (ff/profile-from-json (slurp firebug-profile))
                  (ff/enable-native-events true))})

#clj_webdriver.driver.Driver{:webdriver #<Title: , URL: about:blank, Browser: firefox, Version: 16.0.2, JS Enabled: true, Native Events Enabled: false, Object: FirefoxDriver: firefox on XP (eae80f90-08f2-4ab2-8098-68012abce5d9)>, :cache-spec {:cache nil}, :actions #<Actions org.openqa.selenium.interactions.Actions@1c63fc3>}

Mayank Jain

unread,
Dec 12, 2012, 4:00:28 PM12/12/12
to clj-we...@googlegroups.com
Where is this firebug-profile defined?

Can you check what its storing?
> (slurp firebug-profile)
What is the output of this?
--
Regards,
Mayank.

Mayank Jain

unread,
Dec 12, 2012, 4:02:34 PM12/12/12
to clj-we...@googlegroups.com
The same command worked for me:

user> (taxi/new-driver {:browser-name :firefox

                                                     :profile (doto (ff/new-profile)
                                                                    (ff/enable-native-events true))})

#clj_webdriver.driver.Driver{:webdriver #<Title: , URL: about:blank, Browser: firefox, Version: 17.0.1, JS Enabled: true, Native Events Enabled: true, Object: FirefoxDriver: firefox on LINUX (ca582106-d1fd-4069-a980-d86101ca9886)>, :capabilities nil, :cache-spec {:cache nil}, :actions #<Actions org.openqa.selenium.interactions.Actions@a1bf24b>}

Can you try ff/new-profile like I did? Does that work for you?
Maybe that JSON command has some issue.
--
Regards,
Mayank.

Andrew Cheng

unread,
Dec 12, 2012, 4:11:54 PM12/12/12
to clj-we...@googlegroups.com
(count (slurp firebug-profile))
2255390 ;; purpose: includes firebug

One difference is that I'm not using the Taxi API. Here's the result with a new-profile.

(wd/new-driver 
  {:browser :firefox
   :profile (doto (ff/new-profile)
                  (ff/enable-native-events true))})

#clj_webdriver.driver.Driver{:webdriver #<Title: , URL: about:blank, Browser: firefox, Version: 16.0.2, JS Enabled: true, Native Events Enabled: false, Object: FirefoxDriver: firefox on XP (14eaac00-15ab-4569-9303-a826f18bf4a2)>, :cache-spec {:cache nil}, :actions #<Actions org.openqa.selenium.interactions.Actions@1364f2f>}

Mayank Jain

unread,
Dec 12, 2012, 4:16:00 PM12/12/12
to clj-we...@googlegroups.com
Are you using clj-webdriver.core as wd?
You can add any extensions as shown in the urls I shared btw.
I am not sure how well core works with these calls. Maybe Daniel can add something to this.
--
Regards,
Mayank.

Daniel Gregoire

unread,
Dec 13, 2012, 10:32:50 AM12/13/12
to clj-we...@googlegroups.com
Hard to say specifically what might be wrong, given that Mayank is able to get the same code working. The `new-driver` definition in clj-webdriver.taxi is literally a reference to the one defined in clj-webdriver.core, so there should be no difference there.

I'd be interested to see what your FirefoxProfile instance returns for its areNativeEventsEnabled method.

Andrew Cheng

unread,
Dec 13, 2012, 10:40:35 AM12/13/12
to clj-we...@googlegroups.com
(def p (doto (ff/new-profile) (ff/enable-native-events true)))
==> #'foo/p

(.areNativeEventsEnabled p)
==> true

(def b (wd/new-driver {:browser :firefox :profile p}))
==> #'foo/b

b
==> #clj_webdriver.driver.Driver{:webdriver #<Title: , URL: about:blank, Browser: firefox, Version: 16.0.2, JS Enabled: true, Native Events Enabled: false, Object: FirefoxDriver: firefox on XP (8a43cf3f-9469-43bd-9a64-a78e21b283a8)>, :cache-spec {:cache nil}, :actions #<Actions org.openqa.selenium.interactions.Actions@cda74b>}

(.areNativeEventsEnabled p)
==> true

Daniel Gregoire

unread,
Dec 13, 2012, 11:26:53 AM12/13/12
to clj-we...@googlegroups.com
Alrighty. From Clojure, can you just instantiate a driver directly with (FirefoxDriver. p), using the profile as you just defined it, and verify whether or not native events are enabled that way?

Secondarily - are you having any other issues with profiles, or just this setting?
Reply all
Reply to author
Forward
0 new messages