0

I am trying to make click for this element, but getting error like

>> ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (271, 705)

element = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, '//*[@action="/battle/"]/div/input[2]')))
        element.click();

This is not helping also getting timeoutexception. I think element kinda covered

with:

[driver.find_element_by_xpath('//[@action="/battle/"]/div/input[2]').click()]

<form action="/battle/" method="post" name="4416" id="4416" onsubmit="get('/battle/', '', this); disableSubmitButton(this); return false;"><div class="battleView" style="float:left; width:65%;"><h3 class="heading-maroon no-right-border-rad margin-right-2">Attack Results</h3><table cellpadding="0" cellspacing="0" style="width: 80%; text-align: center; margin: 0 auto;">
...
</tbody></table><input type="hidden" class="button-maroon button-small" name="action" value="attack">

<input type="submit" class="button-maroon button-small" value=" Attack .. "></div>
</form>
Avinash Raj
  • 172,303
  • 28
  • 230
  • 274
Ali Özyer
  • 11
  • 2

1 Answers1

0

It looks like it's showing the X/Y coordinates (271,705) in the error message. I'd try a macro product like AppRobotic to look up the X/Y coordinates of elements that you have issues finding with XPATH, moving the mouse, or sending keystroke TABS, and clicking it. A simple example:

import win32com.client
x = win32com.client.Dispatch("AppRobotic.API")
from selenium import webdriver

# navigate to Yahoo
driver = webdriver.Firefox()
driver.get('https://www.yahoo.com') 
# sleep 1 second
x.Wait(1000)

link = driver.find_element_by_link_text('Mail')
if len(link) > 0
    link[0].click()
else
    x.Wait(3000)
    # use UI Item Explorer to get X,Y coordinates of Mail box
    x.MoveCursor(271,705)
    # click inside Search box
    x.MouseLeftClick

    # could also try tabbing over and pressing Enter
    x.Type("{TAB}")
    x.Type("{ENTER}")

Another idea is to try scrolling to the element with Selenium first:

from selenium.webdriver.common.action_chains import ActionChains

element = driver.find_element_by_xpath('//[@action="/battle/"]/div/input[2]')
actionchains = ActionChains(driver)
actionchains.move_to_element(element).perform()
James
  • 39
  • 2
  • dear thank you for your answer, everything is fine except that "Robotic.API" Could you please explain that part? do i have to get anything extra to use those codes? – Ali Özyer May 02 '19 at 07:04