0

I am trying to automate a process with python and selenium. I have used selenium on different websites before, but on this one, I need to execute javascript and I dont know how, eventhough I found some tutorials on internet.

enter image description here

I need to click Quick Entry in this dropdown menu, I can locate the element with selenium, but I cant execute the javascript.

<li id="MENU_QUICKENTRY" tabindex="0" navigateurl="Quickentry.event" onclick="javascript:return getTabData(this.id,event);">
                                        Quick Entry
                                    </li>

When I normally try .click(), it throws ElementNotInteractableException.

Thank you for all your answers

EDIT: I can click mitigation with .click( and it works, so it can be because it is not visible.¨

EDIT2: Normally its like this and you have to move your mouse to mitigation to access Quick entry enter image description here

0

1 Answer 1

1

This exception is occurred due to other element above (overlapping) your element and when selenium is trying to interact with it another element blocking it. So to avoid this issue we can use ActionChains to move to that element before clicking on it.

wait = WebDriverWait(driver, 20)
element = wait.until(EC.element_to_be_clickable((By.XPATH, "//li[contains(text(),'Quick Entry')]")))

actionChains = ActionChains(driver)
actionChains.move_to_element(element).click().perform()

Please add below import to your solution :

from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

Updated section :

menu= wait.until(EC.element_to_be_clickable((By.XPATH, "//*[contains(text(),'Mitigation')]")))
submenu = wait.until(EC.element_to_be_clickable((By.XPATH, "//li[contains(text(),'Quick Entry')]")))


hover = ActionChains(driver)
hover.move_to_element(menu).click()
hover.click(submenu)
hover.perform()
Sign up to request clarification or add additional context in comments.

7 Comments

It doesnt work because I think I have to hover over mitigation before, because the button is not visible until i do that
I tried this: menu = driver.find_element_by_id("MENU_MITIGATION") hidden_submenu = driver.find_element_by_id("MENU_QUICKENTRY") actions = ActionChains(driver) actions.move_to_element(menu) actions.click(hidden_submenu) actions.perform()
What exception are you facing & can you provide your url /
selenium.common.exceptions.TimeoutException
You have to login to get access so no
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.