1

I have a table with few rows where I have SiteName 1,2 and so on and next to each site name I have Edit button. I want to have a loop which clicks on all Edit buttons. However I get error when I want to click on some buttons and only on some are working properly however the code for all rows is exactly the same as you can see this example bellow.

wls = ["//*[contains(text(), 'SiteName 8')]//following-sibling::td//a[contains(., 'Edit')]",
       "//*[contains(text(), 'SiteName 2')]//following-sibling::td//a[contains(., 'Edit')]",
       "//*[contains(text(), 'SiteName 1')]//following-sibling::td//a[contains(., 'Edit')]"]

for i in wls:
    # WL list
    driver.find_element_by_xpath(i).click()

this is the following-sibling I am using and it works for Site 1,2,3 and so on but not for site 8.

I get this error message message:

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element ... is not clickable at point (1783, 946). Other element would receive the click: ...

I also tried just to find the full xpath and still get the same error message however the button Edit is clickable and link is valid and working.

<tr>
  <td class="application_name alt" align="left">SiteName 1</td><td class="alt action">
   <div class="list-action">
    <a class="btn default " href="https://link1.com">
        <i class="fa fa-fa fa-edit">::before</i>
            Edit    
     </a>
   </div>
  </td>
</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>
 <td class="application_name alt" align="left">SiteName 8</td>
  <td class="alt action"><div class="list-action">
   <a class="btn default " href="https://link8.com">
    <i class="fa fa-fa fa-edit">::before</i>
            Edit    
   </a>
  </div>
 </td>
</tr>
Ismael Padilla
  • 5,246
  • 4
  • 23
  • 35
bbfl
  • 277
  • 1
  • 2
  • 16
  • Can you share the link? – Karthik Sep 03 '20 at 06:29
  • I can but won't be possible for you to open it since it's local only. – bbfl Sep 03 '20 at 06:33
  • 1
    @bbfl Check [this](https://stackoverflow.com/questions/44724185/katalon-error-unable-to-click-on-object-other-element-would-receive-the-cli/44724688#44724688) and [this](https://stackoverflow.com/questions/44912203/selenium-web-driver-java-element-is-not-clickable-at-point-x-y-other-elem/44916498#44916498) discussion. – undetected Selenium Sep 03 '20 at 07:01
  • Basically if it's overlapping we use javascript executioner and if it's in a iframe we switch to that beforehand. – Arundeep Chohan Sep 03 '20 at 07:22

1 Answers1

0

Use Java script executioner click instead of click method.

for i in wls: # WL list
    driver.execute_script("arguments[0].click();", driver.find_element_by_xpath(i))
rahul rai
  • 2,260
  • 1
  • 7
  • 17