Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Override headers using selenium webdriver + firefox profile #1054

Closed
lukeis opened this issue Mar 2, 2016 · 9 comments
Closed

Override headers using selenium webdriver + firefox profile #1054

lukeis opened this issue Mar 2, 2016 · 9 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 2, 2016

Originally reported on Google Code with ID 1054


I am not sure if this is the place to post this question.
I want to override firefox headers using selenium webdriver and profile.

this is pretty my my test code:

require "rubygems"
require "selenium-webdriver"
include Selenium

profile = WebDriver::Firefox::Profile.new

profile['general.useragent.override'] = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0
like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341
Safari/528.1"
profile['general.description.override'] = "Mozilla" # appCodeName
profile['general.appname.override'] = "Netscape"
profile['general.appversion.override'] = "5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac
OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16"
profile['general.platform.override'] = "iPhone"
profile['general.vendor.override'] = "Vendor" #
profile['general.vendorsub.override'] = "Subvendor" #

driver = WebDriver.for :firefox, :profile => profile

driver.navigate.to "my page"


These don't work:
profile['general.vendor.override'] = "Vendor" #
profile['general.vendorsub.override'] = "Subvendor" #


I am using Firefox 3.6.2 on linux ubuntu 10.10


cheers


Leo

Reported by leonardoanalista on 2010-11-30 14:05:47

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

In what way are the last two not working? They do appear in about:config for me:

http://i52.tinypic.com/2di0zf8.png




Reported by jari.bakken on 2010-11-30 19:46:32

  • Labels added: Component-WebDriver, Browser-Firefox

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Thanks Jari


Replacing the line above: driver.navigate.to "my page"

to:

driver.navigate.to "http://chrispederick.com/work/user-agent-switcher/features/test/"

I have attached the screenshot.


Maybe this is not really a bug but I had no option when I created the issue...

Btw how did you verify the override values in your attached picture?


cheers
Leonardo

Reported by leonardoanalista on 2010-11-30 21:51:25


- _Attachment: selenium_headers.png
![selenium_headers.png](https://storage.googleapis.com/google-code-attachments/selenium/issue-1054/comment-2/selenium_headers.png)_

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I'm guessing Firefox no longer supports overriding those navigator properties through
user prefs (or the keys have changed). Setting them manually seems to have no effect
on the results of that page either. If you can see the preferences in about:config,
then WebDriver is working as advertised. :)

Reported by jari.bakken on 2010-11-30 22:14:44

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Here are the correct properties:

 profile['general.useragent.vendor'] = "Vendor" 
 profile['general.useragent.vendorSub'] = "Subvendor" 


Reported by jari.bakken on 2010-11-30 22:17:29

  • Status changed: Invalid

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Thats' great! 
thanks a lot

Leonardo

Reported by leonardoanalista on 2010-12-01 11:02:31

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Do you think we could disable cookies as well?

Leo

Reported by leonardoanalista on 2010-12-02 12:53:04

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I don't know. You'll need to ask Google/Mozilla.

Some preferences are documented here (though not sure how up-to-date that is):

http://preferential.mozdev.org/preferences.html

Reported by jari.bakken on 2010-12-02 13:35:04

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by jari.bakken on 2015-02-26 23:01:19

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by luke.semerau on 2015-09-17 18:11:38

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 2, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant