I am writing the command "find item by xpath":

browser.find_element_by_xpath("//*[@id='tbl']/tbody/tr[1]/td[6]/span[3]/i") 

The test passes normally, but when I add a click() to this element:

 browser.find_element_by_xpath("//*[@id='tbl']/tbody/tr[1]/td[6]/span[3]/i").click() 

The test crashes, writes an error:

 selenium.common.exceptions.WebDriverException: Message: Element is not clickable at point (1251.9833984375, 12.25). Other element would receive the click: <ul class="nav top-links navbar-right"></ul> 

Closed due to the fact that it was off topic by aleksandr barakin , D-side , αλεχολυτ , user207618, user194374 August 31 '16 at 7:13 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - aleksandr barakin, D-side, αλεχολυτ, Community spirit, Community spirit
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Before clicking on an element, check if it is visible, and if another element of the page does not overlap it, in some cases you need to scroll the scroll so that it becomes visible. - Dmitriy Gvozd
  • Thanks solved the problem! - dron4ik
  • An element has a visible property, but keep in mind that it does not always mean that an element can be clicked if it is set to true. - Dmitriy Gvozd

1 answer 1

For python, you need to write the verification functions yourself, this is how I do it in VB.NET. I use similar functions when working with elements.

  Function checkVisibleWaitByElement(ByRef element As IWebElement, ByVal selector As String) As Boolean Try Dim elI As IWebElement = element.FindElement(By.CssSelector(selector)) If elI.Displayed = False Then Throw New ElementNotVisibleException End If Return True Catch ex As ElementNotVisibleException Return False Catch ex As NoSuchElementException Return False Catch ex As Exception Return False End Try End Function 

It is necessary to call in a loop, with a delay, to wait for an element to appear, for example.

  Sub waitVisibleByElement(ByRef element As IWebElement, ByVal selector As String) While (Not Me.checkVisibleWaitByElement(element, selector)) Thread.Sleep(200) End While End Sub 
  • I tried the scroll like it helped: browser.execute_script ("window.scrollTo (0, 0)") - dron4ik