axe-selenium-python icon indicating copy to clipboard operation
axe-selenium-python copied to clipboard

Boolean values in options arg

Open afalco103 opened this issue 3 years ago • 0 comments

Hey folks, trying to add some rule specifications into the axe 'run' function but am getting the following error

../venv/lib/python3.6/site-packages/axe_selenium_python/axe.py:53: in run
    response = self.selenium.execute_async_script(command)
../venv/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:659: in execute_async_script
    'args': converted_args})['value']
../venv/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
    self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10e914748>
response = {'status': 500, 'value': '{"value":{"error":"javascript error","message":"javascript error: True is not defined\\nJava...fff7082fe65 _pthread_start + 148\\n20  libsystem_pthread.dylib             0x00007fff7082b83b thread_start + 15\\n"}}'}
    axe = Axe(driver)
    axe.inject()
    rules = {"meta-viewport-large": {"enabled": True}}
    results = axe.run(options={'rules': rules})

if I try a rules object like this {"meta-viewport-large": {"enabled": "true"}}, it works. I think it would be helpful to either document that booleans need be formatted like js ones but as strings, or even better have this library automatically convert a Python bool to a stringified js one.

afalco103 avatar Nov 12 '20 21:11 afalco103