watir / watir.github.io

Code for our Website
http://watir.github.io/
MIT License
11 stars 65 forks source link

Add usage of no_proxy to proxy use documentation #183

Open i2blind opened 2 years ago

i2blind commented 2 years ago

Meta -

Watir Version: N/A Selenium Version: N/A Browser Version: N/A Browser Driver Version: N/A OS Version: N/A

Expected Behavior -

proxy documentation found at http://watir.com/guides/proxies/ should contain references on how to add noproxy or no_proxy to the proxy object.

no_proxy is important for modern authentication methods like azure_ad where the watir needs to communicate to an internal application but also reach out on the internet to outside resouces like azure. The proxy may not have access to the internal network causing tests to tail.

proxy = { http: 'my.proxy.com:8080', ssl: 'my.proxy.com:8080', no_proxy: "company.com,company.net" }

Actual Behavior -

proxy = { http: 'my.proxy.com:8080', ssl: 'my.proxy.com:8080' }

The correct usage of either no_proxy or noProxy, whichever is correct, is not referenced.

Thank you for taking a look.

titusfortner commented 2 years ago

What all is allowed is here, but I don't have any working examples to show: https://w3c.github.io/webdriver/#proxy

Ruby Selenium converts correct Ruby conventions (Symbols with snake case) to Strings with Camel Case, so you don't have to worry about that part.

i2blind commented 2 years ago

My experimentation shows that no_proxy works for both chrome and firefox. however it seems that firefox is okay with something like "company.com,company.net" while this utterly fails for chrome. chrome needs '.company.com,.company.net'

      when 'chrome'
        if ENV.has_key?('PROXY')
          driver_options[:proxy] = {
            http: ENV['PROXY'],
            ssl: ENV['PROXY'],
            no_proxy: '*.company.net,*.company.com'
          }
        end

and for firefox

      when 'firefox'
        if ENV.has_key?('PROXY')
          driver_options[:proxy] = {
            http: ENV['PROXY'],
            ssl: ENV['PROXY'],
            no_proxy: 'company.net,company.com'
          }
        end

I was just guessing on chrome needing the *. but it seems to work. couldn't find much out there on what no_proxy should exactly contain.

titusfortner commented 2 years ago

Spec says it should be a list of Strings, what if you put those values in an array?