pythonmacosselenium-webdriversafarisafaridriver

Why can't SafariDriver click on a specific element when Chrome, FF, Edge can?


I have a trouble when running Safari UI tests on MAC. I have an element:

wd.find_element_by_xpath("//div[@id='ZoomBundle_people_search__searchTab-innerCt']//fieldset//span[text()='Company Information']")

enter image description here It collapses/uncollapses a hidden block with filters. When I perform a click() action in Chrome, FF or Edge, this action performed. But when I run the same code for Safari, I get the exception:

selenium.common.exceptions.ElementNotInteractableException: Message:
C:\python\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: ElementNotInteractableException

I tried to add WebDriverWait, but the result is the same. It sees the element, but can't interact with it.


Solution

  • It's a SafariDriver issue. Got a suggestion to try clicking via JS:

    wd.execute_script("arguments[0].click();", elem)
    

    instead

    elem.click()
    

    And it's working fine now (=