简体   繁体   中英

Remote Chrome WebDriver on gcp

I run remote chrome webdriver in GCP Cloud Run. It works well if I use unathenicated service call and i can connect from my java code to this Chrome Webdriver. However, once i enable gcp authentication service-to-service , it stops working. I wasn't able to find a way to provide google token to Selenium Remote Webdriver. 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. 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.

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.

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.

Also, I posted the issue here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM