We're sorry, but your computer or network may be sending automated queries error while loading Google API in automated test environment using Selenium

Paweł Andziak picture Paweł Andziak · Jan 20, 2020 · Viewed 21.2k times · Source

I have a single page application that uses Google API JS client.

There's also an automated functional test suite for this application written in Java and Selenium that is ran against a test environment every time the app is built. Test suite spawns multiple browsers that more or less simultaneously click through multiple flows of the application.

This often causes Google to return HTTP 403 for the following file:

<script src="https://apis.google.com/js/api.js"></script>

with additional information:

We're sorry, but your computer or network may be sending automated queries. To protect our users we can't process your request right now.

I tried looking into Google API quotas, but they seem to affect only the actual API calls, not the client library itself.

Has anyone encountered a similar issue? We can detect this situation and retry a failed test, but it results in even more calls to apis.google.com and make the tests awfully slow. It's also harder to determine if the test time has increased because of changes in the application or because the GAPI client library failed to load.

Answer

DebanjanB picture DebanjanB · Jan 20, 2020

This error message...

We're sorry, but your computer or network may be sending automated queries. To protect our users we can't process your request right now.

...implies that the Google Chrome browser was able to detect devices on your network which seem to be sending automated traffic to Google.

From the support article "Unusual traffic from your computer network":

"Unusual traffic from your computer network"

If devices on your network seem to be sending automated traffic to Google, you might see the error ..."Our systems have detected unusual traffic from your computer network"...

What Google considers automated traffic

Google considers the following situations as automated traffic:

  • Sending searches from a WebDriver driven browser, robot, computer program, automated service, or search scraper
  • Using software that sends searches to Google to see how a website or webpage ranks on Google

What to do when you see this message

The error page most likely shows a reCAPTCHA. To continue using Google, solve the reCAPTCHA. That is how Google will know you are a human and not a robot. Once you solve the reCAPTCHA, the message will go away and you can use Google again.

References

You can find a couple of relevant discussions in:


TL;DR

"Unusual traffic" blocks searching or requires reCAPTCHA