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

Profiles for Firefox #2933

Closed
af23me opened this issue Oct 16, 2016 · 25 comments
Closed

Profiles for Firefox #2933

af23me opened this issue Oct 16, 2016 · 25 comments
Assignees
Labels

Comments

@af23me
Copy link

af23me commented Oct 16, 2016

Meta -

OS: OSX el capitan
Ruby: 2.3.1
Selenium Version: 3.0.0
Browser: Firefox 49.0.1

Code

profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.dir'] = '/Users/af/Downloads/'
profile['browser.download.folderList'] = 2
profile['browser.download.manager.showWhenStarting'] = false
profile['browser.helperApps.neverAsk.saveToDisk'] = 'text/csv'
browser = Selenium::WebDriver.for :firefox, :profile => profile

Actually I use Watir, but error is reproduced with pure selenium without watir

Try to create profile for firefox but get an error:

/Users/af/.rvm/gems/ruby-2.3.1/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver/remote/w3c_bridge.rb:80:in 'initialize': unknown option: {:profile=>#<Selenium::WebDriver::Firefox::Profile:0x007fc76b93e1a0 @model=nil, @native_events=false, @secure_ssl=false, @untrusted_issuer=true, @load_no_focus_lib=false, @additional_prefs={"browser.download.dir"=>"/Users/af/Sites/", "browser.download.folderList"=>2, "browser.download.manager.showWhenStarting"=>false, "browser.helperApps.neverAsk.saveToDisk"=>"text/csv"}, @extensions={}>} (ArgumentError)

from /Users/af/.rvm/gems/ruby-2.3.1/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver/firefox/w3c_bridge.rb:34:in 'initialize'

from /Users/af/.rvm/gems/ruby-2.3.1/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver/common/driver.rb:49:in 'new'

from /Users/af/.rvm/gems/ruby-2.3.1/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver/common/driver.rb:49:in 'for'

from /Users/af/.rvm/gems/ruby-2.3.1/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver.rb:82:in 'for'

What can be wrong? Thank you for response.

@titusfortner titusfortner self-assigned this Oct 17, 2016
@af23me
Copy link
Author

af23me commented Oct 17, 2016

with "firefox_profile" same error
/Users/af/.rvm/gems/ruby-2.3.1/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver/remote/w3c_bridge.rb:80:in 'initialize': unknown option: {:firefox_profile=>#<Selenium::WebDriver::Firefox::Profile:0x007f8eba0f1bd0 @model=nil, @native_events=false, @secure_ssl=false, @untrusted_issuer=true, @load_no_focus_lib=false, @additional_prefs={"browser.download.dir"=>"/Users/af/Sites/", "browser.download.folderList"=>2, "browser.download.manager.showWhenStarting"=>false, "browser.helperApps.neverAsk.saveToDisk"=>"text/csv"}, @extensions={}>} (ArgumentError)

@nikita191
Copy link

also having this issue. any help?

@titusfortner
Copy link
Member

This will be addressed in the next release

On Oct 18, 2016 1:08 PM, "grafnikitus" [email protected] wrote:

also having this issue. any help?


You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
#2933 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAvb4XZdjZYvoP-42T82OjUqQCyP6L3qks5q1QsSgaJpZM4KX7TO
.

@nikita191
Copy link

Thank you! Just to clarify the issue: I'm passing as profile the proxy parameters

profile = Selenium::WebDriver::Firefox::Profile.new
proxy = Selenium::WebDriver::Proxy.new(:http => "xx.xx.xx.xx:yyyy", :ssl => "xx.xx.xx.xx:yyyy")
profile.proxy = proxy
browser = Watir::Browser.new :firefox, marionette: true, :profile => profile

getting the same error as mentioned: `initialize': unknown option

/Users/nisia/.rvm/gems/ruby-2.2.1/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver/remote/w3c_bridge.rb:80:in `initialize': unknown option: {:profile=>#<Selenium::WebDriver::Firefox::Profile:0x007fab4aa2f038 @model=nil, @native_events=false, @secure_ssl=false, @untrusted_issuer=true, @load_no_focus_lib=false, @additional_prefs={"network.proxy.type"=>1, "network.proxy.http"=>"xx.xx.xx.xx", "network.proxy.http_port"=>yyyy, "network.proxy.ssl"=>"xx.xx.xx.xx", "network.proxy.ssl_port"=>yyyy, "network.proxy.no_proxies_on"=>""}, @extensions={}>} (ArgumentError)
    from /Users/nisia/.rvm/gems/ruby-2.2.1/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver/firefox/w3c_bridge.rb:34:in `initialize'
    from /Users/nisia/.rvm/gems/ruby-2.2.1/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver/common/driver.rb:49:in `new'
    from /Users/nisia/.rvm/gems/ruby-2.2.1/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver/common/driver.rb:49:in `for'
    from /Users/nisia/.rvm/gems/ruby-2.2.1/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver.rb:82:in `for'
    from /Users/nisia/.rvm/gems/ruby-2.2.1/gems/watir-webdriver-0.9.3/lib/watir-webdriver/browser.rb:46:in `initialize'

@devopsberlin
Copy link

devopsberlin commented Oct 18, 2016

I have the same issue on ubuntu with firefox

http://stackoverflow.com/questions/40119516/using-an-existing-firefox-profile-ruby-gem-selenium-webdriver-3-0

http://stackoverflow.com/questions/40119516/using-an-existing-firefox-profile-ruby-gem-selenium-webdriver-3-0

ShockwaveNN added a commit to ONLYOFFICE-QA/onlyoffice_webdriver_wrapper that referenced this issue Nov 3, 2016
ShockwaveNN added a commit to ONLYOFFICE-QA/onlyoffice_webdriver_wrapper that referenced this issue Nov 3, 2016
ShockwaveNN added a commit to ONLYOFFICE-QA/onlyoffice_webdriver_wrapper that referenced this issue Nov 3, 2016
@2pers1
Copy link

2pers1 commented Nov 9, 2016

Hello
I have the same problem with selenium-webdriver v3.0.1. @titusfortner any idea on the release date that will contain the fix ?
Many Thanks for support.
2pers

@titusfortner
Copy link
Member

3.0.1 just made sure that Ruby was passing along the expected things to the remote server (which should address the issue for using Ruby to send to the server). I haven't yet had a chance to work with the firefox_profile settings for using directly with Ruby, but it is next on my list.

@2pers1
Copy link

2pers1 commented Nov 9, 2016

Just great ! I will stay tuned then. Thanks !

@zpetukhov
Copy link

zpetukhov commented Nov 11, 2016

It does not work for me too (selenium-webdriver gem ver. 3.0.1 and FF v51).
I using temporary workaround: downgrade to FF ver. 44.0.2 (+disabling marionette as lukeis mentioned here #1915 ).

For disabling marionette:

driver = Selenium::WebDriver.for :firefox, :profile => profile, :desired_capabilities => {:marionette => false}

I tried disabling marionette that way:

driver = Selenium::WebDriver.for :firefox, :profile => profile, :marionette => false

But it does not work that way... I think because of mistype that were fixed in this commit:
cbc150b

But monkeypatching that mistype at my local PC does not solved this issue anyway.

@Inglonias
Copy link

Is this issue why I'm getting this error message when I try to use an already existing profile via Watir?

unknown option: {:profile=>"Francis"}
["H:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/remote/w3c_bridge.rb:80:in `initialize'",
"H:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/firefox/w3c_bridge.rb:34:in `initialize'",
"H:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/common/driver.rb:52:in `new'",
"H:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver/common/driver.rb:52:in `for'",
"H:/Ruby23/lib/ruby/gems/2.3.0/gems/selenium-webdriver-3.0.1/lib/selenium/webdriver.rb:82:in `for'",
"H:/Ruby23/lib/ruby/gems/2.3.0/gems/watir-6.0.1/lib/watir/browser.rb:46:in `initialize'",
*my code, etc.*]

@titusfortner
Copy link
Member

titusfortner commented Nov 20, 2016

If you want to use an existing Firefox Profile, this works with current 3.x

profile = Selenium::WebDriver::Zipper.zip('/path/to/profile/cgc5y9y6.default')
caps = Selenium::WebDriver::Remote::Capabilities.firefox(firefox_options: {profile: profile})
driver = Selenium::WebDriver::Driver.for :firefox, desired_capabilities: caps

@sjieg
Copy link

sjieg commented Nov 21, 2016

@Inglonias yes, I'm quite confident that is the same issue described here. We're experiencing the same issue with our solution Lapis Lazuli, which extends Watir.

@titusfortner your workaround doesn't seem to work with our (Ruby) solution. The constant Remote is not recognized. Is there a certain gem that needs to be required for this?

Running it directly from IRB will result in an infinite string.

irb(main):001:0> gem 'selenium-webdriver', '3.0.1'
=> true
irb(main):002:0> require 'selenium-webdriver'
=> true
irb(main):003:0> profile = Selenium::WebDriver::Zipper.zip('/path/to/profile/cgc5y9y6.default')
=> "UEsDBBQAAAAIAOR4dUlbY8kP7BQAA....[infinite long string]"

Thanks!

@titusfortner
Copy link
Member

Sorry, it should be Selenium::WebDriver::Remote not just Remote

@zpetukhov
Copy link

@titusfortner
Is there a way to use custom FF add-on with 3.0.1 and marionette?

With previous versions I used (as described in wiki/Ruby-Bindings):

profile = Selenium::WebDriver::Firefox::Profile.new
profile.add_extension("/path/to/addon.xpi")
driver = Selenium::WebDriver.for :firefox, :profile => profile

@LamhotJM
Copy link

also same case (OS:ubuntu Browser: firefox 45.5 ESR ) using gem 'selenium-webdriver', '3.0.1'
unknown option: {:profile=>#<Selenium::WebDriver::Firefox::Profile:0x00000004eb9818 @model=nil, @native_events=false, @secure_ssl=false, @untrusted_issuer=true, @load_no_focus_lib=false, @additional_prefs={}, @extensions={}>} (ArgumentError)
./features/support/env.rb:35:in `Before'

@titusfortner
Copy link
Member

@zpetukhov - For now you need to create a new profile with the extension in it, then figure out the path to that profile, then use the code above to zip the profile and pass it in to the driver.

@LamhotJM - Things should be working fine for Firefox 45 so long as you are passing in {marionette: false} as a desired capability.

@zpetukhov
Copy link

@titusfortner it works for me, thank you.
But there are temporary folders in /tmp with names like:
rust_mozprofile.KXgVn9XMlXHP
And their amount is growing.
They are not auto-cleaned like with previous version
(sample from previous version: /tmp/webdriver-profile20161124-18874-184udfr).

@titusfortner
Copy link
Member

Yes, that makes sense.

I looked at the existing code and a lot if it does things I don't understand, so I'm going to need to reach out to some of the people next week about how to approach it. :)

@Inglonias
Copy link

Inglonias commented Nov 29, 2016

@titusfortner Unfortunately, your three line work around that zips the profile doesn't actually seem to launch for me using that profile. Firefox will launch, but it definitely isn't using the profile with the certificate that I need.

Furthermore, this generates a Selenium browser object, not Watir, causing me to lose pretty much every capability I need (the ability to create elements off of the browser object, for example)

@titusfortner
Copy link
Member

@Inglonias - I believe geckodriver is still having issues in its support of certificates. All I can say is that this process for zipping the existing profile works within the confines of what is currently supported by Mozilla. Also, the process is no different from how you would do it in Watir:

profile = Selenium::WebDriver::Zipper.zip('/path/to/profile/#{profile_id}.default')
caps = Selenium::WebDriver::Remote::Capabilities.firefox(firefox_options: {profile: profile})
browser = Watir::Browser.new :firefox, desired_capabilities: caps

@lmtierney
Copy link
Member

lmtierney commented Dec 6, 2016

@Inglonias try this for using it with Watir, it won't help with any geckodriver certificate issues but it should get Watir started up using your profile

profile = Selenium::WebDriver::Firefox::Profile.new('/path/to/profile')

or

profile = Selenium::WebDriver::Firefox::Profile.from_name('name_of_profile')

then

caps = Selenium::WebDriver::Remote::W3CCapabilities.firefox(firefox_options: { profile: profile.as_json['zip'] })
browser = Watir::Browser.new(:firefox, desired_capabilities: caps)

@zpetukhov your temporary profiles should be cleaned up if you specify your profile via profile: profile.as_json['zip'] as shown above

@titusfortner
Copy link
Member

titusfortner commented Dec 21, 2016

Fixed with #3174 and released with Selenium gem 3.0.4

@2pers1
Copy link

2pers1 commented Jan 12, 2017

Hello, just to confirm this problem is over with latest Selenium web driver gem. Many thanks @titusfortner !

@afomi
Copy link

afomi commented Jan 18, 2017

Was failing on 3.0.1. Now works for me on 3.0.5. Thanks!

@anduong
Copy link

anduong commented Feb 9, 2017

I upgraded to 3.0.8, it works. My Firefox is 50.0.1

@lock lock bot locked and limited conversation to collaborators Aug 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.