I'm trying to open an accordion link with selenium in python.
The element looks like this when closed:
<div class="crm-accordion-body" style="display: none;">
and this when open:
<div class="crm-accordion-body" style="display: block;">
The code I'm trying to use to change the style is:
driver.execute_script("document.getElementsByClassName('crm-accordion-body').style.display = 'block';")
This produces the following error:
WebDriverException: Message: unknown error: Cannot set property 'display' of undefined
(Session info: chrome=61.0.3163.100)
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.1.7601 SP1 x86_64)
Anyone know what I'm doing wrong?
Thanks.