1

I'm trying to build an Automation Script to upload and edit Data to a Website. And no matter what I try I can't click the edit button.

I need help with my Selenium Script. It works until I need to press the "Edit" button on the Site. This button is supposed to make it so you can edit the data in the shown table. But no matter what I try I can't click that button. I have tried every troubleshooting technique I could find online. Here is what what I know for sure:

  • I'm in the right iframe
  • the element is visible
  • the element is clickable with my mouse in pyautogui
  • selenium finds the right element at the right position
  • I waited long enough for the element to appear

The Main Problem is that the error Code says that the element is obscured by a different element. But that Element it is obscured by isn't going to go away and its not possible to click away since its the container for the command buttons. This happens with the normal .click() function

selenium.common.exceptions.ElementClickInterceptedException: Message: Element <button class="...> is not clickable at point (529,33) because another element <div class="...> obscures it

As said I can't click away the <div> tag since its simply the container for this button and not a pop up or something.

Here is all the code I tried so far which either resulted in an error or did nothing:

edit_button = driver.find_element(By.XPATH, "//button[@title='Edit this Site.']")
edit_button.click()

location = edit_button.location
x_offset = location['x']
y_offset = location['y']
actions = ActionChains(driver)
actions.move_to_element_with_offset(edit_button, x_offset, y_offset).click().perform()

driver.execute_script("arguments[0].scrollIntoView();", edit_button)
driver.execute_script("arguments[0].click();", edit_button)

actionChains = ActionChains(driver)
actionChains.click(edit_button).perform()

webdriver.ActionChains(driver).move_to_element(edit_button).click(edit_button).perform()


edit_button = WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH, "//button[@title='Edit this Site.']")))
edit_button.click()

I'm kind of helpless, what else can I try? The only thing that worked is pyautogui with the hardcoded mouse position which of course isn't optimal.

pyautogui.moveTo(833, 289)
pyautogui.click()

You may ask how I know for certain that I have the right element the following code works

webdriver.ActionChains(driver).move_to_element(edit_button).context_click(edit_button).perform()

and brings up the context menu at the exact position of the element but a normal click wont click that button.

Like I said I have no idea what else I can try I looked up many post on stack overflow to this subject and they where either solved by switching frame, waiting for the element to appear using some sort of wait or using the JavaScript alternative click. I tried all of this and none of this worked for me.

I can't share the website with you cause you need credentials for it but I can provide html code if it helps answering the question.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38

0 Answers0