Evaluating expression 'webdriver_manager.firefox.GeckoDriverManager().install()' failed: ValueError: response body: {"message":"API rate limit exceeded for <IP address>

Hi Mentors,

Suddenly I am getting this exception when running the tests.


Navigate To Products Page from Catalog                                | FAIL |
Setup failed:
Evaluating expression 'webdriver_manager.firefox.GeckoDriverManager().install()' failed: ValueError: response body:
{"message":"API rate limit exceeded for <ip_address>. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)","documentation_url":"https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}

request url:
https://api.github.com/repos/mozilla/geckodriver/releases/latest
response headers:
{'Date': 'Wed, 31 Jan 2024 08:44:35 GMT', 'Server': 'Varnish', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains; preload', 'X-Content-Type-Options':
 'nosniff', 'X-Frame-Options': 'deny', 'X-XSS-Protection': '1; mode=block', 'Content-Security-Policy': "default-src 'none'; style-src 'unsafe-inline'", 'Access-Contr
ol-Allow-Origin': '*', 'Access-Control-Expose-Headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
, X-RateLimit-Used, X-RateLimit-Resource, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset', 'Content-Type': 'appli
cation/json; charset=utf-8', 'Referrer-Policy': 'origin-when-cross-origin, strict-origin-when-cross-origin', 'X-GitHub-Media-Type': 'github.v3; format=json', 'X-Rate
Limit-Limit': '60', 'X-RateLimit-Remaining': '0', 'X-RateLimit-Reset': '1706691229', 'X-RateLimit-Resource': 'core', 'X-RateLimit-Used': '60', 'Content-Length': '278', 'X-GitHub-Request-Id': 'CABE:112954:4CC7557:4D9D48A:65BA0873'}
------------------------------------------------------------------------------
RunnerForCatalogProductsPage                                          | FAIL |

I even defined the path where the driver is being installed:


*** Settings ***
Library     SeleniumLibrary
Library    ../lib/CustomLib.py

*** Variables ***
${FF_PROFILE_DIR_FOR_FIREFOX}=     C:\\Users\\munee\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\k0tnydro.default-release
${URL}=             https://admin-demo.nopcommerce.com/login
${WEB_BROWSER}=     Firefox
#${firefoxdriverpath}= 	                    C:\\Users\\munee\\.wdm\\drivers\\geckodriver\\win64\\v0.34.0\\geckodriver.exe

*** Keywords ***
Update Firefox Webdriver
	${firefoxdriverpath}= 	    Evaluate    C:\\Users\\eagertolearn\\.wdm\\drivers\\geckodriver\\win64\\v0.34.0\\geckodriver.exe       modules=webdriver_manager.firefox
	#${driverpath}= 	Evaluate 	webdriver_manager.firefox.GeckoDriverManager().install() 	modules=webdriver_manager.firefox
	Log         ${firefoxdriverpath}
	RETURN 	    ${firefoxdriverpath}

Is this due to running the tests many times, since I am learning, i make changes and try.
Any help will be gratefully appreciated.
Sincere Regards
EagerToLearn

Hi @EagerToLearn,

Yes this is exactly the issue, the server is telling you you’ve made too many requests within the time period.

From the error message you can see this link Getting started with the REST API - GitHub Docs, I suggest you read that. take a break and come back in an hour

See also in your response headers:

'X-RateLimit-Limit': '60', 
'X-RateLimit-Remaining': '0', 
'X-RateLimit-Reset': '1706691229', 
'X-RateLimit-Resource': 'core', 
'X-RateLimit-Used': '60',

FYI - 1706691229 was about 22 minutes ago, you can use https://www.epochconverter.com/ to translate that number to human readable time

Pay attention to those headers so you know when you approach the limits.

Dave.

OK, Great
I go through the document.
By the way is this possible to have a distinct path to the driver and update it once a week?


*** Keywords ***
Update Firefox Webdriver
	${firefoxdriverpath}= 	    Evaluate    C:\\Users\\munee\\.wdm\\drivers\\geckodriver\\win64\\v0.34.0\\geckodriver.exe       modules=webdriver_manager.firefox
	#${driverpath}= 	Evaluate 	webdriver_manager.firefox.GeckoDriverManager().install() 	modules=webdriver_manager.firefox
	Log         ${firefoxdriverpath}
	RETURN 	    ${firefoxdriverpath}

IF    "${WEB_BROWSER}" == "Firefox"
                ${driverpath}=  Update Firefox Webdriver
                Log    Get Current User
                Log    "Path to Firefox driver is ${driverpath}"       console=True
                **Open Browser    ${URL}      ${WEB_BROWSER}      executable_path=${driverpath}   ff_profile_dir=${FF_PROFILE_DIR_FOR_FIREFOX}**    service_log_path=${{os.path.devnull}}
                ${library_instance}=     Get Library Instance    SeleniumLibrary
                Log    "Value of Libray Instance with its driver is ${library_instance.driver}"     console=True
                Set Driver    ${library_instance.driver}
                Sleep               2s

Sincere Regards

Ah I think I see the rate limit error came from when you were updating the firefox webdriver?

I’m not sure you need to use this workaround anymore? As @rasjani mentioned in this thread Selenium should do this for you now. He knows much more about SeleniumLibrary than me.

Dave.

2 Likes

Thank you so much.
Now it is working.
Sincere Regards
EagerToLearn

1 Like