YusukeIwaki / puppeteer-ruby

A Ruby port of Puppeteer
Apache License 2.0
284 stars 41 forks source link

args for Puppeteer.connect not available #301

Closed n1xn closed 1 year ago

n1xn commented 1 year ago

Step To Reproduce / Observed behavior

As proxies are not supported I tried to pass in arguments to my remote chrome instance. Unfortunately this is also not supported.

browser = Puppeteer.connect(browser_ws_endpoint: 'ws://localhost:4000/, args: browser_arguments)
page = browser.pages.first
page.authenticate(username: 'user', password: 'pass')

def browser_arguments
  [
    "--proxy-server=http://host:port"
  ]
end

UnexpectedError: ArgumentError: unknown keyword: :args

Expected behavior

Having the ability to apply a proxy with connect.

Environment

Paste the output of ruby --version ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin18]

YusukeIwaki commented 1 year ago

Hi @n1xn , sorry for late response. I'm afraid that I'm not sure what you mean exactly. Could you let me know which do you intend for "Having the ability to apply a proxy with connect."?

n1xn commented 1 year ago

My bad, I could have put in more effort in my description.

Basically you can't add browser arguments when using connect but by now I think that this is not supported by puppeteer. I have solved this issue in my chrome container, there I use default launch args with the host and port of my proxy. In the last step I am just authenticating against like shown above.

Anyway, I really want to say thank you for all the effort!! So far this library has been a real joy to use, incredible work! 👏🏽