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

Set UserAgent in casperjs #601

Open
2 tasks
kentr opened this issue Nov 27, 2018 · 0 comments
Open
2 tasks

Set UserAgent in casperjs #601

kentr opened this issue Nov 27, 2018 · 0 comments

Comments

@kentr
Copy link

kentr commented Nov 27, 2018

When using phantomjs, the UserAgent is set to the following in phantom.js

"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.17"

However, when using casperjs, the UserAgent is not set. casperjs uses its default value. On my system that is:

"Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/538.1 (KHTML, like Gecko) CasperJS/1.1.3+PhantomJS/2.1.1 Safari/538.1"

It is preferable for Wraith to use the same custom UserAgent with casperjs as it does with phantomjs as a baseline, to sidestep UserAgent blocking.


Reporting a problem? Please describe the issue above, and complete the following checklist so that we can help you more quickly.

Issue checklist:

  • [Y ] I have validated my config file against YAML Validator to make sure it is valid YAML.

  • [Y ] I have run the wraith info command and pasted the output below:

Ignoring ffi-1.9.23 because its extensions are not built.  Try: gem pristine ffi --version 1.9.23
Ignoring nokogiri-1.8.2 because its extensions are not built.  Try: gem pristine nokogiri --version 1.8.2
/opt/local/lib/ruby2.3/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': incompatible library version - /Users/Wraith/.gem/ruby/2.3.0/gems/nokogiri-1.8.2/lib/nokogiri/nokogiri.bundle (LoadError)
	from /opt/local/lib/ruby2.3/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Users/Wraith/.gem/ruby/2.3.0/gems/nokogiri-1.8.2/lib/nokogiri.rb:32:in `rescue in <top (required)>'
	from /Users/Wraith/.gem/ruby/2.3.0/gems/nokogiri-1.8.2/lib/nokogiri.rb:28:in `<top (required)>'
	from /opt/local/lib/ruby2.3/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /opt/local/lib/ruby2.3/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Users/Wraith/.gem/ruby/2.3.0/gems/chromedriver-helper-1.2.0/lib/chromedriver/helper/google_code_parser.rb:1:in `<top (required)>'
	from /opt/local/lib/ruby2.3/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /opt/local/lib/ruby2.3/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Users/Wraith/.gem/ruby/2.3.0/gems/chromedriver-helper-1.2.0/lib/chromedriver/helper.rb:2:in `<top (required)>'
	from /opt/local/lib/ruby2.3/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
	from /opt/local/lib/ruby2.3/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
	from /opt/local/lib/ruby2.3/2.3.0/rubygems/core_ext/kernel_require.rb:39:in `require'
	from /Users/Wraith/.gem/ruby/2.3.0/gems/chromedriver-helper-1.2.0/bin/chromedriver:3:in `<top (required)>'
	from /Users/Wraith/.gem/ruby/2.3.0/bin/chromedriver:22:in `load'
	from /Users/Wraith/.gem/ruby/2.3.0/bin/chromedriver:22:in `<main>'
/Users/Wraith/.gem/ruby/2.3.0/gems/wraith-4.2.1/lib/wraith/helpers/utilities.rb:58:in `run_command_safely': undefined method `chomp' for nil:NilClass (NoMethodError)
	from /Users/Wraith/.gem/ruby/2.3.0/gems/wraith-4.2.1/lib/wraith/helpers/utilities.rb:36:in `list_debug_information'
	from /Users/Wraith/.gem/ruby/2.3.0/gems/wraith-4.2.1/lib/wraith/cli.rb:169:in `info'
	from /Users/Wraith/.gem/ruby/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
	from /Users/Wraith/.gem/ruby/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
	from /Users/Wraith/.gem/ruby/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
	from /Users/Wraith/.gem/ruby/2.3.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
	from /Users/Wraith/.gem/ruby/2.3.0/gems/wraith-4.2.1/bin/wraith:5:in `<top (required)>'
	from /Users/Wraith/.gem/ruby/2.3.0/bin/wraith:22:in `load'
	from /Users/Wraith/.gem/ruby/2.3.0/bin/wraith:22:in `<main>'
  • I have run the command in verbose mode (by adding verbose: true to my config) and pasted the output below:
N/A
  • I have pasted the contents of my config file below:
N/A
kentr added a commit to kentr/wraith that referenced this issue Nov 27, 2018
Changes the casperjs UserAgent to the same value used by phantomjs.

Fixes bbc#601
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant