Browser : Chrome V65
ChromeDriver: chromedriver.exe 2.37
Error occurs while webdriver trying to click an element. The below is my click():
def click(self):
try:
self.wait_for().visible()
self._selenium_context().click()
except Exception as e:
raise NoSuchElementException
def visible(self):
'''
Check if the element is visible.
:return: True or exception.
'''
return Utils.wait_for(self.web_element.visible, self.interval, self.timeout)
I had already waited for element visible and then clicked. But exception was thrown saying 'Other element would receive the click' as below:
selenium.common.exceptions.WebDriverException: Message: unknown error: Element <div class="learn-wrap" ng-click="changeTab(2)" ng-class="internal.tab == 2?'learn-selected':''">...</div> is not clickable at point (1026, 89). Other element would receive the click: <div class="loading-data ng-scope ng-animate ng-leave ng-leave-active" ng-if="internal.isAjaxing" data-ng-animate="2" style="">...</div>
Error occurs even if I add statement to wait ajax loading finished to click the element:
driver.find_element(By.XPATH, "//div[contains(@class, 'learn') and (contains(@ng-if, '!internal.isAjaxing'))]")
driver.find_element(By.XPATH , element_xpath).click()
This happens on Chrome frequently, maybe 4 in 5 times failure. It doesn't work!
Now, I have to use sleep to wait element to be clickable instead.
Can anybody help? Thanks.