-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Ruby sample code for HTTP proxies section #445
Conversation
note: as shown in the checklist, I haven't rendered it on my local yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR.
As we're moving away from desired capabilities, can you please change code sample using driver specific options( like chromeoptions)
You can look into other code samples (except python) for reference.
Regards,
Harsha.
430e14e
to
5485a7c
Compare
versions:
The proxy option is deprecated, but I believe it is the one of only options that works atm at least for Chrome except
I tried to use $ irb
irb(main)[01:0]> profile = Selenium::WebDriver::Chrome::Profile.new
irb(main)[02:0]> profile['network.proxy.http'] = 'localhost'
irb(main)[03:0]> profile['network.proxy.http_port'] = 8000
irb(main)[04:0]> options = Selenium::WebDriver::Chrome::Options.new
irb(main)[05:0]> options.profile = profile
irb(main)[06:0]> driver = Selenium::WebDriver.for :chrome, options: options
Traceback (most recent call last):
1: from (irb):6
NoMethodError (undefined method `split' for :directory:Symbol) This is caused by I also tried using > defined? Selenium::WebDriver::Chrome::Capabilities
=> nil There is
module Selenium
module WebDriver
module Chrome
#
# Driver implementation for Chrome.
# @api private
#
class Driver < WebDriver::Driver Passing # rails c
irb(main)[01:0]> proxy = Selenium::WebDriver::Proxy.new(http: 'localhost:8000')
irb(main)[02:0]> cap = Selenium::WebDriver::Remote::Capabilities.chrome(proxy: proxy)
irb(main)[03:0]> driver = Selenium::WebDriver.for :chrome, capabilities: cap
Traceback (most recent call last):
1: from (irb):3
ArgumentError (unknown option: {:capabilities=>#<Selenium::WebDriver::Remote::Capabilities:0x00007f98945dedf8 @capabilities={:browser_name=>"chrome", :version=>"", :platform=>:any, :javascript_enabled=>true, :css_selectors_enabled=>true, :takes_screenshot=>false, :native_events=>false, :rotatable=>false, :firefox_profile=>nil, :proxy=>#<Selenium::WebDriver::Proxy:0x00007f989314ed70 @type=:manual, @http="localhost:8000">}>}) It seems all of them are fixed in version 4 alpha, so I'm going to upgrade it and try again. |
5485a7c
to
2da2b11
Compare
just rewritten the sample codes according to what the latest change log had to say. Maybe merge this PR after version 4 is released? @harsha509 Right now, it's 3.1 on rubygems.org -> https://rubygems.org/gems/selenium-webdriver |
Hi @masakazutakewaka , All the code samples in documentation section are tested with latest Alpha versions. Please let me know if you can try it out with alpha versions. Regards, |
Hi @harsha509,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@masakazutakewaka we can have the code samples with the latest alpha, that is fine, this is another way to motivate people to migrate. Perhaps you can add a comment in the code snippet saying that the code was written using Selenium 4 as a dependency.
1d73c2f
to
a8ce8d3
Compare
@diemol sure, that makes sense. I've just added comments to each locale. Would you mind checking it when you have a chance? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, what do you think @harsha509?
Hi @diemol, PR Looks good to me now. Thanks for providing comments and resolving it. We can merge it now Regards, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @masakazutakewaka !
Congratulations on your first contribution ! 🥳
Co-authored-by: Diego Molina <diemol@users.noreply.github.com> Co-authored-by: Sri Harsha <Harsha509@users.noreply.github.com> 069131d
Thank you for reviewing & merging it:) |
Description
Added Ruby code snippets for the HTTP proxy section across the locales. I tested the code snippet with
WEBrick::HTTPProxyServer
.Motivation and Context
It helps users understand how to integrate the library with their http proxy servers.
Types of changes
Checklist
before
after