简体   繁体   English

gcp 上的远程 Chrome WebDriver

[英]Remote Chrome WebDriver on gcp

I run remote chrome webdriver in GCP Cloud Run.我在 GCP Cloud Run 中运行远程 chrome webdriver。 It works well if I use unathenicated service call and i can connect from my java code to this Chrome Webdriver.如果我使用 unathenicated 服务调用,它工作得很好,我可以从我的 java 代码连接到这个 Chrome Webdriver。 However, once i enable gcp authentication service-to-service , it stops working.但是,一旦我启用 gcp authentication service-to-service ,它就会停止工作。 I wasn't able to find a way to provide google token to Selenium Remote Webdriver.我无法找到向 Selenium 远程 Webdriver 提供 google 令牌的方法。 I understand that I need to extend one of existing Selenium java classes, like RemoteWebDriver or HttpCommandExecutor, but it's not clear which class exactly.我了解我需要扩展现有的 Selenium java 类之一,例如 RemoteWebDriver 或 HttpCommandExecutor,但尚不清楚究竟是哪个 class。 Please advice.请指教。

I was trying to modify the RemoteWebDriver object or use the RemoteWebDriverBuilder to add a custom request filter where I add the auth header with a bearer token but no luck.我试图修改 RemoteWebDriver object 或使用 RemoteWebDriverBuilder 添加自定义请求过滤器,在其中添加带有不记名令牌的身份验证 header 但没有运气。

However, I was able to access the selenium/standalone-chrome docker image running as the Cloud Run service from another Cloud Run service via a custom VPC connector, I left the auth option "Allow unauthenticated invocations" but ingress option - "Allow internal traffic only" so my selenium service URL respond with 403 for the whole world but accessible from within the project infrastructure.但是,我能够通过自定义 VPC 连接器从另一个 Cloud Run 服务访问作为 Cloud Run 服务运行的selenium/standalone-chrome docker 映像,我留下了身份验证选项“允许未经身份验证的调用”入口选项 - “允许内部流量只有” ,所以我的 selenium 服务 URL 响应全世界的 403,但可以从项目基础设施中访问。

One more thing - when you specify the VPC connector for the selenium Cloud Run service - select "Route only requests to private IPs through the VPC connector" since "Route all traffic through the VPC connector" would make not possible for selenium to access the world wide web.还有一件事 - 当您为 selenium Cloud Run 服务指定 VPC 连接器时 - select “仅通过 VPC 连接器将请求路由到私有 IP” ,因为“通过 VPC 连接器路由所有流量”将使 Z8E00596AD8DE22236FFC 无法访问世界宽 web。

Also, I posted the issue here .另外,我在这里发布了这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Selenium chrome 远程 webdriver cookies - Selenium chrome remote webdriver cookies 无法在 Selenium 远程 WebDriver 中启动 Chrome 浏览器 - Unable to launch Chrome Browser in Selenium Remote WebDriver 为什么 Selenium webdriver 没有在远程机器上最大化 chrome? - Why Selenium webdriver is not maximize chrome on remote machine? Selenium webdriver 脚本在 Chrome 浏览器的远程机器上失败 - Selenium webdriver scripts fail on Remote machine for chrome browser 无法将远程调试器连接到Selenium WebDriver中无头的Chrome - Unable to Attach remote debugger to Chrome headless in Selenium WebDriver Selenium Remote WebDriver 在无头模式下使用 Chrome 获取画布内容 - Selenium Remote WebDriver get canvas content using Chrome in headless mode 将 Chrome 驱动程序与 Selenium webdriver.Remote Python 结合使用 - Using Chrome Driver with Selenium webdriver.Remote Python Python Selenium远程Webdriver(通过Selenium Grid的Chrome Webdriver),已创建但未打开浏览器 - Python Selenium Remote Webdriver(Chrome Webdriver via Selenium Grid), created but does not open browser 通过 Selenium 和 Python 调用 webdriver.Remote("http://localhost:4444/wd/hub", webdriver.DesiredCapabilities.CHROME) 时出现 WebDriverException - WebDriverException on invoking webdriver.Remote("http://localhost:4444/wd/hub", webdriver.DesiredCapabilities.CHROME) through Selenium and Python 在Chrome中“与远程浏览器通信时出错”错误后跳过selenium webdriver脚本 - Skipping selenium webdriver scripts after “Error communicating with the remote browser” error in chrome
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM