javas = "document.getElementsByName('user-search').click();" driver.execute_script(javas)
Please note, we have used getElementsByName('user-search'). The functions like getElementsByName and getElementsById return an array of matching elements. So for locating the first element, the index is used.
userN= driver.find_element_by_id("user-search']") driver.execute_script("arguments.click();", userN)
selenium.common.exceptions.WebDriverException − Message − unknown error − Cannot read property 'innerHTML'
Also, there may be scenarios, when an improper action or a faulty name of function is used, for example a spelling error in function. In these cases as well, similar web driver exceptions will be thrown.